Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot execute pipenv shell properly

See original GitHub issue

See 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') 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
➜  test-pipenv which 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/

Is the anything I can do to get around this error? Please tell me if (and which) information you need.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

nhanbcommented, Apr 22, 2017

FWIW I worked around this by only sourcing 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:

if [ "$PIPENV_ACTIVE" != '1' ]; then
    [ -f /usr/local/bin/ ] && source /usr/local/bin/
nateprewittcommented, Feb 19, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found