Thanks to visit codestin.com
Credit goes to github.com

Skip to content

conda-lock install fails if URL includes percent encoded character #764

@mhoeger

Description

@mhoeger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions