Issue
I am attempting to install the Azure CLI on my Fedora 35 machine using this guide. When installing the RHEL 9 RPM using DNF (step 2 of that guide), Python 3.9 is installed along with Azure (Azure is dependent on 3.9). The installation of both applications appears to succeed until I run az --version
, at which point I get a module not found error from /usr/local/lib/python3.9/ssl.py
:
ModuleNotFoundError: No module named '_ssl'
I have OpenSSL already installed properly on my machine at /usr/bin/openssl
. Can I modify my Python installation to find this module?
I have already tried uninstalling and re-installing Azure and Python 3.9.
I have previously attempted to install Python 3.9 from source, but failed to do so, and did a manual uninstall by running sudo rm -rf
on any directories relating to Python 3.9 before attempting to install Azure. None-the-less, it's entirely possible that I didn't do this properly.
I also have 2 other versions of Python (3.10.7 and 2.7.18) already installed.
I am very lost, and appreciate the help!
P.S: I expect to have similar issues with other modules once I resolve this problem. Ideally, I'd like to understand what I'm doing and how to apply this fix to similar errors. Thank you! :)
Solution
I managed to resolve this by uninstalling python3.9
and the Azure CLI, then using whereis
to properly remove my broken source installation:
sudo dnf remove azure-cli-2.42.0-1.el9.x86_64
whereis python3.9
sudo rm -rf /usr/local/bin/python3.9*
sudo rm -rf /usr/local/lib/python3.9*
sudo dnf install azure-cli-2.42.0-1.el9.x86_64
Answered By - Robbie Answer Checked By - Terry (WPSolving Volunteer)