I am encountering an error when running the poetry install command in my Python project. The error message is as follows:
HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: ... (Caused by SSLError(FileNotFoundError(2, 'No such file or directory')))
I have tried the following troubleshooting steps, but none have resolved the issue:
- Verified my internet connection.
- Checked that I have the latest version of Poetry installed.
- Ensured my Git and OpenSSL installations are up-to-date.
- Confirmed that the repository URL is correct and accessible from a browser.
Despite all this, the error persists. It seems related to SSL or Git configuration, but I am unsure how to resolve it.
Environment Details:
OS: 14.7.1 (23H222)
Python version: 3.11.9]
Poetry version: 1.8.5
Git version: 2.45.2
Has anyone encountered this issue before or can provide guidance on how to resolve it?
2
Here’s how I resolved the issue:
1. Install or Update certifi in the Virtual Environment
Make sure the certifi package is installed and up-to-date:
pip install --upgrade certifi
Locate the cacert.pem File
Use the following command to find where the cacert.pem file is located:
python -m certifi
2. Copy the cacert.pem File to the Expected Location
From the error message (I tried to clone the repo from github using https), I saw that the virtual environment was looking for the cacert.pem file here:
/Users/user/.../certifi/cacert.pem
If the file is missing, copy it from another working virtual environment. For example:
mkdir -p /Users/user/.../certifi/
cp /path/to/working/venv/lib/python3.11/site-packages/certifi/cacert.pem /Users/user/.../cacert.pem
3. Retry the Command
After copying the cacert.pem file to the correct location, I retried the poetry install command and it worked!.
I had the same problem because I worked behind company vpn.
This worked for windows.
This is not recommended solution but if you are left with no choice this worked for me:
Change version to Poetry 1.6.1
pip uninstall poetry
pip install poetry=1.5.1
upon completion, use the following commands:
poetry source add fpho https://files.pythonhosted.org
poetry config certificates.fpho.cert false
poetry source add pypi
poetry config certificates.PyPI.cert false
poetry config certiticates.pypi.cert false
I don’t really like this solution and I cant manage to add my own signed .crt file so I used this.