Issue
I have multiple version of python on my machine that's why I've installed pyenv to manage them. According to pyenv I have
ola@station:~$ pyenv versions
* system (set by /home/ola/.pyenv/version)
3.4.6
3.5.3
3.6.1
I set the global (system default) to 3.5.3 as you can see
ola@station:~$ pyenv global
3.5.3
I would like to install numpy for python 3.5 as it is a missing module there. If I correctly understood how pyenv works, when I'm running sudo pip install numpy
pyenv figure out that the global version to use is 3.5.3 and install numpy for that, correct?
However, I get the following issue:
ola@station:~$ sudo pip install numpy
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2991, in <module>
@_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2977, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3004, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 664, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 677, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 856, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==8.1.2' distribution was not found and is required by the application
How can I resolve this?
NOTE Running sudo pip3 install numpy doesn't help since it tells me
ola@station:~$ sudo pip3 install numpy
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages
But there doesn't exist a numpy for python 3.5.3 on my machine. As far as I understood pip3 version and python version are different things.
Solution
You could try:
sudo python3 -m pip install numpy
If that doesn't work, you could try deleting numpy from python2. From what I remember, Ubuntu has some weird quirks when it comes to pip, so it depends on your OS/distribution too.
Answered By - Błażej Michalik