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:
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?
Here’s how I resolved the issue:
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
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
After copying the cacert.pem file to the correct location, I retried the poetry install command and it worked!.