OverflowingTheGlass
OverflowingTheGlass

Reputation: 2434

Create Conda Environment by Connecting to Existing Environment

I have Anaconda installed on a server. I have a conda environment on a NAS. The conda environment is not visible to the Anaconda installation, because it was created with a different installation on a different server.

Is it possible to "create" a conda environment from my Anaconda installation that would actually bypass creation and just point to the existing environment on the NAS? This would be similar to using the --fake method in Django to connect to existing tables when a model is migrated.

Upvotes: 2

Views: 4699

Answers (1)

James
James

Reputation: 36598

You can either add the location of the directory containing the environments to your conda config, which tells conda where to "look" for environments, or you can just activate the environment directly by passing the path.

Assuming your your NAS is mapped to a drive letter (such as Z:) and your conda environment is located at Z:/conda/envs/my_env, then you can add that location to your conda configuration via:

conda config --append envs_dirs Z:/conda/envs

Now when you can activate the environment using:

conda activate my_env

If you have another environment named my_env in a different directory, it will be first in the order.

Alternatively, you can activate the environment directly by passing the path.

conda activate Z:/conda/envs/my_env

Upvotes: 6

Related Questions