python3.4 pip ImportError: No Module named 'pkg_resources' - python

pip is not working in my python3.4
$ pip install django
Traceback (most recent call last):
File "usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'
$ pip
Traceback (most recent call last):
File "usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'
How do I fix this? What's the problem? Thanks

i just ran into the same error, here is what i've done to fix it:
sudo apt-get remove --purge python-pkg-resources
sudo apt-get install ubuntu-desktop

Try >sudo pip install django< I think that ought to do it
well then I suspect your pip is messed up so try
sudo apt-get install --reinstall python-pkg-resources
however if you are using Python 3 you may need to adjust to insure that you get the Python 3 environment set up rather than the P2 default
see here for more on that
How to use pip with Python 3.x alongside Python 2.x

Related

ModuleNotFoundError: No module named 'apt_pkg'

I'm using Ubuntu 16.04. I tried to add a repo using terminal. While adding that, I got an error :
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
I tried installing that module using various commands like :
pip3 install apt_pkg
sudo apt-get install --reinstall python3-apt
sudo apt-get install python3-apt --reinstall
Then if I tried to add that repo, the same error appeared.
The python versions I have is :
$ python3 --version
Python 3.7.9
$ python --version
Python 2.7.12
These are the versions I have in terminal. In IDLE, I have 3.5
What else shall I do to install that package apt_pkg???

Python can not import pywifi

I have install pywifi module and it success, when I try to import pywifi,I got this error.
>>> import pywifi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pywifi/__init__.py", line 15, in <module>
from .wifi import PyWiFi
File "/Library/Python/2.7/site-packages/pywifi/wifi.py", line 15, in <module>
from .iface import Interface
File "/Library/Python/2.7/site-packages/pywifi/iface.py", line 15, in <module>
raise NotImplementedError
NotImplementedError
someone can help me?
Which python version are you running? It might be because it is installed as a Python 3 package and you're running Python 2.7 or the opposite.
To specifically install the package for Python 3, try entering this command:
pip3 install pywifi
or
python3 -m pip install pywifi
To specifically install the package for Python 2, try entering this command:
pip2 install pywifi
or
python -m pip install pywifi
I got similar errors, from the error message, I tried to install those packages that pywifi seemed to depend on, i.e., I ran
pip install comtypes
pip install iface
then it worked.

ImportError: No module named gtk

I have a PC running Ubuntu 17.10. I want to runn a python script that uses gtk. HoweverI get the following error:
Traceback (most recent call last):
File "/usr/local/bin/selectvm.py", line 3, in <module>
import gtk
ImportError: No module named gtk
I have tried already many things like:
sudo apt install python-gtk2
sudo apt install python-gtk2-dev
but none of them works. APT says they are already installed.
Try:
sudo apt-get install python-gtk2
These are the python bindings for GTK.
Graphic package nessesary to build the software-center UI.
Or:
sudo apt-get install afnix
credits

Python ImportError: No module named utils

I am trying to run my python script in Debian but I keep getting the following error:
traceback (most recent call last):
File "gluon/contrib/websocket_messaging.py", Line 96, in <module>
import gluon.utils
ImportError: No module named utils
I've tried:
pip install gluon
Still didn't work. I also tried:
sudo apt-get update
sudo apt-get install python-gluon
but got
Unable to locate package python-gluon
Any help would be appreciated thank you
sudo apt-get update
sudo apt-get install python3-gluon
OR
pip3 install gluon

Problems Installing pip on CentOS 5.x

I have pip installed:
[amr#h2oamr kits]$ python get-pip.py
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
However, I'm getting this error when trying to install Django:
[amr#h2oamr kits]$ pip install django
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
I am stuck trying to move forward. I installed pip as recommended by using a get-pip.py module I downloaded.
This upgrade also did not work.
[amr#h2oamr kits]$ pip install --upgrade pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
How can I remove pip altogether, and then re-install it?
you can use the command $ rm pip to remove pip and then $sudo apt-get install pip to get the latest version

Categories

Resources