package name normalization in conda-lock lock functionality

63 views Asked by At

I am currently having the following problems with building and installing python packages and would be interested if anyone else have experienced this:

I built a conda package whose name contains an underscore (let's say package name is foo_bar). I have pushed this package to a self-hosted conda channel and can install it by doing conda install foo_bar -c my_channel on a Linux machine.

However when I use the package as a requirement in another project's pyproject.töml like this

[project]
    name= "moonmoon"
    version = "0o755"
    dependencies = [
        "foo_bar",
        ]

and then try to lock this project's (so moonmoon's) conda environment using
conda-lock lock -f pyproject.toml --lockfile conda-lock.yml
the locking process exits with an error. The relevant part seems to be

"exception_name": "PackagesNotFoundError",
"exception_type": "<class 'conda.exceptions.PackagesNotFoundError'>",
"message": "The following packages are not available from current channels:\n\n  - foo-bar\n\nCurrent channels:\n\n  - my-channel\n\nTo search for alternate channels that may provide the conda package you're\nlooking for, navigate to\n\n    https://anaconda.org\n\nand use the search bar at the top of the page.\n",
  "packages": [
    "foo-bar"
  ],
  "packages_formatted": "  - foo-bar"
}

So I guess the issue is that somehow the package name foo_bar gets normalized to foo-bar and although this does not make a difference to pip, it makes a difference to conda (i.e. conda install foo-bar -c my_channel will fail). Does anyone have more insight into this problem? Ideally, I would like to keep the package name as foo_bar.
Grazie!

0

There are 0 answers