I am trying to install packages using pip and it is throwing error.
Command that I have used,
sudo pip install selenium
The error
Ahhh the classic lsb_release
issue. I have battled this problem many times. The issue is that your default Python implementation is trying to use Python 3 but lsb_release
requires Python 2. To fix this problem do the following:
/usr/bin/lsb_release
(Make sure you use sudo or open as root!)#! /usr/bin/python2.7
now you can use pip again and everything should be fine.
UPDATE May 2019: Newer versions of Linux are shipping with Python3 by default. As noted in the comments here, you may just need to use a specific version of Python 3.
After installing python from source on Debian-9 (I did install those packages however) I had the same issue. This is how I solved it:
/usr/local/bin/python3.x -m venv <my_venv>
. <my_venv>/bin/activate
easy_install pip
easy_install setuptools
easy_install wheel
pip install -U setuptools wheel pip
The solution for this issue is to update the shebang on the /usr/bin/lsb_release
The shebang on this lsb_release
file tells which version of python to use. This has to match with the current version of python you using.
For instance, I'm using Python 3.5 so I'd change the shebang to be:
#!/usr/bin/python3.5 -Es
And get it working.
I was able to fix this error message with unset _PYTHON_SYSCONFIGDATA_NAME
. This prevented lsb_release
from trying to import $_PYTHON_SYSCONFIGDATA_NAME
. After that, pip install
worked again. This fix applies if you run lsb_release -a
and get ModuleNotFoundError: No module named '_sysconfigdata_x86_64_conda_cos6_linux_gnu'
.