11
votes

I have Anaconda installed on a RedHat-6.5 environment that is not connected to the Internet.

Is it possible to create a conda environment based on the existing Anaconda install, or minimal python packages?

FYI: I was able to clone a conda environment that already exists:

conda create -n dummy --clone my_env --offline
2
The --offline flag should work to install any package that is already cached in the pkgs directory (i.e., already installed by conda at some point). - asmeurer

2 Answers

5
votes

You could try cloning root which is the base env.

conda create -n yourenvname --clone root

With the env created you can install packages like these

conda install packagename --offline

2
votes

Here is a basic bash script I've used to clone without conda attempting to download or compare anything:

orig_env=/path/to/envs/orig
clone_env=/other/path/to/envs/clone

mkdir -p $clone_env
cp -r $orig_env/ $clone_env/

cd $clone_env
grep -rI "$orig_env"
# cd to the folders with references to the old folder name
sed -i -e "s:$orig_env:$clone_env:g" *

source activate $clone_env
conda info

The sed command finds the shebang at the top of files that reference specific locations for copies of python and fixes them.

Hope that helps.