2

I am new to Python/Linux. I was trying to set up a new virtual environment using conda. First I tried creating the virtual environment using

conda create -n atomate_env

I realized that this creates the virtual environment in the anaconda directory by default (/home/g2g/anaconda2/atomate_env). However, I wanted create the virtual environment elsewhere. I just deleted the directory of the previous virtual environment, instead of using (I think this where I screwed up)

conda env remove -yn atomate_env

Now I am trying the following

conda create -p /home/g2g/Atomate/atomate_env

to mention the path for creating the virtual environment. It shows me this

Fetching package metadata .........
Solving package specifications: 
Package plan for installation in environment /home/sax041/Atomate/atomate_env:

Proceed ([y]/n)? y

#
# To activate this environment, use:
# > source activate /home/sax041/Atomate/atomate_env
#
# To deactivate this environment, use:
# > source deactivate /home/sax041/Atomate/atomate_env
#

Clearly, it does not list the packages it is going to set up in the new virtual environment. It does create the directory home/sax041/Atomate/atomate_env. This directory is incomplete, with no sub-directory for libraries. It just looks like this

bin  conda-meta

Doing

conda info -e

does not suggest that a new virtual was created

# conda environments:
#
root                  *  /home/g2g/anaconda2

How do I create a complete virtual environment using conda now?

Anando
  • 23
  • 3

1 Answers1

5

You are already using the correct commands, except you are not specifying to conda that it should install anything into the new environment. You need to specify, for example

conda create -p /home/g2g/Atomate/atomate_env python=3.6

to install Python. Then, as the instructions state, you have to type

source activate /home/g2g/Atomate/atomate_env

to activate the environment. However, I don't think that conda info will list environments for which you specify the prefix; although I can't find any official source that says that it won't list them, I can't find anything that says it will list them either.

darthbith
  • 18,484
  • 9
  • 60
  • 76
  • Thanks a lot for your reply. It works. And yes conda info still does not list the new virtual environment. So just to be clear (as the question could have mislead people). The problem had nothing to do with removal of the previous virtual environment. – Anando Sep 18 '17 at 15:36
  • I had a small follow-up question though. I see that the virtual environment created by conda create -n are much larger in terms of libraries than conda create -p. Is it simply because we have explicitly specified the version in case of the latter? What is the difference? – Anando Sep 18 '17 at 19:01
  • @Anando You should ask a new question and include all of the commands you're using, along with the relevant directory sizes. You can link to this one to provide context if you want. – darthbith Sep 18 '17 at 19:14