Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad import in vistir.tempfile #2955

adamgreg opened this issue Oct 9, 2018 · 2 comments

Bad import in vistir.tempfile #2955

adamgreg opened this issue Oct 9, 2018 · 2 comments


Copy link

adamgreg commented Oct 9, 2018

I'm running into an issue with version 2018.10.9 of Pipenv. The import of backports.weakref in pipenv/vendor/vistir/backports/ is failing. This causes an exception upon running/importing pipenv.

I can patch it by changing the import in pipenv/vendor/vistir/backports/ to import from pipenv.vendor.backports.weakref. I can only reproduce the issue on my continuous integration setup though, not on my own machine. I can see that pipenv/ adds the vendor subpackage to sys.path, but this must not be doing the right thing for some reason on my CI virtual machine.

Expected result

No exception when pipenv.vendor.vistir is imported.

Actual result

Partial backtrace:

File "c:\python27\lib\site-packages\pipenv\vendor\", line 4, in
from .compat import NamedTemporaryFile, TemporaryDirectory, partialmethod
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\", line 34, in
from .backports.tempfile import NamedTemporaryFile
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\", line 5, in
from .tempfile import NamedTemporaryFile
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\backports\", line 16, in
from backports.weakref import finalize
ImportError: No module named weakref

Steps to replicate

I'm investigating this further, because I can not replicate it easily yet. I'll update the bug when I know more. Sorry for raising the bug already, I hadn't checked properly that I could replicate the problem easily.

Copy link

adamgreg commented Oct 9, 2018

I'm now convinced that the issue is down to something broken in my environment, not a Pipenv bug. Apologies for misfiling, and many thanks for an excellent piece of software!

techalchemy added a commit that referenced this issue Oct 9, 2018
- Add tempfile patch and news
- Fixes #2950
- Fixes #2955
- Fixes #2961
- Closes #2967

Signed-off-by: Dan Ryan <>
Copy link

@techalchemy Thank you for the fix, and so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants