0

How do I get PIP installed for python 3.4 version on RHEL? I tried the below and it is giving errors.

[root@ttudev]# curl -O https://bootstrap.pypa.io/get-pip.py

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1379k  100 1379k    0     0   773k      0  0:00:01  0:00:01 --:--:--  874k

[root@ttudev]# python get-pip.py

Traceback (most recent call last):

     File "get-pip.py", line 17759, in <module>
        main()
      File "get-pip.py", line 162, in main
        bootstrap(tmpdir=tmpdir)
      File "get-pip.py", line 82, in bootstrap
        import pip

zipimport.ZipImportError: can't decompress data; zlib not available

Not sure why it says zlib is not available. When I do rpm -qa |grep zlib. I see it is there on the system. zlib-1.2.3-29.el6.x86_64

Could anyone help me resolve this. have already spent too much time on this.

Thanks

Update

This is how I installed python 3.4

wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
$ tar xf Python-3.* 
$ cd Python-3.*
$ ./configure
$ make
$ make altinstall

This is how I made python3 the default one since I have python2.6 also installed.

alias python=python3

Could someone help me here pls?

user3356554
  • 109
  • 1
  • 3
  • 11
  • python 3.4 should ship pip by default afaik. `python -m ensurepip` should work. Also please add the output of `which -a python` to your question – cel Sep 23 '15 at 18:00
  • Here is the output of both the commands. [root@ttudev]# python -m ensurepip Ignoring ensurepip failure: pip 6.0.8 requires SSL/TLS [root@ttudev]# which -a python alias python='python3.4' /usr/local/bin/python3.4 /usr/bin/python – user3356554 Sep 23 '15 at 18:30
  • My interpretation from what I see here: You have manually installed python into `/usr/local/python`, this installation however is broken. It does not seem to be linked against necessary libraries. – cel Sep 23 '15 at 18:40
  • Any help to fix it will be extremely helpful. Here is the link I used to install python3 - http://stackoverflow.com/questions/8087184/installing-python3-on-rhel – user3356554 Sep 23 '15 at 18:46
  • You may want to edit your question and explain what commands you used to install. – cel Sep 23 '15 at 18:52
  • Cel - I added the update on how I installed python3.4 – user3356554 Sep 23 '15 at 19:48
  • Your approach should in principle work. I am not sure what exactly went wrong. Instead of compiling python yourself, I would consider using a binary distribution such as `anaconda`. – cel Sep 24 '15 at 06:24
  • do this sudo yum –y install python3-pip and to check pip3 –V – Sachin Rajput Dec 11 '20 at 14:15

2 Answers2

0

As of yesterday, there's a new getting started for adding Python 3.4 to either RHEL 6 or 7 - https://developers.redhat.com/products/softwarecollections/hello-world/#fndtn-python [updated link]

Installing another python version can be tricky, so Red Hat create "Software Collections" to install new versions for you that you can then use as default. (note that this does not replace the original python version.)

HTH

Mike Guerette
  • 533
  • 3
  • 6
0

When you build Python from source, there are a number of dependencies needed to make many of the modules work. To fix this you need to install a number of -devel packages to include the libraries and headers for bzip2, openssl, and more.

Building Python from source unless you really need to is a bad idea. There are a lot of answers that say to build from source but they are incomplete.

There are RPM distributions you can easily install. If you are on RHEL, use Red Hat Software Collections to get Python 3.4, 3.5, 3.6, or 2.7.13 that is supported by Red Hat.

See How to install Python 3 on RHEL for many tips on working with multiple Python versions, Python virtual environments, and software collections.

Rob T.
  • 386
  • 3
  • 5