Skip to content

Bad import in vistir.tempfile #2955

Closed
Closed
@adamgreg

Description

@adamgreg

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

I can patch it by changing the import in pipenv/vendor/vistir/backports/tempfile.py 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/init.py 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\vistir_init_.py", line 4, in
from .compat import NamedTemporaryFile, TemporaryDirectory, partialmethod
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\compat.py", line 34, in
from .backports.tempfile import NamedTemporaryFile
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\backports_init_.py", line 5, in
from .tempfile import NamedTemporaryFile
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\backports\tempfile.py", 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions