17

SOLUTION My user did not own permissions to the pip directory, I reinstalled Python 3.5 using the sudo -H flag

I'm trying to install Tensorflow for python 3.5 using pip3 -- for reasons described in this github issue -- but when I install using sudo pip3 install *.whl it installs to python 3.4.

How can I redirect pip3 to install into my python 3.5 directory?

I'm running on Ubuntu 14.04

kendall@kendall-Macmini:~/Downloads$ python3.4 -m pip --version
pip 8.1.2 from /usr/local/lib/python3.4/dist-packages/pip-8.1.2-py3.4.egg (python 3.4)
kendall@kendall-Macmini:~/Downloads$ python3.5 -m pip --version
/usr/local/bin/python3.5: No module named pip

It looks like I don't even have pip installed for python 3.5. How can I do this?

I've tried

kendall@kendall-Macmini:~/Downloads$ pip install -U pip
Requirement already up-to-date: pip in /usr/local/lib/python3.4/dist-packages/pip-8.1.2-py3.4.egg

Also,

kendall@kendall-Macmini:~/Downloads$ whereis pip
pip: /usr/bin/pip /usr/bin/X11/pip /usr/local/bin/pip3.4 /usr/local/bin/pip /usr/local/bin/pip2.7 /usr/share/man/man1/pip.1.gz

I can't find any support for upgrading to pip3.5

UPDATE

kendall@kendall-Macmini:~/Downloads$ sudo apt-get install python3-setuptools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-setuptools is already the newest version.
The following packages were automatically installed and are no longer required:
  libntdb1 linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic
  linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic
  linux-signed-image-4.2.0-27-generic python-ntdb
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
kendall@kendall-Macmini:~/Downloads$ sudo python3.5 easy_install.py pip
python3.5: can't open file 'easy_install.py': [Errno 2] No such file or directory
kendall@kendall-Macmini:~/Downloads$ python3.5 -m ensurepip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS
kendall@kendall-Macmini:~/Downloads$ sudo apt-get install pip3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package pip3


kendall@kendall-Macmini:~/Downloads$ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl-dev is already the newest version.
The following packages were automatically installed and are no longer required:
  libntdb1 linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic
  linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic
  linux-signed-image-4.2.0-27-generic python-ntdb
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
kendall@kendall-Macmini:~/Downloads$ python3.5 -m ensurepip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

As recommended by @fwalsh

kendall@kendall-Macmini:~/Downloads$ python3.5 get-pip.py 
Traceback (most recent call last):
  File "get-pip.py", line 19177, in <module>
    main()
  File "get-pip.py", line 194, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available

It seems like I'm missing all sorts of dependencies -- I'm going to try reinstalling

5
  • pip.pypa.io/en/stable/installing/#installing-with-get-pip-py Commented Jul 7, 2016 at 16:27
  • pip already up to date Commented Jul 7, 2016 at 16:29
  • @fwalch I added update, it seems I'm missing all sorts of dependencies -- going to try reinstalling 3.5 Commented Jul 7, 2016 at 16:33
  • so were you able to install pip for python3.5? How did you do that part? That is what the question title is about but it seems you already did that? Commented Feb 8, 2017 at 21:39
  • Can you take the solution, answer your own question, then accept the answer? This would be the approved way to reply to your own question! Commented Jun 26, 2017 at 14:38

3 Answers 3

17

Check: /usr/local/lib/python3.5/dist-packages

You'll either have Pip there or easy_install(part of Pythons setup tools), which can be used to install Pip:

sudo apt-get install python3-setuptools
sudo python3.5 easy_install.py pip

Or you can try:

python3.5 -m ensurepip

Another option is attempting to install from a repository, the package name depends on your distribution:

sudo apt-get install python3-pip pip3

Edit: Try this correction for easy install:

sudo apt-get install python3-setuptools
sudo python3.5 /usr/local/lib/python3.5/dist-packages/easy_install.py pip

I'm assuming that's the directory it's installed to.

Also, you're missing this library for the python3.5 -m ensurepip command:

sudo apt-get install libssl-dev
Sign up to request clarification or add additional context in comments.

15 Comments

added update in the post. I'm beginning to think my python 3.5 install went wrong somewhere. Should I reinstall?
updated again, and again, is something wrong with my python 3.5 install? lol
I installed from the source python.org/downloads although now that I think about it, I'm beginning to think I installed the wrong source (wrong OS?) I clicked on the large `Download Python 3.5.21 button at the top of the page -- I'm running linux SCRATCH THIS IDEA
easy_install.py simply does not exist in my python 3.5 directory
Ah I found the issue! My user did not own the pip directory, I had to use the -H flag
|
1

All the various Python 3.* versions seem to re-use the same pip location, which makes it difficult to call for a specific Python version.

However, you can call pip for a specific version by specifying it as a module. So instead of doing:

pip3.5 install <blah>

which doesn't exist on most distros, do:

python3.5 -m pip install <blah>

Comments

-1

Try

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update
sudo apt install python3.8 python3.8-dev python3.8-venv

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2

python3 -V

1 Comment

The question is looking for python 3.5 version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.