<#20362 Pants Backend Doesn't Respect Pypi Index> ...
# github-notifications
c
#20362 Pants Backend Doesn't Respect Pypi Index Issue created by frickerj Describe the bug When installing backend packages, pants does not respect the provided pypi indexes. I am operating in a corporate environment, we have no direct access to pypi or pythonhosted etc. I set my indexes in pants.toml like this:
Copy code
[python-repos]
indexes = [
    "<https://artifactory>.***".
    "<https://artifactory>.***",
    "<https://artifactory>.***",
]
With these backends
Copy code
backend_packages.add = [
  "pants.backend.python",
  "pants.backend.build_files.fix.deprecations",
  "pants.backend.build_files.fmt.black",
  "pants.backend.python.lint.autoflake",
  "pants.backend.python.lint.black",
  "pants.backend.python.lint.docformatter",
  "pants.backend.python.lint.isort",
  "pants.backend.experimental.python.lint.ruff"
]
Then, when trying to run
pants lint ::
I get these errors:
Copy code
There were 2 errors downloading required artifacts:
1. docformatter 1.4 from <https://files.pythonhosted.org/packages/8a/7b/b32b3952ee4e9fd76c7a9b18d4bafb70ed65ac6426d1802103c2eaf1d0de/docformatter-1.4.tar.gz>
    pip._vendor.requests.exceptions.ProxyError: HTTPSConnectionPool(host='<http://files.pythonhosted.org|files.pythonhosted.org>', port=443): Max retries exceeded with url: /packages/8a/7b/b32b3952ee4e9fd76c7a9b18d4bafb70ed65ac6426d1802103c2eaf1d0de/docformatter-1.4.tar.gz (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
2. untokenize 0.1.1 from <https://files.pythonhosted.org/packages/f7/46/e7cea8159199096e1df52da20a57a6665da80c37fb8aeb848a3e47442c32/untokenize-0.1.1.tar.gz>
    pip._vendor.requests.exceptions.ProxyError: HTTPSConnectionPool(host='<http://files.pythonhosted.org|files.pythonhosted.org>', port=443): Max retries exceeded with url: /packages/f7/46/e7cea8159199096e1df52da20a57a6665da80c37fb8aeb848a3e47442c32/untokenize-0.1.1.tar.gz (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
I do not have access to pythonhosted.org, which is why this is failing. I would only be able to access these packages through my internal mirror. The error changes, it seems dependent on which packages error first. My expectation is that by setting the index, any attempts to download packages would not try to hit pypi and instead use the provided index. Pants version Which version of Pants are you using? 2.18.1 OS Are you encountering the bug on MacOS, Linux, or both? Linux, Github Runner Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant. pantsbuild/pants