Reputation: 826
I am trying to install numpy using pip3. This is the command I used:
pip3 install numpy (also tried with sudo but it gives same error)
But I get the following error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(vendored_name, globals(), locals(), level=0)
ImportError: No module named 'pip._vendor.distro'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 11, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 67, in <module>
vendored("distro")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 1051, in <module>
File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 595, in __init__
File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 932, in _get_lsb_release_info
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1
This is the problem when I try to install any Python module This was working fine till just a few days ago.
I tried deleting pip altogether and then reinstalling it. But I get the same error None of the packages get installed via pip now.
I have python 3.6.5
How do I fix this problem?
Upvotes: 1
Views: 1150
Reputation: 84
i had this problem too. i solved it by installing anaconda and installing all ml packages
Upvotes: 1
Reputation: 5210
I had this problem after setting the system default to Python3.5. Oddly, it would appear that pip3
needs Python2.7 to function; running # update-alternatives --config python
and selecting Python2.7 got pip3
working again for me. I just installed pygame
this way, and it works as expected after switching the system default back to Python3.5. This is on Devuan ASCII and
$ python --version
Python 3.5.3
$ pip3 --version
...
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1
$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/python3.5 2 auto mode
1 /usr/bin/python2.7 1 manual mode
* 2 /usr/bin/python3.5 2 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
$ python --version
Python 2.7.13
$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
Edit: On Raspbian Stretch pip3
works with Python3.5 as the system default, so this is clearly not the full story:
$ python --version
Python 3.5.3
$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
Upvotes: 0