Closed KyleKing closed 5 years ago
To side-step the certificate issue. Would it be possible to point to a shared directory? This doesn't work now because file://
isn't a recognized adapter:
[[tool.poetry.source]]
name = "M"
url = "file://corporate.com/dfs/PythonPackages/"
Edit: created new ticket for this suggestion: #748
Turns out requests
recognize an environment variable REQUESTS_CA_BUNDLE
https://github.com/requests/requests/blob/master/requests/sessions.py#L707
Once set, Poetry worked without issue. Hopefully, this helps someone else out!
Edit: Also, Jean-Philippe summarizes this issue perfectly: https://bugs.python.org/issue28547
See https://github.com/python-poetry/poetry/issues/1012#issuecomment-567029119 for a solution using the new cert
configuration item. This can likely replace the need for the REQUESTS_CA_BUNDLE
environment variable
Same trouble this morning
[EnvCommandError]
Command ['/Users/tcn02/projects/perso/lightning-hydra-seed/.venv/bin/pip', 'install', '--no-deps', 'black==20.8b1'] errored with the following return code 1, and output:
Collecting black==20.8b1
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:1091)'))': /packages/dc/7b/5a6bbe89de849f28d7c109f5ea87b65afa5124ad615f3419e71beb29dc96/black-20.8b1.tar.gz
WARNING: Retrying (Retry(total=3, 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:1091)'))': /packages/dc/7b/5a6bbe89de849f28d7c109f5ea87b65afa5124ad615f3419e71beb29dc96/black-20.8b1.tar.gz
WARNING: Retrying (Retry(total=2, 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:1091)'))': /packages/dc/7b/5a6bbe89de849f28d7c109f5ea87b65afa5124ad615f3419e71beb29dc96/black-20.8b1.tar.gz
@tchaton you may want to open a new issue. I tested poetry latest with my network’s self-signed certificates yesterday and the recommended fixes still work. In your case, it looks like something else is happening (not a self-signed certificate error, at least not from your posted error message)
I would recommend posting more information about your IT environment, poetry and OS versions, and the steps you can take to replicate the failure? Does pip install work with poetry run pip install. Is it only black that fails to install or all packages, etc.
Below steps worked for me.
Connect to any https site with browser
Click on lock icon just to left of https://
View and save root certificate
Convert cert to .pem I used openssl that comes with git.
# cd C:\Users\<my_username>\AppData\Local\Programs\Git\usr\bin>
# ./openssl x509 -in "C:\Users\<my_username>\<my_folder>\my_cert.cer" -out "C:\Users\<my_username>\<my_folder>\my_cert.pem"
Open my_cert.pem in a notepad/notepad++. Copy the text
Locate your cacert.pem. In my case it was in path below.
C:\Users\<my_username>\.poetry\lib\poetry\_vendor\py3.9\certifi\cacert.pem
Paste the text copied in step 5 to cacert.pem and save
You just achieved Nirvana!
what worked for me (MacOS): go to Applications > Python folder > double click on "Install Certificates.command" file
@danibachini you are the queen!
@danibachini Perfect. Thank you.
what worked for me (MacOS): go to Applications > Python folder > double click on "Install Certificates.command" file
specifically, run this command worked for me /Applications/Python\ 3.11/Install\ Certificates.command
.
https://github.com/requests/requests/blob/master/requests/sessions.py#L707
Thanks! This is correct solution for this issue for those Mac OS X.
find your_ca_bundle.pem file, because your poetry commands need SSL certifications,
export REQUESTS_CA_BUNDLE=~/your_cert_path/your_ca_bundle.pem
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
[X] I am on the latest Poetry version.
get_poetry.py
using Python 3.7.1 (Logs: install_poetry.txt)[X] I have searched the issues of this repo and believe that this is not a duplicate.
[x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: Windows 7
Poetry version: 0.12.10
Contents of your pyproject.toml file: pyproject.toml (*renamed to .txt to upload)
poetry new hello_world
with my email address obscuredIssue
How can I point Poetry to a custom
.pem
certificate?Poetry isn't using the correct certificate when accessing pypi.org. For pip, conda, and other applications I have had to add a custom
.pem
file since my company uses a self-signed certificate. Thepip
in the virtualenv created by Poetry use the correct setting (see below:C:\\Programs\\cert\\cacert.pem
), but Poetry throws an SSLError when running any actionCode
Here are the abbreviated logs from running the minimum steps to reproduce: