anaconda / anaconda-project

Tool for encapsulating, running, and reproducing data science projects
https://anaconda-project.readthedocs.io/en/latest/
Other
216 stars 88 forks source link

[BUG] env_specs not respected. #393

Open mforbes opened 1 year ago

mforbes commented 1 year ago
$ anaconda-project --version
0.11.1
$ conda --version
conda 23.1.0

Description of expected behavior and the observed behavior

The version dependencies specified in env_specs are not respected.

Relevant configuration files

# anaconda-project.yaml
name: issue
dependencies:
- numba
platforms:
- osx-arm64
env_specs:
  py3.10:
    packages:
    - python~=3.10.9
    channels: []
  py3.11:
    packages:
    - python~=3.11.0

When I try to prepare this environment, I get python 3.10, not python 3.11 as requested:

$ anaconda-project prepare --env-spec py3.11
...
  python             pkgs/main/osx-arm64::python-3.10.10-hc0d8a6c_2 
...

The issue is that numba currently does not support 3.11, so anaconda-project is doing a quasi-sensible thing and resolving this so I get a working environment, but it violates my dependency specification.

I expect behaviour similar to what happens when the dependencies are included in the same spec:

# anaconda-project.yaml
name: issue
dependencies:
- numba
- python~=3.11.0
platforms:
- osx-arm64
$ anaconda-project prepare
...
Package python conflicts for:
python~=3.11.0
numba -> python[version='>=3.10,<3.11.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0']
...

Although inconvenient, this respects my request for python 3.11.

P.S. Why is the command-line option spelled --env-spec instead of --env_spec? Is this intentional? I expected it to match the section in the .yaml file.