Reputation: 13
I created "requirements.txt" through
pip freeze > requirements.txt
at local directory and pushed it to my remote git repository.
And I pulled it to bash console at "pythonanywhere.com" and then moved to directory where "requirements.txt" is installed.
And tried
pip install -r requirements.txt
But there's an error :
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/build/.../.../work'
I'm using python 3.8 and pip is already upgraded to the latest version. I also checked whether I'm on right path through
ls
and it shows "requirements.txt"
What's the problem?
Upvotes: 1
Views: 5304
Reputation: 7384
The most common usecase for requirements files is to just list the packages required to install a package:
numpy
pandas
[...]
But there are some advanced options, e.g. specifying the exact version. You can have an overview at the documentation. For your case relevant is the following paragraph:
Since version 19.1, pip also supports direct references like so:
SomeProject @ file:///somewhere/...
which tells pip to look for that specific file. This is the case in your requirement file:
asgiref @ file:///tmp/build/80754af9/asgiref_1605055780383/work
if the specified file does not exist on the other server, this naturally fails.
I'm not sure how you got there (some uncommon way to install packages? Does conda install packages like that?), but an easy way to fix it is to edit requirements.txt
to just list the packages you want installed, optionally with versions, e.g:
asgiref
certifi==2020.12.5
Django
mkl-fft==1.2.0
mkl-random==1.1.1
mkl-service==2.3.0
numpy
olefile==0.46
Pillow
psycopg2
pytz
six
sqlparse
wincertstore==0.2
Naturally this might install sligthly different versions than originally. If you originally installed the packages via a different package manager (e.g. conda) there might be better commands to archive the python environment.
Upvotes: 2