Open LaudixGit opened 1 year ago
see #610 for inability to get iotedgedev version
Note: attempting to correct underlaying issue sudo pip install pyOpenSSL --upgrade
fails with same error:
module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
I started over: wiped the USB Drive and reinstall RaspiOS lite from Raspberypi.org. Installed the latest pyopenssl (23). confirmed with 'piplist'. Installed iotedgedev. pyopenssl reverted to version 22 and I am again stuck with the original issue. "AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'"
in short iotedgedev breaks pip
Due to this issue I install CookieCutter prior to installing iotedgedev. However after iotedgedev was installed, this error appears when attempting to create a new python module (iotedgedev add --template python LED)
ERROR: To add new Python modules, the Cookiecutter tool is required by the Azure IoT Edge Dev Tool. For installation instructions, see https://aka.ms/iotedgedevwiki.
Almost certainly the iotedgedev is breaking its own dependency.
The list of python modules before iotedgedev: pip list
Package Version
attrs 23.1.0 bcrypt 4.0.1 certifi 2020.6.20 cffi 1.15.1 chardet 4.0.0 charset-normalizer 3.2.0 colorzero 1.1 cryptography 41.0.3 distro 1.5.0 docker 6.1.3 docker-compose 1.29.2 dockerpty 0.4.1 docopt 0.6.2 gpiozero 1.6.2 idna 2.10 jsonschema 3.2.0 numpy 1.19.5 packaging 23.1 paramiko 3.3.1 picamera2 0.3.12 pidng 4.0.9 piexif 1.1.3 Pillow 8.1.2 pip 20.3.4 pycparser 2.21 PyNaCl 1.5.0 pyrsistent 0.19.3 python-apt 2.2.1 python-dotenv 0.21.1 python-prctl 1.7 PyYAML 5.4.1 requests 2.25.1 RPi.GPIO 0.7.0 setuptools 52.0.0 simplejpeg 1.6.4 six 1.16.0 spidev 3.5 ssh-import-id 5.10 texttable 1.6.7 toml 0.10.1 urllib3 1.26.5 v4l2-python3 0.3.2 websocket-client 0.59.0 wheel 0.34.2
After iotedgedev installation: observe incompatible versions
Package Version
adal 1.2.7 applicationinsights 0.11.9 argcomplete 1.12.3 attrs 23.1.0 azure-cli-core 2.34.1 azure-cli-telemetry 1.0.6 azure-core 1.29.3 azure-mgmt-core 1.4.0 bcrypt 3.1.7 certifi 2020.6.20 cffi 1.15.1 chardet 4.0.0 charset-normalizer 3.2.0 click 8.1.7 colorzero 1.1 commentjson 0.9.0 cryptography 41.0.3 decorator 5.1.1 distro 1.5.0 docker 5.0.3 docker-compose 1.29.1 dockerpty 0.4.1 docopt 0.6.2 fstrings 0.1.0 gpiozero 1.6.2 humanfriendly 10.0 idna 2.10 iotedgedev 3.3.7 iotedgehubdev 0.14.18 isodate 0.6.1 jmespath 1.0.1 jsonpath-rw 1.4.0 jsonschema 3.2.0 knack 0.9.0 lark-parser 0.7.8 more-itertools 8.0.2 msal 1.23.0 msal-extensions 0.3.1 msrest 0.7.1 msrestazure 0.6.4 numpy 1.19.5 oauthlib 3.2.2 packaging 21.3 paramiko 2.12.0 picamera2 0.3.12 pidng 4.0.9 piexif 1.1.3 Pillow 8.1.2 pip 20.3.4 pkginfo 1.9.6 ply 3.11 portalocker 1.7.1 psutil 5.9.5 pycparser 2.21 Pygments 2.16.1 PyJWT 2.8.0 PyNaCl 1.5.0 pyOpenSSL 22.0.0 pyparsing 3.1.1 pyrsistent 0.19.3 PySocks 1.7.1 python-apt 2.2.1 python-dateutil 2.8.2 python-dotenv 0.21.1 python-prctl 1.7 PyYAML 5.4.1 regex 2023.8.8 requests 2.25.1 requests-oauthlib 1.3.1 RPi.GPIO 0.7.0 setuptools 52.0.0 simplejpeg 1.6.4 six 1.16.0 spidev 3.5 ssh-import-id 5.10 tabulate 0.9.0 texttable 1.6.7 toml 0.10.1 typing_extensions 4.7.1 urllib3 1.26.5 v4l2-python3 0.3.2 websocket-client 0.59.0 wheel 0.34.2
if you've gotten to this, you are like me and trying to recover. These steps recovered my pip enough to continue. (your mileage may vary)
Find the cryptography file
python3 -c "import cryptography; print(cryptography.__file__)"
**result**: /usr/local/lib/python3.9/dist-packages/cryptography/__init__.py
observe version
sudo cat /usr/local/lib/python3.9/dist-packages/cryptography/__about__.py
**result**: __version__ = "41.0.3"
delete it
sudo rm -r /usr/local/lib/python3.9/dist-packages/cryptography/
sudo ls /usr/local/lib/python3.9/dist-packages/cryptography/
Download prior version from source
wget https://files.pythonhosted.org/packages/a2/8f/6c52b1f9d650863e8f67edbe062c04f1c8455579eaace1593d8fe469319a/cryptography-38.0.4-cp36-abi3-manylinux_2_28_aarch64.whl
extract
unzip cryptography-38.0.4-cp36-abi3-manylinux_2_28_aarch64.whl
observe version
cat cryptography/__about__.py
**result**: __version__ = "38.0.4"
copy to folder previously identified
sudo cp -av /home/inc/cryptography/ /usr/local/lib/python3.9/dist-packages/
sudo cat /usr/local/lib/python3.9/dist-packages/cryptography/__about__.py
**result**: __version__ = "38.0.4"
verify repair
sudo pip3 install Click
It is not possible to avoid the incompatible version by installing pyOpenSSL sudo pip install pyopenssl --upgrade
before installing iotedgedev.
After the iotedgedev install pyOpenSSL is back-rev'd from 23 to 22 and the incompatibility (the reason for this issue) reappears.
Description
before installation pip works. after fails. Error: AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Note: root cause is not iotedgedev. However, the install of iotedgedev forced an update that results in this error.
https://stackoverflow.com/questions/74981558/error-updating-python3-pip-attributeerror-module-lib-has-no-attribute-openss
Expected behavior
iotedgedev installs with unintended consequences
Actual behavior
After installation pip fails:
$ sudo pip3 install Click Traceback (most recent call last): File "/usr/bin/pip3", line 33, in <module> sys.exit(load_entry_point('pip==20.3.4', 'console_scripts', 'pip3')()) File "/usr/bin/pip3", line 25, in importlib_load_entry_point return next(matches).load() File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 790, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module> from pip._internal.cli.autocompletion import autocomplete File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module> from pip._internal.cli.main_parser import create_main_parser File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module> from pip._internal.cli import cmdoptions File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module> from pip._vendor.packaging.utils import canonicalize_name File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 94, in <module> vendored("requests.packages.urllib3.contrib.pyopenssl") File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored __import__(modulename, globals(), locals(), level=0) File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 664, in _load_unlocked File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible File "<frozen zipimport>", line 259, in load_module File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 50, in <module> File "/usr/local/lib/python3.9/dist-packages/OpenSSL/__init__.py", line 8, in <module> from OpenSSL import crypto, SSL File "/usr/local/lib/python3.9/dist-packages/OpenSSL/crypto.py", line 3268, in <module> _lib.OpenSSL_add_all_algorithms() AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Steps to Reproduce
use pip: sudo pip3 install Click install: sudo pip3 install -U iotedgedev try pip again
Environment
$ uname -a Linux RPi4-Alpha 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux $ python --version Python 3.9.2 $ pip --version pip 23.2.1 from /home/inc/.local/lib/python3.9/site-packages/pip (python 3.9) $ iotedgedev -- version Traceback (most recent call last): File "/usr/local/bin/iotedgedev", line 5, in from iotedgedev.cli import main File "/usr/local/lib/python3.9/dist-packages/iotedgedev/cli.py", line 5, in import click ModuleNotFoundError: No module named 'click'