How to install conda packages with "conda list" output txt

Viewed 2362

I am given a package_conda.txt file with form as follows.

# packages in environment at /scratch/xxxx/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py37_0  
absl-py                   0.7.1                    pypi_0    pypi
alabaster                 0.7.12                   py37_0  
...
...

This file is generated by command conda list > package_conda.txt

I tried installing the listed packages by conda install --file package_conda.txt but was given the error message as :

CondaValueError: could not parse '_ipyw_jlab_nb_ext_conf    0.1.0                    py37_0' in: package_conda.txt
1 Answers

If you want to use with conda you need to:

conda list -e > package_conda.txt
conda create --name <env> --file package_conda.txt

But this cannot be used with pip, For pip:

pip freeze > package_conda.txt
pip install -r package_conda.txt
Related