Home >Backend Development >Python Tutorial >Why is pip3 failing with \'SSL Module Not Available\' and how can I fix it in Ubuntu?
Unable to Install Packages with Pip3: Resolving the "SSL Module Not Available" Error
When installing packages using pip3 in Python 3.x environments, users may encounter the following SSL-related error:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
This error occurs when the Python installation lacks the SSL module, preventing Pip from establishing secure connections to package repositories. To rectify this issue, it is crucial to ensure that the SSL module is available within the Python environment.
One effective method to resolve the error is to install Python 3.6 and Pip3 manually in Ubuntu. Follow the step-by-step guide below:
Step 1: Install Essential Packages
Begin by installing the following packages necessary for Python and SSL functionality:
sudo apt-get install build-essential libffi-dev libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Step 2: Download and Unzip Python 3.6
Navigate to your home directory and download the Python 3.6.8.tar.xz file from https://www.python.org/ftp/python/. Unzip the downloaded file.
Step 3: Configure, Build, and Install
Open a terminal within the extracted Python directory and execute the following commands:
./configure make && sudo make install
Step 4: Install Packages with Pip3
Once Python 3.6 is successfully installed, you can now install packages using Pip3 with the command:
pip3 install package_name
Note: The provided commands have not been tested in Ubuntu 20.04 LTS.
The above is the detailed content of Why is pip3 failing with \'SSL Module Not Available\' and how can I fix it in Ubuntu?. For more information, please follow other related articles on the PHP Chinese website!