I have both python 2 and 3 and pip 2 and 3 installed, and all had been working fine. I tried installing graph-tools (https://git.skewed.de/count0/graph-tool/wikis/installation-instructions) using port install py-graph-tool, and it seems to have messed with my installations.
Specifically, I can no longer install packages with pip3, e.g.:
$ pip3 install networkx
Traceback (most recent call last):
File "/Users/me/bin/pip3", line 8, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'
even though
$ which pip
/Users/me/bin/pip
$ which pip3
/Users/me/bin/pip3
Less immediately, I have had similar problems (I assume) with different Python installations interfering with each other... I have done some searching to better understand this problem, but anyone willing to explain the basics or point to some good explanations online, I would be grateful!
You can manually install pip3
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.6 get-pip.py
Related
I work on Ubuntu 14. I install python3 and pip3.
When I try to use pip3, I have this error
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 70, i
n <module>
import packaging.version
ImportError: No module named 'packaging'
Does someone know what is the issue?
Many thanks
First update your pip version itself. You can take a look at this answer
pip3 install --upgrade pip
And then try to install packaging, if its not already installed by now.
pip3 install packaging
I recently had the same error. Unfortunately none of the other answers solved my problem. Finally installing the following package resolved my issue:
sudo apt install python3-packaging
For older versions of Python you may need to adjust the command:
sudo apt install python-packaging
If I understand well, the issue that causes confusion in other's replies is that you have an error while running pip itself, which prevents self-updates of pip or installation of the missing package.
As requested, please state exactly how you installed Python 3 and pip. Ubuntu 14 does not come with Python 3.5.
For diagnosis, please give the output of
which python3
that is probably /usr/bin/python3 and refers to the system-wide python3 while your pip is located in /usr/local/bin/pip3.
Suggested solution: Uninstall system pip with apt-get remove python3-pip and try again with either pip3 or python3.5 -m pip.
I got this issue and I solved it by getting the path to my python module on my virtualenv
python3.7 -c 'import sys; print(sys.path)'
Then I cloned github repository for Packaging
in one of the directory..
That's about it
I tried all of the above.
I had to manually add the libraries to the pyinstaller command as data:
.\pyinstaller.exe -F --add-data ".\venv\Lib\site-packages\packaging;packaging" --add-data ".\venv\Lib\site-packages\webdriver_manager;webdriver_manager" --onefile .\departed_shipments.py
It seems like I messed up the system pip by pip3 install --upgrade pip. Actually I even do not exactly remember whether I did upgrade or not.
Now when I try to use pip3, it gives an error like
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/usr/bin/pip3", line 6, in <module>
from pip._internal import main
ImportError: cannot import name 'main' from 'pip._internal' (unknown location)
I tried sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall to revert back PIP by this answer, but it fails.
/Applications/Xcode.app/Contents/Developer/usr/bin/python3: No module named pip.__main__; 'pip' is a package and cannot be directly executed
which pip3 gives /usr/bin/pip3
Now I am trying to revert back the system tools and use virtual environment.
What should I do? I can't even check which pip version is installed at the moment.
Thanks in advance.
I have pip installed and can clearly see the file (by using which pip) but, when I go to actually run a command like pip install -r requirements.txt (or even just pip to get help), I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip'
I get this whether I'm using pip 2 or 3. What is going on here? Any way to fix it without reinstalling the whole thing?
Force a reinstall by running
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
Try this command
python -m pip <action>
Succinct answer - I ran pip -m site to see where my site packages are, and poked around in there and couldn't find pip. It must have gotten deleted...
This makes me wonder, though, why did pip disappear when I ran pip install --upgrade pip as it instructed me to do! 🤔
Using Ubuntu 16.04 with Python 3.5 I get import errors for some packages, e.g. 'BeautifulSoup4' or 'requests'. Both libraries are installed from the Ubuntu repositories:
$ dpkg --get-selections | grep -E "python3-req|python3-bs"
python3-bs4 install
python3-requests install
Yet I get "ImportError: no module named 'bs4'/'requests'".
$ python3 -c "import bs4"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'bs4'
Only when I (additionally!) install those libraries via pip3 it works. The documentation of BeautifulSoup says to install it as "python3-bs4" via apt. Why does it only work with the pip3 method? What's the purpose of the python3-bs4/python3-requests packages?
I was able to resolve the issue.
I'm still not quite sure what was the exact problem, but I suspect that pip3 and apt confused each other about what was actually installed. pip3 also listed several python packages which were installed via apt.
I removed/purged everything via apt that was recognized by pip3 list and also purged pip3. Then I apt install --reinstall the packages that gave me trouble previously: python3-bs4 and python3-requests. The requests library still didn't work because it missed the packages python3-six, python3-chardet and python3-urllib3 which where reported as already installed by apt. A apt install --reinstall fixed this as well. And then it worked!
I'm trying to get a program called hangoutsbot
to work on my linux server. I'm currently using a digital ocean server. However, every time I try to run the script it gives me an error that says:
ImportError: No module named 'appdirs'
I'm not sure what to do here. I've already tried installing appdirs from npm to no avail. This script works fine on my mac, however it doesn't seem to want to run on my linux server. Any help would be appreciated.
I ran across the same problem after solving the "missing pyparsing module" bug over here. I then started getting this error:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 74, in <module>
import appdirs
ImportError: No module named appdirs
I then used the manual installation steps there to find the missing package on pypi.python.org and came up with this manual installation sequence:
wget https://pypi.python.org/packages/48/69/d87c60746b393309ca30761f8e2b49473d43450b150cb08f3c6df5c11be5/appdirs-1.4.3.tar.gz
gunzip appdirs-1.4.3.tar.gz
tar -xvf appdirs-1.4.3.tar
cd appdirs-1.4.3
sudo python setup.py install
And that fixed it!
For some reason your pipenv installation is not completely done, maybe if you just uninstall and install all missing packages again, it can works. For example, if you are using a MAC:
sudo pip uninstall <missing packages> and after sudo pip install <missing packages>
In this specific case:
sudo pip uninstall appdirs and sudo pip install appdirs
When you run hangoutsbot you'll need to specifically call the python version that has the modules installed. The following worked for me and I had python3.4 and python3.5 installed.
python3.5 hangoutsbot/hangoutsbot.py -d
I had this issue on Ubuntu 14.04 , which ships with a really old version of pip. I was using python 2.7. Upgrading to a newer version of pip with "pip install --upgrade pip" solved this issue for me. (I did this within my virtualenv, but could be needed at the system level depending on what you are trying to do.)
This was where I discovered the solution:
https://www.reddit.com/r/Python/comments/5pwngp/setuptools_34_has_been_released_and_breaks_with/