-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide better error message if the project’s virtual environment is broken #1918
Comments
The Pipfile:
|
I did a |
Some debugging tips for future reference: The image not found error usually comes from a broken installation, i.e. your virtualenv was not created correctly, or broken by some operation. Re-creating (or re-installing if it’s the global Python that’s broken) is the best solution. |
Thanks! I haven't worked with virtualenvs much – my assumption is that the Homebrew |
@slhck Homebrew tends to do that. My suggestion is to not use Homebrew Pythons to create virtualenvs you intend to keep them long-term. |
Another scenario where this comes up: you created a pipenv with a Python installation you have since removed / upgraded / etc. I ran into this because I had a Python3.6 installation from python.org and then moved over to using Python3.6.5 from Homebrew. After removing the python.org installation from my system entirely, I encountered this error. No big deal if you know why: the virtualenv's python is pointing to a python installation that no longer exists. I presume (have not run into this yet myself) that if this problem happens more with Homebrew than other installations, it's because Python is more frequently upgraded running something like Some of this is conjecture, but it's my best attempt at understanding the problem. Thanks! |
Homebrew is more problematic because this happens for every point release. With python.org installers (and apt, for this matter) this generally happens only every minor release (e.g. 3.5 -> 3.6) because it tries to maintain binary compatibility between point releases, which makes problems happen less frequently and more obvious to debug. Homebrew also does not try to keep multiple versions of a software around (it does not delete it when you upgrade, but will feel free to clean it up when it sees fit), so you need to take extra care to keep (for example) 3.5 environments working after 3.6 is out. With python.org installers (and apt, again) you can easily have 3.5 and 3.6 installations exist side-by-side. Note: It is possible achieve the same side-by-side installation in Homebrew, but the procedure is much more awkward, and does not transition well from the default Python installation if you don’t start with the correct setup. This is a deficiency in Homebrew’s design, they acknowledge this, but it is really difficult to do (I don’t blame them to leave things as-is). |
Got it, thank you for the additional context. What you describe makes sense and I'll definitely keep an eye out. With respect to the issue revolving around the error messaging; would it be appropriate for getting some sort of friendly message saying something along the lines of, "pipenv --rm && pipenv install may resolve the problem" ? |
Yes, I would imagine it is reasonable to hint the user the Python interpreter they are using is broken if |
@uranusjr is this issue still open to working on? Can I take this up? |
@sinscary Please do! In general you are always welcomed to take on anything labelled as “good first issue”. |
@uranusjr can you assign it to me then, I will start working on this. |
@sinscary GitHub does not allow us to assign an arbitrary user (I never understood its logic), but I’ll note this internally. Thanks for the hard work in advance! |
For duck.com or google searchers reference, this happened to my pipenv installs when I Since it's the python from the system that has been tampered with, I endorse the solution of If you just installed the debian package from $ python3 -m pipenv --rm
$ ~/.local/bin/python -m pipenv --rm And so on. |
Was: "Your Pipfile requires python_version 3.6, but you are using None" and various errors
I run pipenv, installed via
brew install pipenv
on macOS 10.12. I've installedpython
from Homebrew (3.6.5), as well aspython@2
.When I open
pipenv shell
, I get this output:When I run
pipenv check
, I get:I cannot install anything either:
Please run
$ python -m pipenv.help
, and paste the results here.When I run
python3 -m pipenv.help
:Expected result
I expected to be dropped into the pipenv shell without errors (or warnings, that is).
Actual result
See the errors mentioned above.
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile):
I installed pipenv via Homebrew, then ran:
A few days later my Python 3 was updated via Homebrew, if I remember correctly. Not sure if that could cause any problems.
The text was updated successfully, but these errors were encountered: