0

So I have two VM machines running windows 10, and one one of them I get a funky error after installing one of our site-packages.

Some info: Python version Python 3.10.2 with latests pip is installed, and I also have git 2.16.2. The repository/python lib requires python 3.10+.

I run this command on my machine:

pip install --upgrade git+ssh://git@bitbucket.ccd2.com:7999/pyt/jira

it installed at normal, but when I then run pip list I get the following error:

$ pip list
Traceback (most recent call last):
  File "C:\Programs\Python\Python3102\lib\importlib\_common.py", line 89, in _te                                                                                                                                             mpfile
    os.write(fd, reader())
  File "C:\Programs\Python\Python3102\lib\importlib\abc.py", line 371, in read_b                                                                                                                                             ytes
    with self.open('rb') as strm:
  File "C:\Programs\Python\Python3102\lib\importlib\_adapters.py", line 54, in o                                                                                                                                             pen
    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 <                                                                                                                                             module>
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\main.p                                                                                                                                             y", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\autoco                                                                                                                                             mpletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\main_p                                                                                                                                             arser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\cmdopt                                                                                                                                             ions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\parser                                                                                                                                             .py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\configurat                                                                                                                                             ion.py", line 20, in <module>
    from pip._internal.exceptions import (
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\exceptions                                                                                                                                             .py", line 13, in <module>
    from pip._vendor.requests.models import Request, Response
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_vendor\requests\__i                                                                                                                                             nit__.py", line 135, in <module>
    from . import utils
  File "C:\Programs\Python\Python3102\lib\site-packages\pip\_vendor\requests\uti                                                                                                                                             ls.py", line 27, in <module>
    from . import certs
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", 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", li                                                                                                                                             ne 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 "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", 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", li                                                                                                                                             ne 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_cert                                                                                                                                             ifi.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 3                                                                                                                                             7, 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 _te                                                                                                                                             mpfile
    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\\tmplh                                                                                                                                             cnerdl'

I have no idea why it works on all other machines VM or my own PC, but this one VM machine has this problem.

I have reinstalled everything and tried different versions of python and git, but the same error occurs.

I think it looks like something is stuck maybe in the temp folder? or maybe I have an issue with something else that I don't know?

3 Answers3

0

Because its in the Temp folder, maybe its just a leftover from a program. Try deleting it, but I would make a backup for in case things go wrong. However, because this is kinda risky, I would wait in case a better answer appears (I have too little rep to comment).

montw
  • 85
  • 10
0

I corrected it by removing two *.pth files that were created when I had installed python-certifi-win32. This prevents python-certifi-win32 from loading when python is run.

The files are listed below, and were located here:

%LOCALAPPDATA%\Programs\Python\Python310\Lib\site-packages

Files:

python-certifi-win32-init.pth
distutils-precedence.pth
  • `python-certifi-win32` has been [replaced](https://gitlab.com/alelec/python-certifi-win32/-/issues/16) by [`pip-system-certs`](https://pypi.org/project/pip-system-certs/). – sourcream Aug 02 '22 at 12:56
0

Had a machine where everything was running so made a pip freeze > req.txt file to check every version one by one, and then I just tried to update all the pip list --outdated packages, and when wrapt was updated the problem occurred. Downgraded the version to wrapt==1.13.3 which one of the other machines was running and now everything works.