Problems
I needed to update Python in one of my forgotten labs from 3.6 as Netmiko required 3.7 or higher.
0 1 2 |
Netmiko Version 4.1.2 requires Python Version 3.7 or higher. 🐍 |
So a quick Google and what I thought would be a straightforward install.
Turns out it wasn’t. CentOS 7 has a bug that complains about the SSL modules in Python not being available.
0 1 2 |
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. |
The fix to this came from the Python bug tracker: https://bugs.python.org/issue47201
Before running the “make” command be sure to run the following
0 1 2 3 4 |
sudo yum install -y epel sudo yum install -y openssl11-devel sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure |
Python Installation
Update CentOS
0 1 2 |
yum update |
Install necessary packages
0 1 2 3 4 |
sudo yum install openssl-devel bzip2-devel libffi-devel -y sudo yum groupinstall "Development Tools" -y sudo yum install wget -y |
Download and extract Python
0 1 2 3 |
wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz tar -xzf Python-3.10.2.tgz |
cd into the extracted Python directory
0 1 2 |
cd Python-3.10.2 |
Run the following, this is where we will ensure that for CentOS 7 we patch the bug.
0 1 2 3 4 5 6 |
./configure --enable-optimizations #Patch for Centos7 bug sudo yum install -y epel sudo yum install -y openssl11-devel sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure |
0 1 2 |
make altinstall |
pATH pROBLEM
I had an error complaining about the fact that pip was no on PATH.
0 1 2 |
Error: WARNING: The scripts pip, pip3 and pip3.10 are installed in '/home/centos/.local/bin' which is not on PATH. |
Fixed with the following
0 1 2 3 |
export PATH="/home/centos/.local/bin:$PATH" source ~/.bash_profile |
Check
0 1 2 3 4 5 6 7 8 |
#Before -bash-4.2$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin #After -bash-4.2$ echo $PATH /home/centos/.local/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin |
Install Virtual Environments
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
-bash-4.2$ python3.10 -m pip install virtualenv Defaulting to user installation because normal site-packages is not writeable Collecting virtualenv Downloading virtualenv-20.16.4-py3-none-any.whl (8.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.8/8.8 MB 2.7 MB/s eta 0:00:00 Collecting platformdirs<3,>=2.4 Downloading platformdirs-2.5.2-py3-none-any.whl (14 kB) Collecting distlib<1,>=0.3.5 Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.5/468.5 kB 2.7 MB/s eta 0:00:00 Collecting filelock<4,>=3.4.1 Downloading filelock-3.8.0-py3-none-any.whl (10 kB) Installing collected packages: distlib, platformdirs, filelock, virtualenv Successfully installed distlib-0.3.6 filelock-3.8.0 platformdirs-2.5.2 virtualenv-20.16.4 |