question-mark
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.

Pipenv does not find pipfile in upper directory

See original GitHub issue

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

Describe your environment
  1. OS Type: Windows 10
  2. Python version: $ python -V Python 3.6.1 :: Anaconda 4.4.0 (64-bit)
  3. Pipenv version: $ pipenv --version pipenv, version 11.1.6
Expected result

I expect no new environment to be created

Actual result

Passing the option --verbose to pipenv does not work

Steps to replicate
  • created a virtualenv with pipenv, and a pipfile
  • create some subdirs
  • in the subdir, execute pipenv --shell It creates a new env instead of using the one at the top. Please note that sometimes it works, sometimes not.

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”

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
kennethreitzcommented, Mar 9, 2018

We only check 2 or 3 levels above. This is configurable by setting the PIPENV_MAX_DEPTH environment variable.

0reactions
keysmusiciancommented, Jan 6, 2022

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 😃

Perhaps my experience is another outlier, but I thought creating a subshell was default behavior for about 6 months now because using the project root environment almost never worked for me (though I do seem to recall from documentation that it was supposed to). I find the default max depth surprising and incredibly annoying, but didn’t realize I could do anything about it.

For the record, the reason my projects were so nested is because I created an environment for a series of school projects in which the file structure was dictated by the school. Our projects’ “working directories” typically start at the third level down from the project root.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - pipfile not found from deeper subdirectories
Consider running `pipenv install` first to automatically generate a Pipfile for you. $ cd d $ pipenv --where No Pipfile present at project...
Read more >
Detect Pipfile file if it is located in the sub-folder of the project ...
Pipfile is not detected and pipenv environment is not created if it is located in the sub-folder of the project root. There is...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
☤ My pyenv-installed Python is not found​​ Make sure you have PYENV_ROOT set correctly. Pipenv only supports CPython distributions, with version name like...
Read more >
pipenv Documentation
On Windows you can find the user base binary directory by running python ... Once again, you should not run pipenv as root...
Read more >
Common Pipenv Errors and How to Solve Them
Locking Issue: Pipfile Contains a Reference to an Inexistent Package ... Pipfile won't lock when it tries to install packages that don't exist,...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found