Pycharm warns package requirement not satisfied when using pipenv to install package
Question:
I am trying to install packages into my Pycharm environment using pipenv. However, when I use pipenv install <package name>
, a popup appears on the top mentioning
“Package requirement not satisfied”
and asks me to “install requirements from Pipfile.lock”
When I started the project, I selected Pipenv as my project interpreter.Why is PyCharm asking to re-install a package from the Pipfile.lock file when I clearly used pipenv from the beginning and set the project to use Pipenv as an interpreter. Am I double installing ?
Update:
It is now reported as a bug in PyCharm, please vote for the issue:
Answers:
The solution is in this answer on the JetBrains support forums.
The steps are as follows:
- Go to File > Invalidate Caches/Restart… and press Invalidate and Restart.
- Once restarted, add the interpreter back, wait for the stubs to be rebuilt and then check to if the problem has been resolved.
- If not, then first remove the pipenv interpreter as the project interpreter by going to File > Settings > Project: > Project Interpreter and setting the project interpreter to No Interpreter. Click Apply and OK. Then repeat steps 1 and 2 and see if it solves the problem.
I’m not sure why this problem occurs, but it seems to solve it when it comes up.
EDIT 07/29/19:
I’m still running into this issue on 2020.3. I think it’s because when setting up the interpreter the python interpreter is in a virtualenv and the pipenv install is in $PYENV_ROOT/versions. To workaround this, I just set the interpreter as a virtualenv environment and manage pipenv through the CLI.
I had an old requirements.txt
laying around after switching to setup.py
and pip install -e .
.
Removed the requirements.txt
and the warnings disappeared.
I am trying to install packages into my Pycharm environment using pipenv. However, when I use pipenv install <package name>
, a popup appears on the top mentioning
“Package requirement not satisfied”
and asks me to “install requirements from Pipfile.lock”
When I started the project, I selected Pipenv as my project interpreter.Why is PyCharm asking to re-install a package from the Pipfile.lock file when I clearly used pipenv from the beginning and set the project to use Pipenv as an interpreter. Am I double installing ?
Update:
It is now reported as a bug in PyCharm, please vote for the issue:
The solution is in this answer on the JetBrains support forums.
The steps are as follows:
- Go to File > Invalidate Caches/Restart… and press Invalidate and Restart.
- Once restarted, add the interpreter back, wait for the stubs to be rebuilt and then check to if the problem has been resolved.
- If not, then first remove the pipenv interpreter as the project interpreter by going to File > Settings > Project: > Project Interpreter and setting the project interpreter to No Interpreter. Click Apply and OK. Then repeat steps 1 and 2 and see if it solves the problem.
I’m not sure why this problem occurs, but it seems to solve it when it comes up.
EDIT 07/29/19:
I’m still running into this issue on 2020.3. I think it’s because when setting up the interpreter the python interpreter is in a virtualenv and the pipenv install is in $PYENV_ROOT/versions. To workaround this, I just set the interpreter as a virtualenv environment and manage pipenv through the CLI.
I had an old requirements.txt
laying around after switching to setup.py
and pip install -e .
.
Removed the requirements.txt
and the warnings disappeared.