SSL: CERTIFICATE_VERIFY_FAILED on MAC Pycharm
I am facing The "SSL: CERTIFICATE_VERIFY_FAILED" error on a Mac, particularly when I run Python script, I am getting error as urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
I tried below steps but still facing the same error.
1. Install with --user (recommended for simplicity)
This installs packages into your user directory instead of system-wide:
pip install --user certifi
PyCharm will usually pick this up automatically if your interpreter is set correctly.
2. Use a virtual environment (best practice for projects)
Instead of installing globally, create a virtual environment just for your project:
python3 -m venv venv
source venv/bin/activate
pip install certifi
Then, in PyCharm:
- Go to Preferences → Project → Python Interpreter
- Select your new venv as the interpreter.
This keeps dependencies isolated and avoids permission issues.
3. Check PyCharm’s interpreter settings
- Go to Preferences → Project → Python Interpreter
- Make sure it’s pointing to the right Python (not the system one if you don’t want permission headaches).
- If it’s using the system interpreter, switch to a virtualenv or conda environment.
Post is closed for comments.
Hi there
To verify if the issue is PyCharm related may I ask if the issue also happens when you run the script out of pycharm (such as python yourscript.py in the system terminal)
If the issue happens in the same way then this needs to be investigate in SSL configuration / library level and would not really be a PyCharm IDE issue.
If the issue is Pycharm only related would you please provide a simple project so we can try to replicate this on our end?
Kind regards,
I am encountering a similar certificate issue on MacOS, and it is isolated to PyCharm's terminal environment. The issue doesn't exist when using Terminal or ITerm.
Certificate issues come up when using `uv add library`, and also when I attempt to use `logfire auth`.
UV Error:
Logfire error – Key part being rllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1077):
Disabling `activate virtualenv` in the Pycharm's terminal settings resolves the issue. Well, at least it allows me to go back to using UV directly without the SSL errors.
Hi, this issue requires thorough investigation, please create an issue on YouTrack (https://youtrack.jetbrains.com/issues/PY) and attach all relevant information for quicker resolution.