vlaci / openconnect-sso

Wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication to Cisco SSL-VPNs
GNU General Public License v3.0
299 stars 131 forks source link

ModuleNotFoundError: No module named 'PyQt5' [solved; please update installation instructions with this info] #111

Open ElectricRCAircraftGuy opened 2 years ago

ElectricRCAircraftGuy commented 2 years ago

Add to the installation instructions how to install PyQt5. It's missing on my Ubuntu 18.04 system.

$ openconnect-sso 
Traceback (most recent call last):
  File "/home/gabriel/.local/bin/openconnect-sso", line 5, in <module>
    from openconnect_sso.cli import main
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/cli.py", line 10, in <module>
    from openconnect_sso import app, config, __version__
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/app.py", line 16, in <module>
    from openconnect_sso.authenticator import Authenticator, AuthResponseError
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/authenticator.py", line 6, in <module>
    from openconnect_sso.saml_authenticator import authenticate_in_browser
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/saml_authenticator.py", line 3, in <module>
    from openconnect_sso.browser import Browser
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/browser/__init__.py", line 1, in <module>
    from .browser import Browser, DisplayMode, Terminated
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/browser/browser.py", line 5, in <module>
    from . import webengine_process as web
  File "/home/gabriel/.local/pipx/venvs/openconnect-sso/lib/python3.6/site-packages/openconnect_sso/browser/webengine_process.py", line 12, in <module>
    from PyQt5.QtCore import QUrl, QTimer
ModuleNotFoundError: No module named 'PyQt5'
ElectricRCAircraftGuy commented 2 years ago

I still get the error even after installing PyQt5 for both Python2 and Python3 via this command:

sudo apt-get install python-pyqt5 python3-pyqt5

Source: https://stackoverflow.com/a/36806286/4561887

ElectricRCAircraftGuy commented 2 years ago

This does not solve it either: https://bobbyhadz.com/blog/python-no-module-named-pyqt5

pip install PyQt5
pip3 install PyQt5

Also doesn't solve it:

pipx install PyQt5
ElectricRCAircraftGuy commented 2 years ago

This seems to have worked!

sudo apt install python3.8
python3.8 -m pip install --upgrade pip
python3.8 -m pip install openconnect-sso

python3.8 -m pip uninstall PyQt5
python3.8 -m pip uninstall PyQt5-sip
python3.8 -m pip uninstall PyQtWebEngine
python3.8 -m pip uninstall keyring

python3.8 -m pip install PyQt5
python3.8 -m pip install PyQt5-sip
python3.8 -m pip install PyQtWebEngine
python3.8 -m pip install keyring

python3.8 -m pip install cffi

# Check version
# My output is: `openconnect-sso 0.7.3`
openconnect-sso --version

Partial source: https://stackoverflow.com/a/54947671/4561887

ElectricRCAircraftGuy commented 2 years ago

This works too it looks like (more-complete instructions):

sudo apt update
sudo apt install vpnc-scripts openconnect
sudo apt install python3

python3 -m pip install --upgrade pip
python3 -m pip install openconnect-sso

python3 -m pip uninstall PyQt5
python3 -m pip uninstall PyQt5-sip
python3 -m pip uninstall PyQtWebEngine
python3 -m pip uninstall keyring

python3 -m pip install PyQt5
python3 -m pip install PyQt5-sip
python3 -m pip install PyQtWebEngine
python3 -m pip install keyring

python3 -m pip install cffi

# Check version
# My output is: `openconnect-sso 0.7.3`
openconnect-sso --version

Example usage:

VPN_CONNECT_TO="myvpn.whatever.com"         # example server address
VPN_SAML_GROUP="whatever-saml-whatever"     # example SAML group name
VPN_USER="my.username@something.com"        # example username
# or perhaps just this:
# VPN_USER="my.username"
openconnect-sso --server "${VPN_CONNECT_TO}/${VPN_SAML_GROUP}" --user "${VPN_USER}"
ElectricRCAircraftGuy commented 2 years ago

I just wrote these detailed instructions: How to use "openconnect" (via the openconnect-sso wrapper) with SAML and Duo two-factor authentication via Okta Single-Sign-on (SSO)

dave888 commented 1 year ago

I ran into the same PyQt5 problem on macos; but I found the solution buried in the CHANGELOG:

pip install --user --upgrade "openconnect-sso[full]"

This includes PyQt5 in the install.

zeitgenosse commented 1 year ago

For those who have installed with pipx install openconnect-sso: You need to manually “inject” the dependencies PyQt5 and PyQtWebengine into openconnect-sso:

pipx inject openconnect-sso PyQt5 PyQtWebengine

rapgro commented 1 year ago

For those who have installed with pipx install openconnect-sso: You need to manually “inject” the dependencies PyQt5 and PyQtWebengine into openconnect-sso:

pipx inject openconnect-sso PyQt5 PyQtWebengine

Well, can someone fix that within requirements.txt?