Closed rggjan closed 2 years ago
As far as I am aware this is in part a problem with zimport version you are using not having been updated to new API. Can you use Python 3.10 instead, which finally updates zipimport? Still, I will see if I can find a way to deal somehow with other packages which haven't been updated to the new API. See also issue:
FWIW, was only when you create this new issue that I realised that zipimport being talked about was the one in Python itself. I thought other reporter was talking about some third party package and that there was some newer version of it available that they started using. Didn't click that they updated Python version.
Unfortunately, I'm stuck with the old python version due to other dependencies.
Don't suppose you have a small program that replicates the issue?
Unfortunately I don't... also it happens when running a pip install
There is something dodgy going on if running pip install
on the command line triggers it. That would imply something is force loading wrapt import hooks into arbitrary Python packages when run. Are you also using autowrapt
by chance.
Yes, this was run on commandline. Specifically, there was a conda
base install, followed by a pip install ...
which worked fine, followed by a second pip install ...
which crashed.
No, I think autowrapt
isn't used anywhere...
Ah, I think I know what the issue could be. It seems like wrapt.when_imported
is used on pip._vendor.requests
to change some behaviour...
I still don't know how to replicate this, but can you try testing using:
pip install --no-cache-dir https://github.com/GrahamDumpleton/wrapt/archive/refs/heads/develop.zip
Thanks @GrahamDumpleton
It's a bit hard to say as the issues comes from a conda
installed package on my end, but I did some tests and it seems to work fine. Thanks!
I've run into this same issue in a package based on wrapt being used in an autowrap line way which targets pip / requests to make them use your system installed SSL certs rather than the ones bundled in requests; pip-system-certs
I don't have the wrapt version pinned on my dependencies (my bad) so you can get a reproduction of this issue by simply pip install pip-system-certs
then trying to pip install <anything>
I see you've implemented a fix for this, I'll try to test it tomorrow thanks!
@andrewleech Did it work? I am still hoping someone can confirm the fix works before releasing the change.
Thanks for the reminder! I've just done a fresh test
python3 -m venv .
./bin/pip3 install pip-system-certs
./bin/pip3 uninstall pip-system-certs
Failed with
File "/root/test2/lib/python3.8/site-packages/wrapt/importer.py", line 166, in create_module return self.loader.create_module(spec) AttributeError: 'zipimporter' object has no attribute 'create_module'
(Only on older python versions)
rm -rf *
python3 -m venv .
./bin/pip3 install git+https://github.com/GrahamDumpleton/wrapt.git
./bin/pip3 install pip-system-certs
./bin/pip3 uninstall pip-system-certs
Works perfectly
You would have to have done:
pip install -U https://github.com/GrahamDumpleton/wrapt/archive/refs/heads/develop.zip
immediately after creating the virtual environment and before installing pip-system-certs
.
Did you do that?
Oh, wait I misunderstood the ordering of your statements. :-(
Sorry yes that was a rather terse description on my part - I first reproduced the issue by letting my package auto install the current release of wrapt.
I then reset the env, installed current master wrapt then installed my package, which then continued to work currently.
It definitely looks like your updates on master fixes the reproduction case I have of this issue.
Fix released in 1.14.1.
After updating to
wrapt 1.14.0
, I started seeing issues withpip
installs onpython3.7
:I assume it could be due to: https://github.com/GrahamDumpleton/wrapt/commit/53323ba4b92f88dab5a8ec3262a1c1f1e979a3e2
which introduced this code:
However, the zipimporter module's
create_module
function was only added in python 3.10: https://docs.python.org/3/library/zipimport.html#zipimport.zipimporter.create_moduleReverting
wrapt
to 1.13.3 resolved thepip
issues again.