TL;DR
For every host that you see in error message, add a new fake repository and disable verification for it.
An relevant discussion on topic: https://github.com/orgs/python-poetry/discussions/6681
If you're doing this globally:
- Add repo using
poetry source add XYZ... or by editing config.toml.
- Disable cert check using
poetry config certificates.XYZ.cert false or by editing auth.toml
It might be possible to do the same for your specific project (pyproject.toml) instead of globally (config.toml and auth.toml). See poetry docs.
E.g.
- For me it started with
host='pypi.org':
HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /packages/0b/fc/8781442def77b0aa22f63f266d4dadd486ebc0c5371d6290caf4320da4b7/setuptools-67.6.1-py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
- This was worked around by asking poetry to ignore cert verification for
PyPI (not pypi). Using
$ poetry config certificates.PyPI.cert false
- Then I got same error for
files.pythonhosted.org.
$ poetry source add fpho https://files.pythonhosted.org
$ poetry config certificates.fpho.cert false
Final environment:
$
$ export PYTHONWARNINGS="ignore:Unverified HTTPS request"
$
$ cat /home/kash/.config/pypoetry/config.toml
[repositories]
[repositories.fpho]
url = "https://files.pythonhosted.org"
[repositories.my_host_240_64]
url = "10.140.240.64"
$
$ cat /home/kash/.config/pypoetry/auth.toml
# apparently the brain-trust at poetry call pypi.org repo "PyPI",
# not pypi. And provide no apparent way to list the "default" repos.
[certificates.PyPI]
cert = false
[certificates.fpho]
cert = false
[certificates.my_host_240_64]
cert = false
$
$ poetry add <your package>
$