pipenv installs in parent directory, instead of current

Created on 2 Sep 2019  Â·  3Comments  Â·  Source: pypa/pipenv

Issue description

electrum on î‚  master
➜ pwd
/Users/will/Documents/src/electrum

➜ echo $PIPENV_VENV_IN_PROJECT
true

electrum on î‚  master
➜ pipenv --python=/Users/will/.pyenv/versions/3.6.9/bin/python3
Creating a virtualenv for this project…
Pipfile: /Users/will/Documents/src/Pipfile
Using /Users/will/.pyenv/versions/3.6.9/bin/python3 (3.6.9) to create virtualenv…
â ¼ Creating virtual environment...Already using interpreter /Users/will/.pyenv/versions/3.6.9/bin/python3
Using base prefix '/Users/will/.pyenv/versions/3.6.9'
New python executable in /Users/will/Documents/src/.venv/bin/python3
Also creating executable in /Users/will/Documents/src/.venv/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /Users/will/.pyenv/versions/3.6.9/bin/python3

✔ Successfully created virtual environment!
Virtualenv location: /Users/will/Documents/src/.venv

electrum on î‚  master took 6s 447ms

Expected result

pipenv to respect the $PIPENV_VENV_IN_PROJECT var


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

pipenv --support is throwing different errors...

triage

Most helpful comment

I have to ask, what is the logic behind this and why isn't this super clearly explained in the readme? I've spent countless hours trying to figure out why my envs don't get built correctly...

All 3 comments

Oh god. After about an hour of reinstalling pipenv, pyenv and various pythons I've rubber ducked myself!

Solution: if there is no Pipfile in the current directory, pipenv (I guess) will increase directory level until it finds one? This meant an errant (and blank) Pipfile found in my root src directory was causing the .venv to be created at that level, instead of inside my project.

Not sure if should be bug fix, or simply issue closed?

Correct, the Pipenv uses Pipfile to decide the venv location, if none is found, will look up to parent folders.

I have to ask, what is the logic behind this and why isn't this super clearly explained in the readme? I've spent countless hours trying to figure out why my envs don't get built correctly...

Was this page helpful?
0 / 5 - 0 ratings