Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare stops on first env that already exists #189

Closed
AlbertDeFusco opened this issue Mar 25, 2019 · 3 comments
Closed

Prepare stops on first env that already exists #189

AlbertDeFusco opened this issue Mar 25, 2019 · 3 comments

Comments

@AlbertDeFusco
Copy link
Collaborator

AlbertDeFusco commented Mar 25, 2019

The scenario is that I have prepared an anaconda-project directory. I then want to add another env by manually editing the anaconda-project.yml file. The behavior is different depending on where the second env is added.

Preparation

Here is the base anaconda-project.yml file.

name: multiple envs

packages: []
channels: []

env_specs:
  first_env:
    packages:
      - python=3.6
      - requests

Create the envs directory by running anaconda-project prepare. Here's the bottom of the output

#
# To activate this environment, use
#
#     $ conda activate /Users/adefusco/Desktop/my_project/envs/first_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

The project is ready to run commands.
Use `anaconda-project list-commands` to see what's available.

Second env last will never get created

If the new environment is written AFTER the first, it will not get created. anaconda-project prepare ignores the second env.

name: multiple envs

packages: []
channels: []

env_specs:
  first_env:
    packages:
      - python=3.6
      - requests
  second_env:
    packages:
      - python=3.7
      - requests

The output of anaconda-project prepare indicates that no actions were taken

(base) adefusco@0235-adefusco:my_project>anaconda-project prepare
The project is ready to run commands.
Use `anaconda-project list-commands` to see what's available.

Second env first will get created

If the second environment is listed BEFORE the one that was already created it will be prepared.

name: multiple envs

packages: []
channels: []

env_specs:
  second_env:
    packages:
      - python=3.7
      - requests
  first_env:
    packages:
      - python=3.6
      - requests

Here is the output of anaconda-project prepare

#
# To activate this environment, use
#
#     $ conda activate /Users/adefusco/Desktop/my_project/envs/second_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

The project is ready to run commands.
Use `anaconda-project list-commands` to see what's available.
@znd4
Copy link

znd4 commented Apr 10, 2019

This isn't a great answer, but if you want to prepare second_env, you can use anaconda-project prepare --env-spec second_env

I do think that the behavior of only creating the first one is a bit confusing. Would the anaconda-project maintainers be up for a PR to change this behavior? (Or to implement a --all/--allenvs option).

@cjmartian
Copy link

Implementing this in #213

@cjmartian cjmartian mentioned this issue Jul 9, 2019
@AlbertDeFusco
Copy link
Collaborator Author

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants