Pipenv virtualenv created for a project, at the top of my project are a pipfile and pipfile.lock files.
When executing pipenv commands in sub directory (3 levels below), a new virtual env gets created.
I thought it would not be the case and pipenv would use the one at the top
$ python -V
Python 3.6.1 :: Anaconda 4.4.0 (64-bit)$ pipenv --version
pipenv, version 11.1.6I expect no new environment to be created
Passing the option --verbose to pipenv does not work
Top Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
"pyqt5" = ""
pyedflib = ""
psutil = "*"
[dev-packages]
[requires]
python_version = "3.6"
We only check 2 or 3 levels above. This is configurable by setting the PIPENV_MAX_DEPTH
environment variable.
How can I pass it to pipenv then ?
Ok, I defined the variable ang finally got pipenv finding the venv.
Nevertheless, while in my sub dir, while typing pipenv shell, the shell started correctly but 3 level above, next to the venv, not in the current directory. It is a bit annoying.
I cd back to my script, then tried to run it. The script complained about not being able to import packages as absolute import. It looks like something is not functioning correctly regarding absolute and relative paths in this situation.
set PIPENV_MAX_DEPTH=5
or whatever.
Pipenv will always drop you at your project root when you launch a subshell. As for absolute imports, you鈥檒l want to consult the python docs on why you鈥檙e getting that error
Thanks ! I already figured out the env variable.
Out of curiosity, PIPENV_MAX_DEPTH=2 or 3 by default, why such a low number by default ? what is the reasoning ?
Nevertheless, I would prefer that pipenv, by design, while in a shell and typing pipenv shell leaves you at your current location.
For the wrong absolute imports, this is probably something else.
you're the first person who's raised any concern over the default so far, so i think we've picked a good sane default :)
I'll see about adding an env var to not chdir when invoking shell
That would be good; I've just run into this. It's nice to be able to use pipenv run
without pipenv run sh -c "cd foo && actual-cmd"
Most helpful comment
We only check 2 or 3 levels above. This is configurable by setting the
PIPENV_MAX_DEPTH
environment variable.