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 fails if URL includes percent encoded character #764

Open
2 tasks done
mhoeger opened this issue Jan 7, 2025 · 1 comment
Open
2 tasks done

Comments

@mhoeger
Copy link

mhoeger commented Jan 7, 2025

Checklist

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

What happened?

Hi there! I'm trying to install a package with characters in the version spec that aren't typical (an exclamation point). This is coming from x264 which is a dependency of ffmpeg which is a dependency of ffmpeg-python which is in turn a dependency of geemap.

When I generate a conda-lock file with this command:
conda-lock --micromamba --check-input-hash -p linux-64 -p osx-64 -p osx-arm64 -f meta.yaml

I get entries like this for the x264 library:

- name: x264
  version: 1!164.3095
  manager: conda
  platform: linux-64
  dependencies:
    libgcc-ng: '>=12'
  url: https://conda.anaconda.org/conda-forge/osx-arm64/x264-1%21164.3095-h57fd34a_2.tar.bz2
  hash:
    md5: 6c99772d483f566d59e25037fea2c4b1
    sha256: 175315eb3d6ea1f64a6ce470be00fa2ee59980108f246d3072ab8b977cb048a5
  category: dev
  optional: true

However, when I try to install these dependencies with conda-lock install --mamba --name=dev-env conda-lock.yml, I get the following error:

ERROR:root:Invalid spec 'https://conda.anaconda.org/conda-forge/osx-64/x264-1%21164.3095-h775f41a_2.tar.bz2 md5=23e9c3180e2c0f9449bb042914ec2200': Invalid version '1%21164.3095': invalid character(s)
ERROR:root:
ERROR:root:InvalidMatchSpec: Invalid spec 'https://conda.anaconda.org/conda-forge/osx-64/x264-1%21164.3095-h775f41a_2.tar.bz2 md5=23e9c3180e2c0f9449bb042914ec2200': Invalid version '1%21164.3095': invalid character(s)
ERROR:root:
Traceback (most recent call last):
  File "/usr/local/bin/conda-lock", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/conda_lock/conda_lock.py", line 1498, in click_install
    install(
  File "/usr/local/lib/python3.8/site-packages/conda_lock/conda_lock.py", line 1552, in install
    install_func(file=lockfile)
  File "/usr/local/lib/python3.8/site-packages/conda_lock/conda_lock.py", line 225, in do_conda_install
    _conda(
  File "/usr/local/lib/python3.8/site-packages/conda_lock/invoke_conda.py", line 143, in _invoke_conda
    raise subprocess.CalledProcessError(
conda_lock._vendor.poetry.utils._compat.CalledProcessError: Command '['/Users/mariehoeger/miniforge3/bin/mamba', 'create', '--file', '/var/folders/w_/nd5fp59x0gb7w7zfg6wd72kh0000gr/T/tmpq8qowdpj', '--yes', '--name', 'dev-env']' returned non-zero exit status 1.

When I manually change the conda-lock file to not have a % encoded URL, install works:

- name: x264
  version: 1!164.3095
  manager: conda
  platform: linux-64
  dependencies:
    libgcc-ng: '>=12'
  url: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2
  hash:
    md5: 6c99772d483f566d59e25037fea2c4b1
    sha256: 175315eb3d6ea1f64a6ce470be00fa2ee59980108f246d3072ab8b977cb048a5
  category: dev
  optional: true

Additional Context

No response

@maresb
Copy link
Contributor

maresb commented Jan 9, 2025

Thanks @mhoeger for the very well-written and well-researched report. Your efforts certainly saved me a lot of time.

I passed the issue upstream in mamba-org/mamba#3737. Until this is addressed, I'd recommend downgrading micromamba to 1.5.12. This can be done via the command

micromamba self-update --version 1.5.12

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