How can I install a conda environment when offline?

后端 未结 10 1646
-上瘾入骨i
-上瘾入骨i 2020-12-07 20:32

I would like to create a conda environment on a machine that has no network connection. What I\'ve done so far is:

On a machine that is connected to the internet:

相关标签:
10条回答
  • 2020-12-07 21:23

    In addition to copying the pkgs folder, you need to index it, so that conda knows how to find the dependencies. See this ticket for more details and this script for an example of indexing the pkgs folder.

    Using --unknown as @asmeurer suggests will only work if the package you're trying to install has no dependencies, otherwise you will get a "Could not find some dependencies" error.

    Cloning is another option, but this will give you all root packages, which may not be what you want.

    0 讨论(0)
  • 2020-12-07 21:26

    The pkgs directory is not a channel. The flag you are looking for is --unknown, which causes conda to include files in the pkgs directory even if they aren't found in one of the channels.

    0 讨论(0)
  • 2020-12-07 21:27

    A lot of the answers here are not 100% related to the "when offline" part. They talk about the rest of OP's question, not reflected in question title.

    If you came here because you need offline env creation on top of an existing Anaconda install you can try:

    conda create --offline --name $NAME
    

    You can find the --offline flag documented here

    0 讨论(0)
  • 2020-12-07 21:27

    Here's what worked for me in Linux -

    (a) Create a blank environment - Just create an empty directory under $CONDA_HOME/envs. Verify with - conda info --envs.

    (b) Activate the new env - source activate

    (c) Download the appropriate package (*.bz2) from https://anaconda.org/anaconda/repo on a machine with internet connection and move it to the isolated host.

    (d) Install using local package - conda install . For example - conda install python-3.6.4-hc3d631a_1.tar.bz2, where python-3.6.4-hc3d631a_1.tar.bz2 exists in the current dir.

    That's it. You can verify by the usual means (python -V, conda list -n ). All related packages can be installed in the same manner.

    0 讨论(0)
提交回复
热议问题