Reputation: 97
I am trying to create a virtual environment based on another, for this, I want to extract the information from the libraries for a Django environment with pip freeze> requirements.txt
But the output is
asgiref @ file:///tmp/build/80754af9/asgiref_1605055780383/work
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
cryptography==3.4.7
cycler==0.10.0
Django @ file:///tmp/build/80754af9/django_1613762073373/work
django-clear-cache==0.3
djangorestframework==3.12.4
idna==2.10
kiwisolver==1.3.1
matplotlib==3.4.1
numpy==1.20.2
Pillow==8.2.0
psycopg2 @ file:///C:/ci/psycopg2_1612298766762/work
pycparser==2.20
PyMySQL==1.0.2
pyparsing==2.4.7
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.8.1
python-dateutil==2.8.1
pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work
requests==2.25.1
six==1.15.0
sqlparse @ file:///tmp/build/80754af9/sqlparse_1602184451250/work
urllib3==1.26.4
wincertstore==0.2
When I try pip install -r requirements.txt doesn't work.
Output
Processing c:\tmp\build\80754af9\asgiref_1605055780383\work
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\tmp\\build\\80754af9\\asgiref_1605055780383\\work'
So I need a way to extract info with pip and install it with pip in another environment.
Upvotes: 3
Views: 4455
Reputation: 3728
If you'd like to extract your requirements using pip
, without any additional info (like the ones you posted), use:
pip list --format=freeze > requirements.txt
Upvotes: 12
Reputation: 2465
you can do
conda list --export > requirements.txt
to get all the dependencies.
and when creating a new conda environment with the requirement dependencies use
conda create --name <envname> --file requirements.txt
to know more about the difference btw conda
and pip
refer here
you might also find this table helpful, it compares the different commands of pip
and conda
Upvotes: 2