Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do newly created conda envs inherit all packages from the base env?

I installed Anaconda and created a new env ("dell_proj"). Then I created a new Project in Pycharm with my new environment. My expectation was that I would only be able to use packages in this project that I installed through Conda in that specific env, however, I am able to use all packages that were installed in the Base environment.

Packages shown available in Conda for env

Packages shown available in Pycharm for env

Could somebody explain what I'm misunderstanding here?

like image 475
Jeff Bagley Avatar asked Sep 20 '18 21:09

Jeff Bagley


People also ask

Do conda environments share packages?

By default, conda creates a new environment folder and installs all the packages inside . conda folder in your home directory but this space is limited and cannot be shared with other users.

What happens when you activate a conda environment?

With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can also share an environment file.

Should I create a new conda environment for every project?

You do NOT need to create an environment for every project. However if particular projects require particular versions of libraries, a particular version of Python etc then you can create a virtual environment to capture all of those dependencies.

How do you create a new environment in anaconda with all packages?

If you'd like to create an environment with a different version of Python, then just add that to the command line; e.g. As I understand the command is 'conda create --name <envname> [list of packages]'.


2 Answers

You can create a clone of the base environment using conda create --name dell_proj --clone base. This will create a new environment that is a copy of your base environment.

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.

like image 132
haxtar Avatar answered Oct 13 '22 21:10

haxtar


In windows you create an environment without specifying the python version, then it will create the new environment with all packages in base. I don't know if it is a bug or a feature but this works in windows.

conda create -n new_env

creates an environment with base packages

conda create -n new_env python=3.7 

creates new environment only with some necessary packages given below

ca-certificates    
certifi            
openssl            
pip                
python             
setuptools         
sqlite             
vc                 
vs2015_runtime     
wheel              
wincertstore       
like image 39
codeslord Avatar answered Oct 13 '22 21:10

codeslord