Skip to content

Instantly share code, notes, and snippets.

@andmax
Created June 26, 2020 17:47
Show Gist options
  • Save andmax/0d077e95396bf91c3c9965a4c38a6e4f to your computer and use it in GitHub Desktop.
Save andmax/0d077e95396bf91c3c9965a4c38a6e4f to your computer and use it in GitHub Desktop.
Copying one package from one conda environment to another
1- The problem is to copy one specific package (e.g. mypackage) in (Ana)conda
2- Environment (e.g. base env) to another conda env (e.g. myenv), it may be
3- Built or directly installed (via pip or not) and exist three files called:
4- mypackage.cp37-win_amd64.pyd, mypackage.py, mypackage-1.0-py3.7.egg-info
5- In the site-packages of the base conda env (here Anaconda 3) in:
6- ~/Anaconda3/Lib/site-packages/
7- And we can just copy these files from there to the target conda env as:
cp ~/Anaconda3/Lib/site-packages/mypackage* ~/Anaconda3/envs/myenv/Lib/site-packages/
8- This copying does not guarantee that all packages dependencies (requirements) of
9- The mypackage being copied is satisfied in the target environment,
10- As it was probably satisfied in the original environment (in this example base env)
11- After copying you can just install the package dependencies (if you know them),
12- For instance, if mypackage depends on boost you could just run:
conda activate myenv
conda install -c conda-forge boost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment