pip uninstall fails for egg package - python

My app is distributed as an .egg file. Users successfully install egg with easy_install
$ sudo easy_install abcdef-1.0.0-py2.7.egg
Unfortunately uninstallation fails:
$ sudo pip uninstall abcdef
Uninstalling abcdef-1.0.0:
/usr/local/lib/python2.7/dist-packages/abcdef-1.0.0-py2.7.egg
Proceed (y/n)? y
Successfully uninstalled abcdef-1.0.0
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 252, in main
pip_version_check(session)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/outdated.py", line 102, in pip_version_check
installed_version = get_installed_version("pip")
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 838, in get_installed_version
working_set = pkg_resources.WorkingSet()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
self.add_entry(entry)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
if metadata.has_metadata('PKG-INFO'):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
return self.egg_info and self._has(self._fn(self.egg_info, name))
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/abcdef-1.0.0-py2.7.egg'
And console script is still present in /usr/local/bin/
$ abcdef
Traceback (most recent call last):
File "/usr/local/bin/abcdef", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'abcdef==1.0.0' distribution was not found and is required by the application
Here my setup.py
from setuptools import setup
setup(
name='abcdef',
version='1.0.0',
packages=['abcdef'],
entry_points={
'console_scripts': [
'abcdef = abcdef.abcdef:main',
],
},
)
How to fix it? Anything is missing in setup.py?
$pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
$ python --version
Python 2.7.11+

Related

Pip upgrade to version 20 is now requiring 19?

I've upgraded pip with 'pip install -U pip`
When pip is now run it fails with:
$ pip
Traceback (most recent call last):
File "/usr/local/opt/python/libexec/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3251, in <module>
#_call_aside
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==19.3.1' distribution was not found and is required by the application
I'm on python 3.7.5
How can I resolve this? I already went and deleted pip and reinstalled it, but the same error occurs.

pip3 Error "The 'pip==18.0' distribution was not found and is required by the application"

on ubunut 18.04 Im trying to use pip3 to install a package but when I try I get this Error message:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3126, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3110, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 596, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 784, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==18.0' distribution was not found and is required by the application
OS details:
$ uname -srpo
Linux 4.15.0-42-generic x86_64 GNU/Linux
How can I Fix this?

macOS pip uninstalled cannot understand why pip cannot be reinstalled

I uninstalled pip because of SSH issue. Now I want to reinstall pip. Each time I receive this.
What do I do to correct so that pip can be reinstalled?
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 3019, in <module>
#_call_aside
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application
The answer: brew reinstall python

I can't pip install python sabyenc on raspbian linux

I can't pip install sabyenc and I need it for sabNZB to work. I googled a lot with no help at all.
Python version 2.7
pip version 1.5
Reaspbian Jessie
Below are the tracebacks from the log file
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-oG_yk7/sabyenc/setup.py", line 56, in <module>
"""
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 320, in __init__
Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 386, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 859, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (appdirs 1.3.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('appdirs>=1.4.0'))
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-oG_yk7/sabyenc/setup.py", line 56, in <module>
"""
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 320, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 386, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 859, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (appdirs 1.3.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('appdirs>=1.4.0'))
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-oG_yk7/sabyenc
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 716, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-oG_yk7/sabyenc
I had the exact same problem in Ubuntu. python-appdirs needs to be upgraded. If you have Ubunutu:
wget http://mirrors.kernel.org/ubuntu/pool/main/a/appdirs/python-appdirs_1.4.0-2_all.deb
sudo dpkg -i python-appdirs_1.4.0-2_all.deb

Fail to install virtualenvwrapper on MacOX Sierra with (sudo pip install virtualenvwrapper)

How can I resolve the error caused by installing by command: sudo pip install virtualenvwrapper?
Collecting virtualenvwrapper
Downloading virtualenvwrapper-4.7.2.tar.gz (90kB)
100% |████████████████████████████████| 92kB 18kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-Rhop8M/virtualenvwrapper/setup.py", line 7, in <module>
pbr=True,
File "/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/dist.py", line 268, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/dist.py", line 312, in fetch_build_eggs
replace_conflicting=True,
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1091, in best_match
return self.obtain(req, installer)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1103, in obtain
return installer(requirement)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/dist.py", line 379, in fetch_build_egg
return cmd.easy_install(req)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 627, in easy_install
not self.always_copy, self.local_index
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 601, in fetch_distribution
self.find_packages(requirement)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 438, in find_packages
self.scan_url(self.index_url + requirement.unsafe_name+'/')
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 772, in scan_url
self.process_url(url, True)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 305, in process_url
f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 711, in open_url
return open_with_auth(url, self.opener)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 905, in _socket_timeout
return func(*args, **kwargs)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 1003, in open_with_auth
cred = PyPIConfig().find_credential(url)
File "/Users/Extremeways/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/package_index.py", line 959, in __init__
self.read(rc)
File "/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/ConfigParser.py", line 305, in read
self._read(fp, filename)
File "/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/ConfigParser.py", line 512, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /Users/Extremeways/.pypirc, line: 1
'index-servers=\n'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-Rhop8M/virtualenvwrapper/

Categories

Resources