1

I am using conda with python and installed a lot of dependencies in an environment. I need to migrate the environment to another PC that has a very slow internet. So rather downloading packages is there any way to take the dump from working machine and put to the new machine. The operating system I use is ubuntu 18.04

Thanks, Gokul

Gokul C
  • 151
  • 14

2 Answers2

1

I'll admit, this isn't a perfect solution, but you may try the following.

First, you'll want to get the environment file for your particular environment.

conda activate your_env
conda env export > environment.yml

Normally, you would just use this as follows on the new computer:

conda env create -f environment.yml

But, you want to do this without internet... your best option is likely to containerize your build with Docker/Singularity.

Here's an example Singularity recipe (in file named 'Singularity' in same directory as 'environment.yml'):

Bootstrap: docker

From: continuumio/miniconda3

%files
    environment.yml

%environment
    PATH=/opt/conda/envs/$(head -1 environment.yml | cut -d' ' -f2)/bin:$PATH

%post
    echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
    echo "source activate $(head -1 environment.yml | cut -d' ' -f2)" > ~/.bashrc
    /opt/conda/bin/conda env create -f environment.yml

%runscript
    exec "$@"

Build this with:

sudo singularity build conda.simg Singularity

Now, you'll have a functioning container that can be run anywhere!

As long as you have Singularity installed on your machine (a potential issue if you don't have any internet access), you can run this container.

singularity run conda.simg conda -h

Or whatever you want to run (though Jupyter notebooks aren't working for me):

singularity run conda.simg ipython
LucasBoatwright
  • 1,456
  • 1
  • 16
  • 20
  • Thanks for your efforts. I was using docker and VMs extensively till now.. But now started with tensorflow and deep learning.. For which I need native OS to fully utilize GPU. – Gokul C Feb 14 '19 at 03:25
0

you can setup a network for pip cache across two systems and can just install from the network of pip cache without any need for internet connectivity and you can find the steps for it in following link https://stackoverflow.com/a/11034515/7896543