Python2 - Unable to run pyinstaller - python

I installed pyinstaller using pip
pip install pyinstaller
but when I run it I get an error
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 7, in <module>
from PyInstaller.__main__ import run
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__init__.py", line 66, in <module>
__version__ = pkg_resources.get_distribution('PyInstaller').version
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 330, in get_distribution
if isinstance(dist,Requirement): dist = get_provider(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 209, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: PyInstaller
I cannot figure out what the issue is, I have tried reinstalling it. I have googled the error but no results come up that help.
Does anyone know a fix?

Related

pip remains on the old version after updating

I keep trying to update pip with:
pip install --upgrade pip
It seems to complete fine but when I run pip --version its still running the old version (19.0.3 vs 19.3). I'm using pycharm on Windows 10.
I'm trying to install pandas and I've read the issue I'm getting can be solved by updating pip and setuptools.
I saw some suggestions to delete the pip folder. So I went to Python38/Lib/site-packages and found 3 pip folders. pip, pip-19.0.3-py3.8egg. There was a 19.3 folder I deleted already.
If I delete the 19.0.3 folder I get an error running pip commands saying:
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 583, in _build_master
ws.require(__requires__)
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 19.3 (c:\users\jxdwa\appdata\roaming\python\python38\site-packages), Requirement.parse('pip==
19.0.3'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python38\Scripts\pip-script.py", line 6, in <module>
from pkg_resources import load_entry_point
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 3251, in <module>
def _initialize_master_working_set():
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 3234, in _call_aside
f(*args, **kwargs)
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 3263, in _initialize_master
_working_set
working_set = WorkingSet._build_master()
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 598, in _build_from_require
ments
dists = ws.resolve(reqs, Environment())
File "C:\Users\Jxdwa\AppData\Roaming\Python\Python38\site-packages\pkg_resources\__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==19.0.3' distribution was not found and is required by the application

pip3 not installing packages

I enter the following line into terminal:
pip3 install numpy
this gives me:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/basecommand.py", line 251, in main
timeout=min(5, options.timeout)) as session:
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distro.py", line 1050, in <module>
_distro = LinuxDistribution()
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1
Im thinking its a path issue but im not really sure.
This is a bug with the distro package vendored by pip. The bug has been solved but the latest version of pip uses and very old version of distro which doesn't have this bug fix applied.
For now, you can simply try to make the executable available in the path.

pip version conflict and unable to install packages in python2.7.6 & 3.4.3

When I was trying to install any packages using pip and pip3 I got below error:
Also tried to remove and reinstall pip, but got same error.any idea how to solve this.
Thanks in advance.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 444, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 632, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (pip 9.0.1 (/usr/local/lib/python3.4/dist-packages), Requirement.parse('pip==1.5.4'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2749, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 446, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 459, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.5.4

Run scrapy under windows 7

I want to create a new scrappy project under win 7. I have installed scrapy over pip and everthing went find.
I am using pip 1.0.1 from c:\python27\lib\site-packages (python 2.7).
I have added the C:\Python27\Scripts as my path variable.
However, when running scrapy in my cmd, I get:
C:\Users\User\EclipseWorkspace>scrapy
Traceback (most recent call last):
File "C:\Python27\Scripts\scrapy-script.py", line 5, in <module>
from pkg_resources import load_entry_point
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2709, in <module>
working_set.require(__requires__)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 686, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Python27\lib\site-packages\pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six>=1.5.2
Any recommendation what I am doing wrong?
I appreciate your replies!
Update
When installing pip again I get:
C:\Users\User\EclipseWorkspace>pip --version
pip 6.0.6 from C:\Python27\lib\site-packages\pip-6.0.6-py2.7.egg (python 2.7)
However, when running scrapy:
C:\Users\User\EclipseWorkspace>scrapy
Traceback (most recent call last):
File "C:\Python27\Scripts\scrapy-script.py", line 5, in <module>
from pkg_resources import load_entry_point
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2709, in <module>
working_set.require(__requires__)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 686, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Python27\lib\site-packages\pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six>=1.5.2

Django - ResolutionError and DistributionError

I had to uninstall my django==1.6.4 and install 1.5 for a project, but now when I install 1.6.4 with pip and try to start a project with django-admin.py startproject PN I get
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/django-admin.py", line 5, in <module>
pkg_resources.run_script('Django==1.6.4', 'django-admin.py')
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 1432, in run_script
raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'django-admin.py'
martinssmacbook:bin martinspasov$ pip install django==1.6.4
I tried installing 1.6.5 but then when I try to start a project i get
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/django-admin.py", line 4, in <module>
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 2876, in <module>
working_set = WorkingSet._build_master()
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(__requires__)
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Django==1.6.4
Any ideas onwhat to do ?
this is because you should delete all 1.6.4 files and then install 1.6.5.
but now there are also 1.6.4 files in your Linux / windows.
in windows,
you should delete the files in python/lib/site-packages/django
to uninstall the main Django files.
nd then delete Django-VERSION-py2.7.egg or fix the VERSION in
it. not just these.
you have to delete following 4 files:
django-admin.exe, django-admin.py,django-admin.exe.manifest,django-admin-script.py
then you can reinstall the django.
(In fact, if you know the file, you can try to edit it with change the version.)
in Linux, you can do like that.
if there 's something wrong, you can try to delete all.

Categories