Cannot uninstall pycrypto: cannot find pycrypto-2.6-py2.7-win32.egg - python

I was installing pycrypto, and was careless and installed the win32 version instead. Unfortunately, when I go to uninstall it, it cannot find the file specified (full error below). Thanks for any help.
Uninstalling pycrypto-2.6:
c:\python27\lib\site-packages\pycrypto-2.6-py2.7-win32.egg
Proceed (y/n)? y
Successfully uninstalled pycrypto-2.6
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\pip\__init__.py", line 233, in main
return command.main(cmd_args)
File "c:\python27\lib\site-packages\pip\basecommand.py", line 252, in main
pip_version_check(session)
File "c:\python27\lib\site-packages\pip\utils\outdated.py", line 102, in
pip_version_check
installed_version = get_installed_version("pip")
File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 838, in
get_installed_version
working_set = pkg_resources.WorkingSet()
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py",
line 644, in __init__
self.add_entry(entry)
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py",
line 700, in add_entry
for dist in find_distributions(entry, True):
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py",
line 1949, in find_eggs_in_zip
if metadata.has_metadata('PKG-INFO'):
File "c:\python27\lib\site-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 "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py",
line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py",
line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py",
line 1643, in load
mtime = os.stat(path).st_mtime
WindowsError: [Error 2] The system cannot find the file specified:
'c:\\python27\\lib\\site-packages\\pycrypto-2.6-py2.7-win32.egg'

The key parts of the output are:
Uninstalling pycrypto-2.6:
c:\python27\lib\site-packages\pycrypto-2.6-py2.7-win32.egg
Proceed (y/n)? y
Usually, there's a long list of files here. In your case, it's only an .egg. Which means that you installed the package as a packed .egg (thus most probably, you installed it with easy_install rather than pip: pip always unpacks .eggs).
Now,
WindowsError: [Error 2] The system cannot find the file specified:
'c:\\python27\\lib\\site-packages\\pycrypto-2.6-py2.7-win32.egg'
Means that the .egg was already deleted (probably you deleted it by hand, or a previous uninstallation process was interrupted), but installation metadata wasn't. IIRC it's kept in a file or directory named something like pycrypto-2.6-py2.7-win32.egg-info.
So, locate it in site-packages and delete it.

Related

Unable to pip install PyTorch due to [Errno 28] No space left on device

Trying to install PyTorch using this command:
py -m pip install --cache-dir=D:/CodePackages/temp --target=D:\CodePackages torch==1.13.1 -f https://download.pytorch.org/whl/torch_stable.html
And it is giving me these errors:
ERROR: Exception:
Traceback (most recent call last):
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line 437, in _error_catcher
yield
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line 560, in read
data = self._fp_read(amt) if not fp_closed else b""
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line 526, in _fp_read
return self._fp.read(amt) if amt is not None else self._fp.read()
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 94, in read
self.__buf.write(data)
File "C:\Users\GorillaPenguin\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 483, in func_wrapper
return func(*args, **kwargs)
OSError: [Errno 28] No space left on device
Traceback (most recent call last):
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 247, in wrapper
return func(self, options, args)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\commands\install.py", line 400, in run
requirement_set = resolver.resolve(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 348, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
return any(self)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
candidate = func()
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 297, in __init__
super().__init__(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 162, in __init__
self.dist = self._prepare()
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 231, in _prepare
dist = self._prepare_distribution()
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 308, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 491, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 536, in _prepare_linked_requirement
local_file = unpack_url(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 166, in unpack_url
file = get_http_url(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 107, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\network\download.py", line 147, in __call__
for chunk in chunks:
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\cli\progress_bars.py", line 53, in _rich_progress_bar
for chunk in iterable:
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_internal\network\utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line 621, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line 559, in read
with self._error_catcher():
File "C:\Users\GorillaPenguin\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "D:\Unity\ReinforcementLeaning_InfoProject\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line 454, in _error_catcher
raise ProtocolError("Connection broken: %r" % e, e)
pip._vendor.urllib3.exceptions.ProtocolError: ("Connection broken: OSError(28, 'No space left on device')", OSError(28, 'No space left on device'))
`
I'm using Python 3.10.8, latest version of pip, Windows 10.
The directory has more than enough space and I've tried changing the cache directory with --cache-dir without success. Any help is appreciated :) thanks
The error message you are seeing is likely due to one of the following reasons:
The specified path D:/CodePackages/temp or D:\CodePackages does not exist or is not accessible. You should make sure that the path exists and you have the necessary permissions to write to it.
The pip version that you are using is outdated. You should try running py -m pip install --upgrade pip to update pip to the latest version.
There may be an issue with the URL you are using in the -f flag. Try using the URL https://download.pytorch.org/whl/cu111/torch-1.13.1%2Bcu111-cp37-cp37m-win_amd64.whl .
If you have other version of python or pytorch installed it might cause conflict, you should try to uninstall previous versions of PyTorch, python and install the correct version.
Sometimes firewall or antivirus software can block the installation process, you should try to add exception in your firewall or antivirus software.
You might also want to try installing PyTorch without the --target and --cache-dir flags, to see if that resolves the issue.
py -m pip install torch==1.13.1 -f https://download.pytorch.org/whl/cu111/torch-1.13.1%2Bcu111-cp37-cp37m-win_amd64.whl

Cannot install python package in Git Bash

I'm trying to install a package from my company's internal artifactory storage. I'm getting 2 exceptions in Gitbash that I can't understand. When I run Pip Freeze I don't see the install package, so I don't believe it is already installed.
After reading the exceptions, I don't understand what's going on, is anyone familiar with this?
pip install --no-dependencies --user -i https://artifactory.cloud.company.com/artifactory/api/pypi/pypi-python-org/simple git+https://github.kdc.company.com/MandR/package.git
Looking in indexes: https://artifactory.cloud.company.com/artifactory/api/pypi/pypi-python-org/simple
Collecting git+https://github.kdc.company.com/MandR/package.git
Cloning https://github.kdc.company.com/MandR/package.git to c:\users\user_name\appdata\local\temp\pip-req-build-ptb41on4
Exception:
Traceback (most recent call last):
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 339, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 476, in get_distribution
dist = get_provider(dist)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 352, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 895, in require
needed = self.resolve(parse_requirements(requirements))
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 786, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.ContextualVersionConflict: (tables 3.4.3 (c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages), Requirement.parse('tables==3.2.0'), {'package'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
resolver.resolve(requirement_set)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 221, in _get_abstract_dist_for
req.check_if_exists(self.use_user_site)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 350, in check_if_exists
self.req.name
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 476, in get_distribution
dist = get_provider(dist)
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 352, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 895, in require
needed = self.resolve(parse_requirements(requirements))
File "c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 786, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.ContextualVersionConflict: (tables 3.4.3 (c:\users\user_name\appdata\local\continuum\anaconda3\lib\site-packages), Requirement.parse('tables==3.2.0'), {'package'})
It looks like you have the wrong version of the tables package installed. Trying installing the required version with pip install tables==3.2.0.

Python package installation error for openCV

C:\Users\Om>pip install opencv_python-3.2.0-cp36-cp36m-win32.whl
Requirement 'opencv_python-3.2.0-cp36-cp36m-win32.whl' looks like a filename, but the file does not exist
Processing c:\users\om\opencv_python-3.2.0-cp36-cp36m-win32.whl
Exception:
Traceback (most recent call last):
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py", line 809, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py", line 715, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils__init__.py", line 482, in unzip_file
zipfp = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Om\opencv_python-3.2.0-cp36-cp36m-win32.whl'
what is the problem ?
It looks like you have not given a valid file location.
The error is saying that it thinks you have given it a whl file to install but it can't find it.
I suggest you check you file path again.
Make sure it is located at C:\Users\Om and it is called exactly the same as the filename you have put down. It should match opencv_python-3.2.0-cp36-cp36m-win32.whl exactly.
Ensure you do not rename the whl file.
Correct that and it will attempt an install and if that does not work you will get another error.

OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg'

I am trying to install and uninstall a package.I have written a setup.py script.While installing the script works fine and the package installs.But while uninstalling package uninstalls but throw some errors.I am using pip uninstall package_name for uninstalling.Here is the traceback
Uninstalling pyduino-0.0.0:
/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg
Proceed (y/n)? y
Successfully uninstalled pyduino-0.0.0
The directory '/home/billy/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
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 221, 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 848, in get_installed_version
working_set = pkg_resources.WorkingSet()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 619, in __init__
self.add_entry(entry)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 675, 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 1942, 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 1824, 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 1704, 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 1644, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg'
Meanwhile package uninstalls.When i tried the command pip freeze package does not show up.So,why does the above errors show up?Thanks in advance for helping...
I found the solution.I didn't upgrade pip after installing.Later,I upgraded and works perfectly..

Creating a new virtualenv gives a permissions error

I'm getting the following output when running virtualenv newvenv.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 700, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2227, in activate
self.insert_on(path)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2334, in insert_on
self.check_version_conflict()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2373, in check_version_conflict
for modname in self._get_metadata('top_level.txt'):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2221, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1209, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1201, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1316, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/stevedore-1.5.0.egg-info/top_level.txt'
I haven't made virtualenvs in a while, but the last time I did, there was no permissions issue. virtualenv is up-to-date. While I could go messing around with permissions in the specified file in the trace, I'd rather not. Has anyone else run into similar issues with virtualenv, and if so, how did you solve them?
EDIT
The error comes up when trying to make the virtualenv in ~/venvs (Ubuntu 12.04), the same place as before the problem starting occurring, so there's no mounting problem.

Categories

Resources