Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create conda environment offline

Tags:

conda

anaconda

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
like image 856
user3047458 Avatar asked May 26 '15 10:05

user3047458


People also ask

Does Anaconda work without Internet?

as long as some version of python is already installed on the machine. using conda directly. All scripts should work fine.


2 Answers

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.

like image 90
phyatt Avatar answered Sep 20 '22 14:09

phyatt


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

like image 24
Arthur Alvim Avatar answered Sep 17 '22 14:09

Arthur Alvim