0

Following these suggestions and these instructions I want to create a conda environment bar from within a Python script. My problem is that I run the script while activated another env foo. As in the examples from the docs - the commands work, however my new env is created under the current one, like here:

base                     MYHOME/miniconda3
foo                   *  MYHOME/miniconda3/envs/foo
                         MYHOME/miniconda3/envs/foo/envs/bar                         

Is there any way to make it top level and thus its name recognised by conda?

My command in the script (as in the docs) is:
run_command(Commands.CREATE, "-n", "bar", "python=3", "flask")

maciek
  • 1,807
  • 2
  • 18
  • 30
  • Please write this up as reproducible steps rather than descriptive prose. Create a `foo` (presumbaly with python), activate it, include a simple script, the command to run it, and`conda env list` before and after. – merv Nov 03 '22 at 20:44
  • I have asked another question which seems linked to this one, possibly solving that one first would lead us to a solution here. Mind taking a look? https://stackoverflow.com/questions/74321787/conda-info-points-to-a-different-base-path-while-called-from-within-python – maciek Nov 04 '22 at 18:57

1 Answers1

1

This is not really a matter of conda.cli. As discussed in another question: the issue was that foo env contained conda itself inside it and while building the environment from within the script the interpreter called that "internal" conda, thus thinking that foo is base.

maciek
  • 1,807
  • 2
  • 18
  • 30