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

Latest Pipenv breaks pip-shims inside managed environment #23

Open
uranusjr opened this issue Nov 4, 2018 · 9 comments
Open

Latest Pipenv breaks pip-shims inside managed environment #23

uranusjr opened this issue Nov 4, 2018 · 9 comments

Comments

@uranusjr
Copy link
Member

uranusjr commented Nov 4, 2018

Because Pipenv sets PIP_SHIMS_BASE_MODULE to pipenv.patched.notpip, and the pip-shims in the virtual environment cannot find module pipenv.

@uranusjr
Copy link
Member Author

uranusjr commented Nov 4, 2018

Environment variable is probably the wrong approach for this config.

@techalchemy
Copy link
Member

Can you explain what you mean? What is happening that is breaking? Did I cut a release with that env var set?

@techalchemy
Copy link
Member

Oh we patch the path to accommodate that pretty much everywhere. Where is it breaking

@uranusjr
Copy link
Member Author

uranusjr commented Nov 4, 2018

Minimal producible example:

# Pipfile
[packages]
pip-shims = '*'
$ pipenv install --python=3.6
$ pipenv run python -c "import pip_shims"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "venv\lib\site-packages\pip_shims\__init__.py", line 8, in <module>
    from . import shims
  File "venv\lib\site-packages\pip_shims\shims.py", line 334, in <module>
    module = sys.modules[__name__] = _shims()
  File "venv\lib\site-packages\pip_shims\shims.py", line 42, in __init__
    "pip": importlib.import_module(self.BASE_IMPORT_PATH),
  File "lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'pipenv'

@techalchemy
Copy link
Member

@techalchemy
Copy link
Member

Can we just unset this in the context of run and shell? Or only set it for the relevant operations I guess?

@uranusjr
Copy link
Member Author

uranusjr commented Nov 5, 2018

Yeah that would be a reasonable stop gap. I feel pip-shims need to be more robust, however.

@techalchemy
Copy link
Member

What do you think is a better approach? I don’t have strong feelings

@uranusjr
Copy link
Member Author

uranusjr commented Nov 5, 2018

I would expose a top-level function set_pip_module that takes a string (or an imported module) to set the global variable.

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

No branches or pull requests

2 participants