Can't pip uninstall or upgrade wrapt if python-certifi-win32 is installed.
I find that if I try to upgrade wrapt using pip, then the uninstall step fails because wrapt's DLL is in-use by pip. The error message will be something like "PermissionError: [WinError 5] Access is denied: 'C:\path\to\site-packages~rapt_wrappers_cp36_amd64.pyd'"
This is because certifi-win32's sitecustomize hook causes the wrapt DLL to always be loaded, for every Python session, even if I don't use certifi for anything. My verification for this came by deleting wrapt manually and trying to run pip:
c:\>pip --version
Failed to import the site module
Traceback (most recent call last):
File: "C:\python\python36\lib\site.py", line 553, in <module>
main()
File: "C:\python\python36\lib\site.py", line 684, in main
execusercustomize()
File: "C:\python\python36\lib\site-packages\certifi_win32\bootstrap.py", line 46, in _execusercustomize()
_register_bootstrap_functions()
File: "C:\python\python36\lib\site-packages\certifi_win32\bootstrap.py", line 25, in
_register_bootstrap_functions
from . import wrapt_certifi, wrapt_pip
File: "C:\python\python36\lib\site-packages\certifi_win32\wrapt_certifi.py", line 3, in
<module>
import wrapt
ModuleNotFoundError: No module named 'wrapt'
Is it possible to change win32-certifi (or indeed wrapt) so that the DLL usage is delayed somehow? If not, is there some kind of workaround so that pip can proceed?
Many thanks.