-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
truststore feature does not work when set in a requirement file #12319
Comments
This is a chicken and egg problem. To use |
Thanks for you answer. |
The problem may be the certificate store is initialised too early in the process and it’s too late when the requirements file is parsed. In general I kind of doubt is |
I agree. My first thought here was “ I’d prefer that we deprecate the use of |
Personally, I can live eventually with |
Description
Hi,
After digging a bit, I am quite confident that the truststore feature does not work as expected when the option is placed in a requirement file.
In my org, we have a PyPi server with self-signed certs. I managed to make pip install work with the truststore feature when used in command line option, but when used in a requirement files, I get the typical error
unable to get local issuer certificate
.Expected behavior
I am expecting no difference in behaviour of the truststore feature whether it is set as command line option or in a requirement file (since the option
use-feature
is allowed in requirement files).pip version
23.2.1
Python version
3.10
OS
Windows 10 and Ubuntu 20.04 (I checked both)
How to Reproduce
Not easy to reproduce, as you might need to set up a self signed pypi server or equivalent to reproduce the bug.
But basically, considering a requirements file like this:
requirements.txt
the command
pip install -r requirements.txt
will fail with an SSLContext error (see output after).However, the command
pip install --use-feature truststore -r requirements.txt
works as expected.After digging, I think the issue comes from the fact that without the commad line option, the PipSession object is instanciated with the default SSLContext. But this default context is not replaced by the truststore SSLContext when the
--use-feature truststore
line is parsed in the requirement file.Output
$ pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://[custom_pypi_server]/simple/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/dlab-tools/
Code of Conduct
The text was updated successfully, but these errors were encountered: