Can I change the path /Users/nolan/miniconda/envs/ to another one when creating a virtual environment ? I'd like it to be specific to my project directory. (As we can do with virtualenv)
$conda info -e
Using Anaconda Cloud api site https://api.anaconda.org
# conda environments:
#
_build /Users/nolan/miniconda/envs/_build
myen3 /Users/nolan/miniconda/envs/myen3
nolanemirot /Users/nolan/miniconda/envs/nolanemirot
root * /Users/nolan/miniconda
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!
If you activate the environment you're interested in, you can find that answer in the environment variables. You can also run conda info --envs , and that will show the paths to all your environments. That should return the path you're looking for.
If you created the new environment using something like conda create --name dell_proj , it will not inherit packages from the base environment. You would have to install the packages you want using conda install .
conda is both a package and environment manager and is language agnostic. Whereas venv creates isolated environments for Python development only, conda can create isolated environments for any language (in theory).
You can change the environments directory by editing your .condarc file found in your user directory. Add the following specifying the path to the directory you want:
envs_dirs:
- /Users/nolan/newpath
If you would like it to be relative to your project directory, use the --prefix
flag: https://conda.io/docs/commands/env/conda-env-create.html?highlight=prefix
For example, if you use environment.yml
files to define your environment and you want your environment to be created in the venv
directory of your project you would use the following:
conda env create -f environment.yml --prefix venv
The conda create
command also has the --prefix
flag as well: https://conda.io/docs/commands/conda-create.html?highlight=prefix
I don't know if this was available as of the original posting, but it should be available as of Liu Sha's comment, and gets closer to answering the question in regards to "I'd like it to be specific to my project directory".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With