Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeJS 8.5.0 RPM package requires Python 2.6 #526

Closed
SanderKnape opened this issue Sep 20, 2017 · 14 comments
Closed

NodeJS 8.5.0 RPM package requires Python 2.6 #526

SanderKnape opened this issue Sep 20, 2017 · 14 comments

Comments

@SanderKnape
Copy link

Since v8.5.0, when installing NodeJS on the Amazon Linux OS using the RPM it will also install Python 2.6 even if Python 2.7 is already installed.

This did not happen on NodeJS v8.4.0 so I believe something has changed in the specfile for the latest NodeJS version.

Is this something that can be fixed?

@chrislea
Copy link
Contributor

Python 2.x should always have been a dependency, it was an error if it wasn't in the past. The reason is that node-gyp needs it to build native addons correctly.

@SanderKnape
Copy link
Author

@chrislea I understand that Python is a dependency. When installing NodeJS 8.5 it correctly mentions that it needs Python > 2.6.

The problem is however that Python 2.7 is already installed, yet it still installs 2.6. This didn't happen before with NodeJS 8.4.

Steps to reproduce:

  • Spin up an EC2 instance in AWS using the Amazon Linux AMI
  • Install the NodeJS yum repository: curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
  • Check the currently installed python version: python --version # Python 2.7.12
  • Install the latest nodejs version: sudo yum install nodejs. This will install version 8.5.0 and will
    also install Python 2.6
  • Cancel installation. Instead, install NodeJS 8.4: sudo yum install nodejs-8.4.0. This will only install NodeJS 8.4 and no Python.

With NodeJS 8.5, I would also expect it not to install Python 2.6.

@chrislea
Copy link
Contributor

Ah, sorry, misread your initial comment. We'll look into this.

@chrislea chrislea reopened this Sep 20, 2017
@chrislea
Copy link
Contributor

The problem is that the package AWS installs isn't called python, it's called python27 and is a custom thing they make for their AWS Linux AMI.

[ec2-user@ip-172-30-26-105 ~]$ rpm -qf /usr/bin/python
python27-2.7.12-2.120.amzn1.x86_64

We'll see if this is a thing we can work around.

@chrislea
Copy link
Contributor

Unfortunately it doesn't look like this is a thing we can fix. rpm didn't gain the ability to do something like:

Requires: (somepackage or someotherpackage)

until version 4.13, which is newer than the version of rpm on AWS Linux and several other distros that we support.

The good news is that AWS Linux uses the alternatives system to choose what binary the python command points to, meaning that when version 2.6 gets installed, it does not become the version that gets run by default. Other than taking up a bit of disk space, it won't do anything at all unless you want it to.

Sorry we can't have a nicer fix, but outside of a bit of extra disk space used, this shouldn't have any negative effects on your system.

[ec2-user@ip-172-30-26-105 ~]$ python --version
Python 2.7.12
[ec2-user@ip-172-30-26-105 ~]$ curl -sL https://rpm.nodesource.com/setup_8.x | sudo bash -E - 2>&1 >/dev/null
[ec2-user@ip-172-30-26-105 ~]$ sudo yum -y install nodejs
Loaded plugins: priorities, update-motd, upgrade-helper
nodesource                                                                                                                               | 2.5 kB  00:00:00     
nodesource/x86_64/primary_db                                                                                                             |  19 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:8.5.0-1nodesource will be installed
--> Processing Dependency: python >= 2.6 for package: 2:nodejs-8.5.0-1nodesource.x86_64
--> Running transaction check
---> Package python26.x86_64 0:2.6.9-2.88.amzn1 will be installed
--> Processing Dependency: libpython2.6.so.1.0()(64bit) for package: python26-2.6.9-2.88.amzn1.x86_64
--> Running transaction check
---> Package python26-libs.x86_64 0:2.6.9-2.88.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================
 Package                                Arch                            Version                                       Repository                           Size
================================================================================================================================================================
Installing:
 nodejs                                 x86_64                          2:8.5.0-1nodesource                           nodesource                           17 M
Installing for dependencies:
 python26                               x86_64                          2.6.9-2.88.amzn1                              amzn-main                           5.8 M
 python26-libs                          x86_64                          2.6.9-2.88.amzn1                              amzn-main                           697 k

Transaction Summary
================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 23 M
Installed size: 70 M
Downloading packages:
(1/3): python26-libs-2.6.9-2.88.amzn1.x86_64.rpm                                                                                         | 697 kB  00:00:00     
(2/3): python26-2.6.9-2.88.amzn1.x86_64.rpm                                                                                              | 5.8 MB  00:00:00     
warning: /var/cache/yum/x86_64/latest/nodesource/packages/nodejs-8.5.0-1nodesource.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 34fa74dd: NOKEY:00:00 ETA 
Public key for nodejs-8.5.0-1nodesource.x86_64.rpm is not installed
(3/3): nodejs-8.5.0-1nodesource.x86_64.rpm                                                                                               |  17 MB  00:00:01     
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                            15 MB/s |  23 MB  00:00:01     
Retrieving key from file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Importing GPG key 0x34FA74DD:
 Userid     : "NodeSource <gpg-rpm@nodesource.com>"
 Fingerprint: 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
 Package    : nodesource-release-el7-1.noarch (installed)
 From       : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : python26-2.6.9-2.88.amzn1.x86_64                                                                                                             1/3 
  Installing : python26-libs-2.6.9-2.88.amzn1.x86_64                                                                                                        2/3 
  Installing : 2:nodejs-8.5.0-1nodesource.x86_64                                                                                                            3/3 
  Verifying  : python26-libs-2.6.9-2.88.amzn1.x86_64                                                                                                        1/3 
  Verifying  : python26-2.6.9-2.88.amzn1.x86_64                                                                                                             2/3 
  Verifying  : 2:nodejs-8.5.0-1nodesource.x86_64                                                                                                            3/3 

Installed:
  nodejs.x86_64 2:8.5.0-1nodesource                                                                                                                             

Dependency Installed:
  python26.x86_64 0:2.6.9-2.88.amzn1                                           python26-libs.x86_64 0:2.6.9-2.88.amzn1                                          

Complete!
[ec2-user@ip-172-30-26-105 ~]$ node --version
v8.5.0
[ec2-user@ip-172-30-26-105 ~]$ python --version
Python 2.7.12

@SanderKnape
Copy link
Author

Hi @chrislea , thanks for looking into this! I'm curious though why it worked on NodeJS 8.4 and not on 8.5. Any idea?

@chrislea
Copy link
Contributor

We (incorrectly) only had python as a build requirement and not an installation requirement prior to 8.5.0. This never got us in trouble, I suspect because RedHat / Fedora write all their system tools in python so it's always there, but it was still wrong.

If the AWS folks fix their python27 package so that it "Provides" python, then this annoying behavior will go away. But that's not something we can do for them.

@SanderKnape
Copy link
Author

Everything clear now - thanks! I'll contact AWS to see if this can be resolved.

@thom-nic
Copy link

I just ran into this on Debian, slightly different scenario... I'm running on an armhf device. I pre-build and package my entire application, including node_modules so that I don't need to npm install on the target.

I've been using nodesource distributions of nodejs v4, v6 and v8.2 happily up to now with this setup. Then, as OP mentioned, between 8.4 and 8.5, python-minimal was added as a dependency.

I understand why, but realistically node-gyp also needs make, autoconf and g++ which are not also listed as dependencies. If a user tries to npm install a native module and one of these are not installed, the user gets a warning and they install the tool. Same was true if python-minimal was not installed prior to 8.5. I never saw this is an issue that the package needed to enforce.

So now my options are:

  • Modify and distribute my own nodejs deb without the python-minimal dependency
  • install with --force-depends or --ignore-depends which causes constant heartache every time apt runs henceforth
  • eat the disk cost and install python-minimal
  • stick with nodejs < 8.5

@thom-nic
Copy link

thom-nic commented Dec 13, 2017

The python-minimal meta-package actually installs the following for a total of ~75MB:

The following NEW packages will be installed:
  file libexpat1 libmagic1 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib mime-support  python
  python-minimal python2.7 python2.7-minimal

On a ~400MB disk image this is not insignificant

@chrislea
Copy link
Contributor

@thom-nic I think you're overlooking what's probably the easiest option in your case, which is simply to grab the binary tarball you want from https://nodejs.org/dist. That way you'd be getting the exact same bits we ship, but without any packaging dependencies.

@thom-nic
Copy link

I had considered that. Is the install script doing more than untar to /usr? I'm not in front of a computer ATM. I should look at the install script

@thom-nic
Copy link

That is a helpful suggestion though. Before today I did not realize nodejs.org had an official armhf build. I've been using nodesource repos for quite some time since they used to be the only resource for prebuilt nodejs for ARM if I'm not mistaken.

Thanks Chris!

@chrislea
Copy link
Contributor

@thom-nic There have been both armhf and arm64 builds available at https://nodejs.org/dist for years. Though they're not linked from the homepage so it's easy to miss them. Hope this helps.

yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this issue Jul 4, 2018
and move downloaded package to /tmp so as to delete it at the end.

Install python-minimal which is required by NodeSource Node.js since
8.5.0, see nodesource/distributions#526
jsturgis pushed a commit to metabrainz/musicbrainz-docker that referenced this issue Jul 6, 2018
and move downloaded package to /tmp so as to delete it at the end.

Install python-minimal which is required by NodeSource Node.js since
8.5.0, see nodesource/distributions#526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants