Software Development

How do I resolve the "SSL module in Python is not available" error on Windows, Linux, or macOS?

MA Asked by Marcus Chen · 03-02-2025
0 upvotes 20,222 views 0 comments
The question

I am trying to install packages using pip, but I keep getting a warning that says: "pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available." This prevents me from downloading any libraries. I have OpenSSL installed on my system, so I'm not sure why Python can't find it. Is this an issue with my environment variables, a missing dependency during the Python build process, or do I need to reinstall Python entirely to fix the SSL configuration?

3 answers

0
SA
Answered on 04-02-2025

This error usually means that your Python installation was compiled or installed without linking to the necessary OpenSSL development headers.

  • On Ubuntu/Debian: You need to install the development files first. Run sudo apt-get update && sudo apt-get install libssl-dev. If you built Python from source, you must re-run ./configure and make install after installing this package.

  • On Windows: This often happens if the OpenSSL DLLs (libssl.dll and libcrypto.dll) are missing from your PATH. Reinstalling Python and checking the box "Add Python to PATH" usually fixes this. Alternatively, if you use Anaconda, try running conda install openssl.

  • On macOS: If you used Homebrew, ensure your environment can see the brew-installed OpenSSL by adding it to your .zshrc or .bash_profile: export PATH="/usr/local/opt/openssl/bin:$PATH".

0
JA
Answered on 05-02-2025

I had this exact same problem on a CentOS server! It turns out Python 3.10 and above require OpenSSL 1.1.1 or newer. If your OS is older (like CentOS 7), the default OpenSSL is too old. I had to install openssl11-devel and then rebuild Python using the flag ./configure --with-openssl=/usr/include/openssl11. Has anyone else found a way to do this without recompiling the whole thing from source?

ST 06-02-2025

James, for users who don't want to compile from source, using a version manager like pyenv is a lifesaver. pyenv handles the dependencies for you. On many systems, you just need to run sudo apt install libssl-dev and then pyenv install 3.x.x. It automatically links the SSL headers during the installation process, which is a best practice in modern software development.

0
MA
Answered on 08-02-2025

If you are seeing this inside a Virtual Environment, sometimes the environment gets corrupted. Try deleting the venv folder and creating a new one. It usually inherits the SSL capability from the global Python interpreter correctly the second time.

MA 10-02-2025

I agree with Maria. I actually ran into this exact issue last week while working on a Data Science project. The virtual environment wasn't picking up the updated OpenSSL libraries I had installed on my host machine. Deleting the venv and re-running python -m venv venv forced it to re-link the global binaries, including the fixed SSL module. It's a much faster fix than trying to manually patch the environment variables.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

World globe icon Country: India

Book Free Session