GrahamDumpleton / wrapt

A Python module for decorators, wrappers and monkey patching.
BSD 2-Clause "Simplified" License
2.04k stars 230 forks source link

wrapt 1.14.1 causing my pip to crash #211

Closed madssander closed 1 year ago

madssander commented 2 years ago

I was just going through outdated site-packages, when I saw that wrapt had a never version, I then updated it, and boom errors and nothing worked anymore. I have no idea why this happened, but here is the output I got:

`$ pip list --outdated Traceback (most recent call last): File "C:\Programs\Python\Python3102\lib\importlib_common.py", line 89, in _tempfile os.write(fd, reader()) File "C:\Programs\Python\Python3102\lib\importlib\abc.py", line 371, in read_bytes with self.open('rb') as strm: File "C:\Programs\Python\Python3102\lib\importlib_adapters.py", line 54, in open raise ValueError() ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Programs\Python\Python3102\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Programs\Python\Python3102\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Programs\Python\Python3102\Scripts\pip.exe__main.py", line 4, in File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\cli\main.py", line 9, in from pip._internal.cli.autocompletion import autocomplete File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\cli\autocompletion.py", line 10, in from pip._internal.cli.main_parser import create_main_parser File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\cli\main_parser.py", line 8, in from pip._internal.cli import cmdoptions File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\cli\cmdoptions.py", line 23, in from pip._internal.cli.parser import ConfigOptionParser File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\cli\parser.py", line 12, in from pip._internal.configuration import Configuration, ConfigurationError File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\configuration.py", line 20, in from pip._internal.exceptions import ( File "C:\Programs\Python\Python3102\lib\site-packages\pip_internal\exceptions.py", line 13, in from pip._vendor.requests.models import Request, Response File "C:\Programs\Python\Python3102\lib\site-packages\pip_vendor\requests__init__.py", line 135, in from . import utils File "C:\Programs\Python\Python3102\lib\site-packages\pip_vendor\requests\utils.py", line 27, in from . import certs File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 177, in _exec_module notify_module_loaded(module) File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized return wrapped(*args, *kwargs) File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded hook(module) File "C:\Programs\Python\Python3102\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches import certifi File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 177, in _exec_module notify_module_loaded(module) File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized return wrapped(args, **kwargs) File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded hook(module) File "C:\Programs\Python\Python3102\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches certifi_win32.wincerts.CERTIFI_PEM = certifi.where() File "C:\Programs\Python\Python3102\lib\site-packages\certifi\core.py", line 37, in where _CACERT_PATH = str(_CACERT_CTX.enter()) File "C:\Programs\Python\Python3102\lib\contextlib.py", line 135, in enter__ return next(self.gen) File "C:\Programs\Python\Python3102\lib\importlib_common.py", line 95, in _tempfile os.remove(raw_path) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\77870\AppData\Local\Temp\2\tmpmmm0hkub' `

madssander commented 2 years ago

Please let me know if this output makes any sense, and you see what error might have happened

GrahamDumpleton commented 2 years ago

As the error message says, some process was running which had the file open which it was trying to remove. Windows doesn't allow you to remove a file that is in use, where as UNIX/Linux systems do.

So this is a Windows issue more than anything else. You would need to work out what application is using the file, stop it, and then reinstall. In other words, it shouldn't be anything to do with wrapt.

felixp98 commented 2 years ago

Same exception on my (Windows) system, but only with version >= 1.14.0.
With wrapt version 1.13.3 this exception does not happen.
I'm using Python 3.10.2.

GrahamDumpleton commented 1 year ago

Closing this at this point on the basis that it was some issue with the environment or other applications holding open then files.