I try to make an easy Python gui, therefore I need to import tkinter. This package is available in Python 3, so I need that interpreter, but I can't get it started in Pycharm. It always asks to install packaging tools and then I get the same error everytime and I can't seem to fix it. I get the following:
Executed command:
/tmp/tmpu8m14jqspycharm-management/pip-9.0.1/setup.py install
Error occured:
AttributeError: module 'setuptools.dist' has no attribute 'check_specifier'
Command output:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2237, in resolve
return functools.reduce(getattr, self.attrs, module)
AttributeError: module 'setuptools.dist' has no attribute 'check_specifier'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmpu8m14jqspycharm-management/pip-9.0.1/setup.py", line 92, in <module>
cmdclass={'test': PyTest},
File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 272, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python3.5/distutils/dist.py", line 281, in __init__
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 327, in finalize_options
ep.load()(self, ep.name, value)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2239, in resolve
raise ImportError(str(exc))
ImportError: module 'setuptools.dist' has no attribute 'check_specifier'
I already searched some fixes but none actually worked.
Python PIP might not be installed. In Debian based distribution:
sudo apt-get install python3-pip
should solve if you use Python 3.
For Python 2.7x
sudo apt-get install python-pip
Close PyCharm and re-open it.
In this case, it may be possible that python pip (package installer) is not installed. So try installing that first.:
sudo apt-get install python3-pip
Related
In my Debian 10 OS, I have several Python versions as 2.7, 3.7 and 3.8. For Python 3.8, pip did not work(no module name pip) and I tried to install pip for Python 3.8 with 'sudo python3.8 get-pip.py' and it showed below error.
Traceback (most recent call last):
File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 568, in _get_data
File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "get-pip.py", line 23704, in <module>
main()
File "get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
from pip._internal.cli.main import main as pip_entry_point
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Then, I tried to install zlib with 'sudo apt install zlib1g-dev' but it showed that package is already in the system.
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g-dev is already the newest version (1:1.2.11.dfsg-1).
The following packages were automatically installed and are no longer required:
adb android-libadb android-libbase android-libboringssl
android-libcrypto-utils android-libcutils android-liblog
android-sdk-platform-tools-common arch-test bridge-utils cloud-image-utils
debootstrap distro-info genisoimage libayatana-appindicator3-1
libayatana-ido3-0.4-0 libayatana-indicator3-7 libboost-log1.67.0
libboost-program-options1.67.0 libboost-regex1.67.0
libboost-serialization1.67.0 liblxc1 libmotif-common libnma0 libpam-cgfs
libprotobuf-lite17 libsdl2-image-2.0-0 libu2f-udev libxm4 lxc lxc-templates
lxcfs network-manager-gnome qemu-utils squashfs-tools uidmap
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 127 not upgraded.
Can you try to do this:
sudo apt-get install zlib1g-dev
I've always used pip in installing python packages but for some unexplained reason it just stopped working. I have tried the following but still not working
i upgraded pip
i rolled back pip
-i uninstalled my python distribution and reinstalled/upgraded it. Here is a trace back of the kind of error i get whenever i try
installing a package with pip
OS- windows 10
pip install profanity
Collecting profanity
Using cached https://files.pythonhosted.org/packages/f6/b4/07d53456462e26eee50abcae787c9380c01731ccc0b6c96233770e546989/profanity-1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2698, in get_entry_map
ep_map = self._ep_map
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2669, in __getattr__
raise AttributeError(attr)
AttributeError: _ep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\MEME\AppData\Local\Temp\pip-install-xg7obvs0\profanity\setup.py", line 72, in <module>
['profanity=profanity:main'],
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\__init__.py", line 117, in _install_setup_requires
(k, v) for k, v in attrs.items()
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\dist.py", line 370, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 645, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2701, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Users\MEME\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2412, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\MEME\AppData\Local\Temp\pip-install-xg7obvs0\profanity\
I am creating a face recognition system using Python and OpenCV on these versions:
Python 3.6.2 (64-bit)
OpenCV 3.3.0
When I try to train the face recognizer:
face_recognizer = cv2.face.createLBPHFaceRecognizer()
and also I tried
face_recognizer = cv2.createLBPHFaceRecognizer()
It gave me attribute error
AttributeError: module 'cv2.cv2' has no attribute 'createLBPHFaceRecognizer'
When I tried
pip install opencv-python
I got these errors
Exception:
Traceback (most recent call last):
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'c:\\users\\anushi maheshwari\\appdata\\local\\programs\\python\\python36-32\\Lib\\site-packages\\cv2\\cv2.cp36-win32.pyd'
I'd been facing the same issue recently. Here's a list of things that went wrong:
You need to uninstall opencv before installing opencv-contrib
Make sure no console is running that has imported cv2 while you execute your installing process
Run the cmd in Administration Mode (Go to the .exe of the cmd program, right click and select 'Run as Administrator')
This should work.
Hope this helps!
In case of windows, in cmd try to run pip install using python executable
python -m pip install opencv-python
if you're using linux, you just have to give it superuser permission:
sudo -s
pip install opencv-python
note: do not use "su" because it does not recognize the "pip" command
You can use the below command i.e add user to the command
pip install --user opencv-contrib-python
while installing django-haystack using PIP with django version==1.10`
Collecting django-haystack
Using cached django_haystack-2.5.0-py2-none-any.whl
Collecting Django<1.10 (from django-haystack)
Using cached Django-1.9.9-py2.py3-none-any.whl
Installing collected packages: Django, django-haystack
Found existing installation: Django 1.10
Uninstalling Django-1.10:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/bin/django-admin'
Why Uninstalling django 1.10 and even why it can't
Using Ubuntu 16.04
Please Notify me if there is a familiar issue like that or even a question here Thanks
Have you tried installing it with sudo ? You usually need to use sudo to install some dependencies
I receive a funny error when trying to install virtualenv:
$ pip install virtualenv
yields the following error:
Collecting virtualenv
Using cached virtualenv-15.0.2-py2.py3-none-any.whl
Installing collected packages: virtualenv
Exception:
Traceback (most recent call last):
File "/home/matt/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/matt/.local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/home/matt/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/home/matt/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/matt/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/home/matt/.local/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/matt/.local/lib/python2.7/site-packages/pip/wheel.py", line 324, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/virtualenv.py'
I was wondering if anybody had some insight as to fixing this? I read that there may be reference in usr/bin to older versions of software, this is possible, but this computer is on the newer side. Is the best bet to go in and clear all references to 'virtualenv' (all that I can find that is
)?
Thank you!
The problem is that you're trying to install a package to a location that typically requires root privileges. You can do as #Vince West suggested and run sudo pip install virtualenv, or you can do pip install --user virtualenv, which will install packages to ~/.local/lib/python<version>/site-packages. If you go that route, you'll likely want to make sure $HOME/.local/bin is included in your $PATH.