Using virtualenv
, I'm developing a Dash/Python app. After adding a new package, I ran
pip freeze > requirements.txt
and then tried to push the new changes to the linked Heroku server using git. Before this comment, the previous version on the server was running without an error.
While Heroku used pip
to install the required packages listed in requirements.txt
in the process of deployment, there was a failure.
-----> Installing requirements with pip
...
Processing /opt/concourse/worker/volumes/live/976f8942-f51d-4f0e-7352-2a10f0820d0e/volume/cffi_1625814703974/work
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/opt/concourse/worker/volumes/live/976f8942-f51d-4f0e-7352-2a10f0820d0e/volume/cffi_1625814703974/work'
In requirements.txt
, the corresponding package appears as:
cffi @ file:///opt/concourse/worker/volumes/live/976f8942-f51d-4f0e-7352-2a10f0820d0e/volume/cffi_1625814703974/work
I googled but could not find any information about the use of @ in requirements.txt
. This is the first one that has @ link in the list and pip failed there, so this is suspicious.
Does anyone know what this @ means (I guess it means a link to a remote file), and how I can fix the push failure?
Thanks!
CodePudding user response:
I still can't tell what @ marks are, but for my second or more practical question of how to fix the issue, I found out what went wrong. And I can guess something about @ marks.
In short, without realising, it seemed that I once ran pip freeze > requirements.txt
outside of my virtual environment. So there were way more packages than necessary in requirements.txt
and that's essentially why pip
on Heroku failed.
I suspect that the @ marks were given to packages that were installed outside of pip
. Why instead of something like,
cffi # installed outside of pip!
, pip
gives weird URLs, where are they from, or are they actually functional? I don't know.
In some cases, replacing the bit with @ file://xxxxx
with version numbers like ==4.5.5
that are determined by pip show <packagename>
helped. But interestingly, pip
on Heroku could not install conda
. This is when I wondered why on earth my project needed conda
.
CodePudding user response:
try to run this
pip install - r requirements.txt