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

conda-lock install ignores envs_dirs #777

Closed
2 tasks done
ctcjab opened this issue Feb 19, 2025 · 7 comments
Closed
2 tasks done

conda-lock install ignores envs_dirs #777

ctcjab opened this issue Feb 19, 2025 · 7 comments

Comments

@ctcjab
Copy link

ctcjab commented Feb 19, 2025

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

conda-lock install -n ... invocations sometimes fail to honor the envs_dirs configuration:

Image

However, this does not reproduce reliably.

In fact, it often does the right thing after immediately retrying the exact same invocation:

Image

Any ideas of how to work around this and/or debug it would be greatly appreciated.

Additional Context

❯ cat /etc/issue.net
Ubuntu 24.04.1 LTS

❯ python3 --version
Python 3.12.8

❯ conda --version
conda 25.1.1

❯ mamba --version
2.0.5

❯ conda-lock --version
/uv/conda-lock/lib/python3.12/site-packages/clikit/utils/string.py:81: SyntaxWarning: invalid escape sequence '\s'
  words = re.split("\s+", string)
/uv/conda-lock/lib/python3.12/site-packages/clikit/api/args/format/command_option.py:47: SyntaxWarning: invalid escape sequence '\-'
  if not re.match("^[a-zA-Z0-9\-]+$", alias):
conda-lock, version 2.5.7
@maresb
Copy link
Contributor

maresb commented Feb 20, 2025

Reproducer:

FROM quay.io/jupyter/base-notebook:2025-02-20

RUN mamba install -y git pipx
RUN echo "export PATH=\"/home/jovyan/.local/bin:\$PATH\"" >> ~/.bashrc

RUN pipx install --force 'git+https://github.com/conda/conda-lock@v2.5.7'

RUN conda config --append envs_dirs '~/.conda'

RUN cat <<EOF > environment.yml
name: ficc
channels:
- conda-forge
- nodefaults
dependencies:
- tzcode
platforms:
- linux-64
EOF

RUN ~/.local/bin/conda-lock lock
docker build . -t cl777
docker run --rm -it cl777 /bin/bash
conda-lock install -n ficc
conda-lock install -n ficc

It appears that the prefix /opt/conda/envs/ficc is used on the first run and /home/jovyan/.conda/ficc is used in all subsequent runs.

@maresb
Copy link
Contributor

maresb commented Feb 20, 2025

Another reproducer not involving conda-lock:

FROM quay.io/jupyter/base-notebook:2025-02-20

RUN cat <<EOF > explicit.txt
# Generated by conda-lock.
# platform: linux-64
# input_hash: ab45cd56a12b42dab7d2e540f01585dd1d1f8a7b51e43009d3475f75794137ad
@EXPLICIT
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81
https://conda.anaconda.org/conda-forge/linux-64/libgomp-14.2.0-h77fa898_1.conda#cc3573974587f12dda90d96e3e55a702
https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#73aaf86a425cc6e73fcf236a5a46396d
https://conda.anaconda.org/conda-forge/linux-64/libgcc-14.2.0-h77fa898_1.conda#3cb76c3f10d3bc7f1105b2fc9db984df
https://conda.anaconda.org/conda-forge/linux-64/tzcode-2025a-hb9d3cd8_0.conda#e18bdeebf29176790089b654cfedaaec
EOF

RUN conda config --append envs_dirs '~/.conda'
docker build . -t cl777-nocl
docker run --rm -it cl777-nocl /bin/bash
mamba create --file explicit.txt --yes --name ficc
mamba create --file explicit.txt --yes --name ficc

Looking into workarounds...

@maresb
Copy link
Contributor

maresb commented Feb 20, 2025

Here's a simple workaround with --no-mamba:

docker run --rm -it cl777 /bin/bash
conda-lock install -n ficc --no-mamba

@maresb
Copy link
Contributor

maresb commented Feb 20, 2025

Another simple workaround:

MAMBA_ROOT_PREFIX=~/.conda conda-lock install -n ficc

@maresb
Copy link
Contributor

maresb commented Feb 20, 2025

An even simpler workaround 😂

mkdir ~/.conda
conda-lock install -n ficc

@maresb
Copy link
Contributor

maresb commented Feb 20, 2025

Reported upstream in mamba-org/mamba#3836

@ctcjab
Copy link
Author

ctcjab commented Feb 20, 2025

Thank you for tracking this down, reporting upstream, and providing the workaround, super helpful! I've applied the workaround in our environment and can report back if I see anything unexpected, but will close this for now. Thanks so much again!

@ctcjab ctcjab closed this as completed Feb 20, 2025
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