简体   繁体   中英

How can I install conda packages on Linux if they were originally installed on Windows?

I have conda installed locally on my Windows PC and also installed remotely on a Linux server. I already have conda packages installed locally on my Windows PC, and I want to install the same packages on the Linux server. I have already tried the following steps:

  1. Create a requirements.txt file containing the currently installed packages and their versions using the Anaconda Prompt on my Windows PC using the command conda list -e > requirements.txt .
  2. Transfer this requirements.txt file to my Linux server.
  3. Install these packages in my conda base environment using the command conda install --yes --file requirements.txt .

However, I get the following error message on my Linux server when I try to complete step 3:

Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - ca-certificates==2020.12.8=haa95532_0
  - m2w64-gcc-libs-core==5.3.0=7
  - audioread==2.1.8=pypi_0
  - pywin32-ctypes==0.2.0=py38_1000
  - notebook==6.1.5=py38haa95532_0
  - librosa==0.8.0=pypi_0
  - numpy-base==1.19.2=py38ha3acd2a_0
  - psutil==5.7.2=py38he774522_0
  - numpy==1.19.2=py38hadc3359_0
  - regex==2020.11.13=py38h2bbff1b_0
  - spyder-kernels==1.10.0=py38haa95532_0
  - appdirs==1.4.4=pypi_0
  - ujson==4.0.1=py38ha925a31_0
  - setuptools==51.0.0=py38haa95532_2
  - sklearn-crfsuite==0.3.6=pypi_0
  - pywinpty==0.5.7=py38_0
  - m2w64-gmp==6.1.0=2
  - pyyaml==5.3.1=py38he774522_1
  - bzip2==1.0.8=he774522_0
  - sounddevice==0.4.1=pypi_0
  - certifi==2020.12.5=py38haa95532_0
  - gpytorch==1.3.0=pypi_0
  - winpty==0.4.3=4
  - pyzmq==20.0.0=py38hd77b12b_1
  - pytorch==1.7.1=py3.8_cpu_0
  - lazy-object-proxy==1.4.3=py38h2bbff1b_2
  - zeromq==4.3.3=ha925a31_3
  - ipython==7.19.0=py38hd4e2768_0
  - mkl_fft==1.2.0=py38h45dec08_0
  - conda-package-handling==1.7.2=py38h76e460a_0
  - vc==14.2=h21ff451_1
  - cpuonly==1.0=0
  - pip==20.3.1=py38haa95532_0
  - tornado==6.1=py38h2bbff1b_0
  - libarchive==3.4.2=h5e25573_0
  - msys2-conda-epoch==20160418=1
  - pandocfilters==1.4.3=py38haa95532_1
  - scikit-learn==0.23.2=pypi_0
  - torchaudio==0.7.2=py38
  - soundfile==0.10.3.post1=pypi_0
  - gsl==2.4=hfa6e2cd_4
  - kiwisolver==1.3.0=py38hd77b12b_0
  - argon2-cffi==20.1.0=py38he774522_1
  - dataclasses==0.6=pypi_0
  - libtiff==4.1.0=h56a325e_1
  - torchvision==0.8.2=py38_cpu
  - m2w64-libwinpthread-git==5.0.0.4634.697f757=2
  - numba==0.51.2=pypi_0
  - pooch==1.2.0=pypi_0
  - cvxopt==1.2.0=py38hdc3235a_0
  - tabulate==0.8.7=pypi_0
  - pillow==8.0.1=py38h4fa10fc_0
  - libpng==1.6.37=h2a8f88b_0
  - libiconv==1.15=h1df5818_7
  - rtree==0.9.4=py38h21ff451_1
  - qt==5.9.7=vc14h73c81de_0
  - ruamel_yaml==0.15.87=py38he774522_1
  - libsodium==1.0.18=h62dcd97_0
  - yaml==0.2.5=he774522_0
  - m2w64-gcc-libs==5.3.0=7
  - libspatialindex==1.9.3=h33f27b4_0
  - jedi==0.17.2=py38haa95532_1
  - tk==8.6.10=he774522_0
  - six==1.15.0=py38haa95532_0
  - python-crfsuite==0.9.7=pypi_0
  - spyder==4.2.0=py38haa95532_0
  - cffi==1.14.4=py38hcd4344a_0
  - xz==5.2.5=h62dcd97_0
  - console_shortcut==0.1.1=4
  - sqlite==3.33.0=h2a8f88b_0
  - pycosat==0.6.3=py38h2bbff1b_0
  - pyrsistent==0.17.3=py38he774522_0
  - markupsafe==1.1.1=py38he774522_0
  - bcrypt==3.2.0=py38he774522_0
  - libuv==1.40.0=he774522_0
  - brotlipy==0.7.0=py38h2bbff1b_1003
  - mistune==0.8.4=py38he774522_1000
  - wrapt==1.11.2=py38he774522_0
  - powershell_shortcut==0.0.1=3
  - mkl-service==2.3.0=py38h196d8e1_0
  - pysocks==1.7.1=py38haa95532_0
  - typeguard==2.10.0=pypi_0
  - jpeg==9b=hb83a4c4_2
  - libxml2==2.9.10=hb89e7f3_3
  - freetype==2.10.4=hd328e21_0
  - python==3.8.5=h5fd99cc_1
  - liblief==0.10.1=ha925a31_0
  - sip==4.19.13=py38ha925a31_0
  - scipy==1.5.4=pypi_0
  - pywin32==227=py38he774522_1
  - nltk==3.5=pypi_0
  - py-lief==0.10.1=py38ha925a31_0
  - threadpoolctl==2.1.0=pypi_0
  - zlib==1.2.11=h62dcd97_4
  - cudatoolkit==10.2.89=h74a9793_1
  - zstd==1.4.5=h04227a9_0
  - mkl_random==1.1.1=py38h47e9c7a_0
  - glpk==4.65=hdc00fd2_2
  - ninja==1.10.2=py38h6d14046_0
  - joblib==0.17.0=pypi_0
  - typed-ast==1.4.1=py38he774522_0
  - pandas==1.1.3=py38ha925a31_0
  - llvmlite==0.34.0=pypi_0
  - resampy==0.2.2=pypi_0
  - pynacl==1.4.0=py38h62dcd97_1
  - vs2015_runtime==14.27.29016=h5e58377_2
  - icu==58.2=ha925a31_3
  - matplotlib-base==3.3.2=py38hba9282a_0
  - menuinst==1.4.16=py38he774522_1
  - pyqt==5.9.2=py38ha925a31_4
  - cryptography==3.3.1=py38hcd4344a_0
  - jupyter_core==4.7.0=py38haa95532_0
  - ax-platform==0.1.19=pypi_0
  - botorch==0.3.3=pypi_0
  - win_inet_pton==1.1.0=py38haa95532_0
  - pkginfo==1.6.1=py38haa95532_0
  - openssl==1.1.1i=h2bbff1b_0
  - wincertstore==0.2=py38_0
  - matplotlib==3.3.2=pypi_0
  - lz4-c==1.9.2=hf4a77e7_3
  - pandoc==2.11=h9490d1a_0
  - conda==4.9.2=py38haa95532_0
  - ad3==2.3.dev0=pypi_0
  - retrying==1.3.3=pypi_0
  - plotly==4.14.1=pypi_0
  - m2w64-gcc-libgfortran==5.3.0=6
  - watchdog==0.10.4=py38haa95532_0
  - chardet==3.0.4=py38haa95532_1003

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/linux-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/pro/linux-64
  - https://repo.anaconda.com/pkgs/pro/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

I am aware that the problem is that I am not looking in the correct conda channels, as the error message suggests, but I am not sure how to solve this problem.

Thanks for the help.

The official documentation has some additional steps to have environment working cross-platform. Here is the link to that.

However, if you are not using packages that are only available in anaconda channels , you can do the following.

  1. Have pip on both your conda environment (windows and linux server)

  2. Make requirements.txt file using pip freeze instead of conda's one. From the windows machine

    $ pip freeze > requirements.txt

  3. Install the packages in linux server normally with pip.

    $ pip install -r requirements.txt

I am not saying that it is the best option. But this way usually is easier can support other environment management packages like pyenv.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM