Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to specify new environment location for conda create

the default location for packages is .conda folder in my home directory. however, on the server I am using, there is a very strict limit of how much space I can use, which basically avoids me from putting anything under my home directory. how can I specify the location for the virtual environment that I want to create? Thanks! server is running Ubuntu.

like image 732
linX Avatar asked Jun 20 '16 16:06

linX


People also ask

How do you create a conda environment in a specific location?

In summary, if you edit . condarc to include D:\envs , and then run conda env create -p D:\envs\myenv python=x.x , then activate myenv (or source activate myenv on Linux) should work. Hope that helps!

Can I choose where my conda environment is stored?

You may change the default location by using the following command but it is not encouraged. Conda can no longer find your environment by your environment name, you will have to specify the environment's full path to activate it every time.


2 Answers

Use the --prefix or -p option to specify where to write the environment files. For example:

conda create --prefix /tmp/test-env python=2.7

Will create the environment named /tmp/test-env which resides in /tmp/ instead of the default .conda.

like image 181
Paul Avatar answered Sep 25 '22 04:09

Paul


like Paul said, use

conda create --prefix=/users/.../yourEnvName python=x.x

if you are located in the folder in which you want to create your virtual environment, just omit the path and use

conda create --prefix=yourEnvName python=x.x

conda only keep track of the environments included in the folder envs inside the anaconda folder. The next time you will need to activate your new env, move to the folder where you created it and activate it with

source activate yourEnvName
like image 76
Darth_Tato Avatar answered Sep 21 '22 04:09

Darth_Tato