pixi icon indicating copy to clipboard operation
pixi copied to clipboard

bug(pypi): can't set a mapping mirror

Open bnogaro opened this issue 1 year ago • 3 comments

Checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Commands I ran and their output:

pixi init test_pixi_pyproject --format pyproject
cd test_pixi_pyproject 
pixi add matplotlib                                                                                                                                                                   
Error:   × error sending request for url (https://conda-mapping.prefix.dev/hash-v0/71e750d509f5fa3421087ba88ef9a7b9be11c53174af3aa4d06aff4c18b38e8e)
  ├─▶ client error (Connect)
  ╰─▶ tunnel error: unsuccessful

pixi.toml/pyproject.toml file that reproduces my issue:

[project]
authors = [{name = "Bastien NOGARO", email = "[email protected]"}]
dependencies = []
name = "test_pixi_pyproject"
requires-python = ">= 3.11"
version = "0.1.0"

[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]

[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64"]

[tool.pixi.pypi-options]
index-url = "https://mycorp.mycomain/artifactory/api/pypi/gw_files_pythonhosted_org_4dev/simple"

[tool.pixi.pypi-dependencies]
test_pixi_pyproject = { path = ".", editable = true }

[tool.pixi.tasks]

pixi info output:

System
------------
       Pixi version: 0.59.0
           Platform: linux-64
   Virtual packages: __unix=0=0
                   : __linux=5.14.0=0
                   : __glibc=2.34=0
                   : __archspec=1=cascadelake
          Cache dir: /home/r_nogaro/.cache/rattler/cache
       Auth storage: /home/r_nogaro/.rattler/credentials.json
   Config locations: /etc/pixi/config.toml

Global
------------
            Bin dir: /home/r_nogaro/.pixi/bin
    Environment dir: /home/r_nogaro/.pixi/envs
       Manifest dir: /home/r_nogaro/.pixi/manifests/pixi-global.toml

Workspace
------------
               Name: test_pixi_pyproject
            Version: 0.1.0
      Manifest file: /home/r_nogaro/Projects/test_pixi_pyproject/pyproject.toml

Environments
------------
        Environment: default
           Features: default
           Channels: conda-forge
   Dependency count: 1
       Dependencies: python
  PyPI Dependencies: test_pixi_pyproject
   Target platforms: linux-64
    Prefix location: /home/r_nogaro/Projects/test_pixi_pyproject/.pixi/envs/default

Other files (e.g. script files, source files, etc.): In /etc/pixi/config.toml

[mirrors]
# redirect all requests for conda-forge to the prefix.dev mirror
"https://conda.anaconda.org/conda-forge" = [
    "https://mymirror.mycorp/artifactory/prefix.dev"
]

[repodata-config]
disable-sharded = true

[pypi-config]
# Main index url
index-url = "https://mymirror.mycorp/artifactory/api/pypi/gw_files_pythonhosted_org_4dev/simple"
extra-index-urls = ['https:/mymirror.mycorp/artifactory/api/pypi/tdo-pip/simple']

Issue description

Behind a corporate proxy, redirection by a global config in [mirrors] as presented in the example works as long as disable-sharded is set to true (as expected). This works for projects created with a pixi.toml file, but when creating a project using the --format pyproject, the disable-sharded setting is ignored: as seen in the ouput, it tries to get the shard, even though it is explicitely disabled in the global config.

Expected behavior

Normal install without shards:

 pixi add matplotlib                                                                                                                                                                                2 ✘ 
✔ Added matplotlib >=3.10.7,<4

bnogaro avatar Oct 30 '25 10:10 bnogaro

hey @bnogaro ! Unfortunately, this is a mapping issue (Pixi is trying to fetch conda-pypi mapping ), and for now, you cannot set a mirror for it.

As a temporary solution, you can download the compressed_mapping.json and store it next to the project, and configure pixi to use it via https://pixi.sh/latest/reference/pixi_manifest/#conda-pypi-map-optional.

compressed mapping is located here: https://github.com/prefix-dev/parselmouth/tree/main/files/v0/conda-forge

The downside is that if there is a new package name, it will be missing from your local file ( so you need to update it at some cadence )

nichtmacho avatar Oct 30 '25 10:10 nichtmacho

Thanks for the answer, indeed my diagnostic was wrong. Thanks for the temporary fix.

bnogaro avatar Oct 30 '25 11:10 bnogaro

Since the question is answered, I will close this issue

Hofer-Julian avatar Nov 10 '25 08:11 Hofer-Julian