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

No prefix found at: /opt/conda/envs/... #136

Closed
andreas-wilm opened this issue Feb 23, 2022 · 4 comments
Closed

No prefix found at: /opt/conda/envs/... #136

andreas-wilm opened this issue Feb 23, 2022 · 4 comments

Comments

@andreas-wilm
Copy link

Hi there,

Thanks for creating Micromamba and Micromamba Docker!

I followed the instructions to create a Dockerfile and no matter which version I use (0.21.2, 0.21.1, 0.19.0) I get:

error    No prefix found at: /opt/conda/envs/<my-env-name>
critical Aborting.

when running micromamba install -y -f /tmp/env.yml. I also get this when I try to create an environment interactively.

Likewise, if I run a plain micromamba list interactively, I get:

error    Expected environment not found at prefix: /opt/conda
critical Aborting.

I guess I must be doing something fundamentally wrong. Could someone please point the mistake out?

Many thanks,
Andreas

@wholtz
Copy link
Member

wholtz commented Feb 23, 2022

Hi @andreas-wilm - thank you for your interest in micromamba.

I can reproduce that micromamba list is throwing an error when nothing has been installed in the base environment:

$ docker run -it --rm -v $(pwd):/tmp mambaorg/micromamba:0.21.2 micromamba list
info     ****************** Backtrace Start ******************
debug    Loading configuration
trace    Compute configurable 'create_base'
trace    Compute configurable 'no_env'
trace    Compute configurable 'no_rc'
trace    Compute configurable 'rc_files'
trace    Compute configurable 'root_prefix'
trace    Get RC files configuration from locations up to HomeDir
trace    Configuration not found at '/home/mambauser/.mambarc'
trace    Configuration not found at '/home/mambauser/.condarc'
trace    Configuration not found at '/home/mambauser/.conda/condarc.d'
trace    Configuration not found at '/home/mambauser/.conda/condarc'
trace    Configuration not found at '/home/mambauser/.conda/.condarc'
trace    Configuration not found at '/opt/conda/.mambarc'
trace    Configuration not found at '/opt/conda/condarc.d'
trace    Configuration not found at '/opt/conda/condarc'
trace    Configuration not found at '/opt/conda/.condarc'
trace    Configuration not found at '/var/lib/conda/.mambarc'
trace    Configuration not found at '/var/lib/conda/condarc.d/'
trace    Configuration not found at '/var/lib/conda/condarc'
trace    Configuration not found at '/var/lib/conda/.condarc'
trace    Configuration not found at '/etc/conda/.mambarc'
trace    Configuration not found at '/etc/conda/condarc.d/'
trace    Configuration not found at '/etc/conda/condarc'
trace    Configuration not found at '/etc/conda/.condarc'
trace    Update configurable 'no_env'
trace    Compute configurable 'file_specs'
trace    Compute configurable 'spec_file_env_name'
trace    Compute configurable 'env_name'
trace    Compute configurable 'envs_dirs'
trace    Compute configurable 'use_target_prefix_fallback'
trace    Compute configurable 'target_prefix'
trace    Get RC files configuration from locations up to TargetPrefix
trace    Configuration not found at '/opt/conda/.mambarc'
trace    Configuration not found at '/opt/conda/condarc.d'
trace    Configuration not found at '/opt/conda/condarc'
trace    Configuration not found at '/opt/conda/.condarc'
trace    Configuration not found at '/home/mambauser/.mambarc'
trace    Configuration not found at '/home/mambauser/.condarc'
trace    Configuration not found at '/home/mambauser/.conda/condarc.d'
trace    Configuration not found at '/home/mambauser/.conda/condarc'
trace    Configuration not found at '/home/mambauser/.conda/.condarc'
trace    Configuration not found at '/opt/conda/.mambarc'
trace    Configuration not found at '/opt/conda/condarc.d'
trace    Configuration not found at '/opt/conda/condarc'
trace    Configuration not found at '/opt/conda/.condarc'
trace    Configuration not found at '/var/lib/conda/.mambarc'
trace    Configuration not found at '/var/lib/conda/condarc.d/'
trace    Configuration not found at '/var/lib/conda/condarc'
trace    Configuration not found at '/var/lib/conda/.condarc'
trace    Configuration not found at '/etc/conda/.mambarc'
trace    Configuration not found at '/etc/conda/condarc.d/'
trace    Configuration not found at '/etc/conda/condarc'
trace    Configuration not found at '/etc/conda/.condarc'
trace    Update configurable 'no_env'
trace    Compute configurable 'target_prefix_checks'
error    Expected environment not found at prefix: /opt/conda
critical Aborting.
info     ****************** Backtrace End ********************
$ 

But I'm not able to reproduce an error with micromamba install -y -f /tmp/env.yml

Does the following work for you?

$ cat > env.yml << EOF
name: base
channels:
  - conda-forge
dependencies:
  - jq=1.6
EOF
$ docker run -it --rm -v $(pwd):/tmp mambaorg/micromamba:0.21.2 micromamba install -y -f /tmp/env.yml

If you can post a minimal example with your failing Dockerfile, that would be helpful.

Are you running on x86 hardware? The arm64 and ppc64le images have seen little use and are not as well tested.

@andreas-wilm
Copy link
Author

Wow. This is the fastest Github response I've ever seen. Thanks so much.

I'm on an Intel Mac. But turns out the architecture is not the problem, because your simple env.yml file worked flawlessly. I just tried a bit more and it turns out the a hyphen in the environment name caused this. I'm not sure why that is or why the cryptic error message, but without the hyphen everything works as expected.

Apologies. And thank you so much for getting me on the right track

@wholtz
Copy link
Member

wholtz commented Feb 23, 2022

I'm guessing you had something like this:

$ cat > env.yml << EOF
name: MyEnv
channels:
  - conda-forge
dependencies:
  - jq=1.6
EOF
$ docker run -it --rm -v $(pwd):/tmp mambaorg/micromamba:0.21.2 micromamba install -y -f /tmp/env.yml

This does not work because the env.yml is supplying an environment name that doesn't exist and the install sub-command will not create an environment. Switching the name to base would make it work, as that environment does not need to be explicitly created. Alternatively, you could use the create sub-command:

$ cat > env.yml << EOF
name: MyEnv
channels:
  - conda-forge
dependencies:
  - jq=1.6
EOF
$ docker run -it --rm -v $(pwd):/tmp mambaorg/micromamba:0.21.2 micromamba create -y -f /tmp/env.yml

This form creates the new environment before installing the packages. Hyphens should work in environment names.

@andreas-wilm
Copy link
Author

andreas-wilm commented Feb 24, 2022

Oh my God. You are right. The hyphen was a red herring, because I tried name: base and name: base-test and the latter wasn't working, but you made it obvious that it doesn't work because the environment doesn't exist. It should have been obvious that I have to use create instead of install. This was stupid. Sorry!

srstsavage added a commit to srstsavage/micromamba-docker that referenced this issue May 17, 2022
A few users have been tripped up when trying to install dependencies from environment files with specific environment names, which haven't been created.

mamba-org#136
mamba-org#151

This tripped me up for a minute as well. My workflow is pretty much always to have an environment.yml file with a non-base `name` for local usage, but to install that environment as the `base` environment when creating a portable Docker image using micromamba. I suspect there are others out there doing the same.

Adding `-n base` to the quick start install instructions both clarifies that we're installing to the base environment, and also allows installing into the base environment from environment files with embedded names by overriding the name.
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

2 participants