Cannot execute pipenv shell properly
See original GitHub issueSee the following output:
➜ test-pipenv pipenv --three
Creating a Pipfile for this project...
Creating a virtualenv for this project...
⠋Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/florian/.virtualenvs/test-pipenv/bin/python3
Also creating executable in /home/florian/.virtualenvs/test-pipenv/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /home/florian/.virtualenvs/test-pipenv
➜ test-pipenv pipenv install Django
Installing Django...
Collecting Django
Using cached Django-1.10.5-py2.py3-none-any.whl
Installing collected packages: Django
Successfully installed Django-1.10.5
Adding Django to Pipfile's [packages]...
➜ test-pipenv pipenv shell
Launching subshell in virtual environment. Type 'exit' or 'Ctrl+D' to return.
/home/florian/.virtualenvs/test-pipenv/bin/python: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ImportError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/home/florian/.virtualenvs/test-pipenv/bin/python and that PATH is
set properly.
➜ test-pipenv env|grep VIRTUAL
VIRTUALENVWRAPPER_SCRIPT=/home/florian/.local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
VIRTUALENVWRAPPER_WORKON_CD=1
VIRTUALENVWRAPPER_HOOK_DIR=/home/florian/.virtualenvs
VIRTUAL_ENV=/home/florian/.virtualenvs/test-pipenv
➜ test-pipenv which python
/home/florian/.virtualenvs/test-pipenv/bin/python
As you can see VIRTUAL_ENV is set properly and which python
returns the one from the venv, but it looks like as if the executed shell is sourcing my profile again.
I am using virtualenv-wrapper manually without problems. My .zshrc has
source ~/.local/bin/virtualenvwrapper.sh
Is the anything I can do to get around this error? Please tell me if (and which) information you need.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Cannot run pipenv after successfully installing it - Stack Overflow
I am running Python 3.8 on Visual Studio Code. I installed pipenv successfully: python -m pip install pipenv. Then I try to actually...
Read more >Frequently Encountered Pipenv Problems - Read the Docs
Here are some common questions people have using Pipenv. Please take a look below and see if they resolve your problem. Note. Make...
Read more >Configure a Pipenv environment | PyCharm Documentation
Run the following command to find the user base's binary directory: $ python -m site --user-base · Add bin to this path to...
Read more >Advanced Usage of Pipenv - Python Packaging Authority
You can then run pipenv run <shortcut name> in your terminal to run the command in the context of your pipenv virtual environment...
Read more >pipenv Documentation - manpages.ubuntu!
These are intended to replace $ pip install usage, as well as manual virtualenv management (to activate a virtualenv, run $ pipenv shell)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW I worked around this by only sourcing
virtualenvwrapper.sh
if pipenv is not currently active, because if I’m using pipenv I’m probably not going to need virtualenvwrapper anyway. My.zshrc
now goes like this:Yeah, so given this startup script in your profile, you’ll either need to install virtualenvwrapper inside your pipenv environment before running the shell or modify the script. I think that’s the only advice we can give at this point since I wouldn’t consider this a bug in pipenv.