Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms' #160

Open
danielegiallonardo opened this issue Mar 15, 2023 · 6 comments

Comments

@danielegiallonardo
Copy link

Durante l'esecuzione dell'ultima versione di spid-sp-test ottengo l'errore in oggetto.
In particolare, eseguendo, da una action github, i seguenti comandi:

sudo apt install -y libxml2-dev libxmlsec1-dev libxmlsec1-openssl xmlsec1 python3-pip
sudo pip install spid-sp-test --upgrade --no-cache
spid_sp_test --metadata-url https://localhost:5001/spid/metadata.xml --authn-url https://localhost:5001/home/login?idpname=SpidSpTest --extra --debug ERROR --profile spid-sp-ag-public-full -tr

Ottengo in output il seguente errore:

Traceback (most recent call last):
File "/usr/local/bin/spid_sp_test", line 9, in
from saml2.metadata import entity_descriptor
File "/usr/local/lib/python3.10/dist-packages/saml2/metadata.py", line 11, in
from saml2.algsupport import algorithm_support_in_metadata
File "/usr/local/lib/python3.10/dist-packages/saml2/algsupport.py", line 6, in
from saml2.sigver import get_xmlsec_binary
File "/usr/local/lib/python3.10/dist-packages/saml2/sigver.py", line 31, in
from OpenSSL import crypto
File "/usr/lib/python3/dist-packages/OpenSSL/init.py", line 8, in
from OpenSSL import crypto, SSL
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 3279, in
_lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Error: Process completed with exit code 1.

In fase di installazione di spid-sp-test e delle dipendenze sono state scaricate le seguenti versioni:
Downloading spid_sp_test-1.2.13-py3-none-any.whl (2.5 MB)
Downloading spid_compliant_certificates-0.5.4-py3-none-any.whl (36 kB)

@peppelinux
Copy link
Member

With my first trial I can't reproduce it

utente@pro:~/DEV/DTD/Spid/spid_sp_test$ virtualenv -ppython3 env2
created virtual environment CPython3.10.6.final.0-64 in 176ms
  creator CPython3Posix(dest=/home/utente/DEV/DTD/Spid/spid_sp_test/env2, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/utente/.local/share/virtualenv)
    added seed packages: pip==23.0.1, setuptools==67.3.3, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
utente@pro:~/DEV/DTD/Spid/spid_sp_test$ source env2/bin/activate
(env2) utente@pro:~/DEV/DTD/Spid/spid_sp_test$ pip install -e .
Obtaining file:///home/utente/DEV/DTD/Spid/spid_sp_test
  Preparing metadata (setup.py) ... done
Collecting pysaml2>=6.5.1
  Downloading pysaml2-7.4.1-py3-none-any.whl (419 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 420.0/420.0 kB 3.8 MB/s eta 0:00:00
Collecting xmlschema==1.7.1
  Using cached xmlschema-1.7.1-py3-none-any.whl (256 kB)
Collecting requests>=2.25.1
  Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting lxml>=4.6.2
  Downloading lxml-4.9.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (7.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.1/7.1 MB 11.4 MB/s eta 0:00:00
Collecting Jinja2>=2.11.3
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting spid_compliant_certificates>=0.5.3
  Downloading spid_compliant_certificates-0.5.4-py3-none-any.whl (36 kB)
Collecting elementpath<3.0.0,>=2.2.2
  Using cached elementpath-2.5.3-py3-none-any.whl (181 kB)
Collecting MarkupSafe>=2.0
  Using cached MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting defusedxml
  Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting cryptography>=3.1
  Downloading cryptography-39.0.2-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 11.3 MB/s eta 0:00:00
Collecting python-dateutil
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pytz
  Using cached pytz-2022.7.1-py2.py3-none-any.whl (499 kB)
Collecting pyopenssl
  Using cached pyOpenSSL-23.0.0-py3-none-any.whl (57 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.9/140.9 kB 13.6 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.3/199.3 kB 13.6 MB/s eta 0:00:00
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting ruamel.yaml==0.17.19
  Using cached ruamel.yaml-0.17.19-py3-none-any.whl (109 kB)
Collecting packaging==21.2
  Using cached packaging-21.2-py3-none-any.whl (40 kB)
Collecting iso3166==2.0.2
  Using cached iso3166-2.0.2-py3-none-any.whl (8.5 kB)
Collecting pyparsing<3,>=2.0.2
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting ruamel.yaml.clib>=0.2.6
  Downloading ruamel.yaml.clib-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (485 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 485.6/485.6 kB 12.8 MB/s eta 0:00:00
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pytz, urllib3, six, ruamel.yaml.clib, pyparsing, pycparser, MarkupSafe, lxml, iso3166, idna, elementpath, defusedxml, charset-normalizer, certifi, xmlschema, ruamel.yaml, requests, python-dateutil, packaging, Jinja2, cffi, cryptography, spid_compliant_certificates, pyopenssl, pysaml2, spid-sp-test
  Running setup.py develop for spid-sp-test
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-3.1.0 cryptography-39.0.2 defusedxml-0.7.1 elementpath-2.5.3 idna-3.4 iso3166-2.0.2 lxml-4.9.2 packaging-21.2 pycparser-2.21 pyopenssl-23.0.0 pyparsing-2.4.7 pysaml2-7.4.1 python-dateutil-2.8.2 pytz-2022.7.1 requests-2.28.2 ruamel.yaml-0.17.19 ruamel.yaml.clib-0.2.7 six-1.16.0 spid-sp-test-1.2.13 spid_compliant_certificates-0.5.4 urllib3-1.26.15 xmlschema-1.7.1

and this is the pip list

pip list
Package                     Version   Editable project location
--------------------------- --------- ------------------------------------
certifi                     2022.12.7
cffi                        1.15.1
charset-normalizer          3.1.0
cryptography                39.0.2
defusedxml                  0.7.1
elementpath                 2.5.3
idna                        3.4
iso3166                     2.0.2
Jinja2                      3.1.2
lxml                        4.9.2
MarkupSafe                  2.1.2
packaging                   21.2
pip                         23.0.1
pycparser                   2.21
pyOpenSSL                   23.0.0
pyparsing                   2.4.7
pysaml2                     7.4.1
python-dateutil             2.8.2
pytz                        2022.7.1
requests                    2.28.2
ruamel.yaml                 0.17.19
ruamel.yaml.clib            0.2.7
setuptools                  67.3.3
six                         1.16.0
spid-compliant-certificates 0.5.4
spid-sp-test                1.2.13    /home/utente/DEV/DTD/Spid/spid_sp_test
urllib3                     1.26.15
wheel                       0.38.4
xmlschema                   1.7.1

```

@peppelinux
Copy link
Member

I have also re-started the CI online for double check (https://github.com/italia/spid-sp-test/actions/runs/4197673806/jobs/7791968403)

which version of python are you using?

@danielegiallonardo
Copy link
Author

This is the pip list command output

Package                Version
---------------------- -------------
argcomplete            2.1.1
attrs                  21.2.0
Automat                20.2.0
Babel                  2.8.0
bcrypt                 3.2.0
blinker                1.4
certifi                2020.6.20
chardet                4.0.0
click                  8.0.3
cloud-init             22.4.2
colorama               0.4.4
command-not-found      0.3
configobj              5.0.6
constantly             15.1.0
cryptography           3.4.8
dbus-python            1.2.18
distlib                0.3.4
distro                 1.[7](https://github.com/italia/spid-aspnetcore/actions/runs/4439735758/jobs/7792609936#step:13:8).0
distro-info            1.1build1
filelock               3.6.0
httplib2               0.20.2
hyperlink              21.0.0
idna                   3.3
importlib-metadata     4.6.4
incremental            21.3.0
jeepney                0.7.1
Jinja2                 3.0.3
jsonpatch              1.32
jsonpointer            2.0
jsonschema             3.2.0
keyring                23.5.0
launchpadlib           1.10.16
lazr.restfulclient     0.14.4
lazr.uri               1.0.6
MarkupSafe             2.0.1
mercurial              6.1.1
more-itertools         [8](https://github.com/italia/spid-aspnetcore/actions/runs/4439735758/jobs/7792609936#step:13:9).10.0
netifaces              0.11.0
oauthlib               3.2.0
packaging              23.0
pexpect                4.8.0
pip                    22.0.2
pipx                   1.2.0
platformdirs           2.5.1
ptyprocess             0.7.0
pyasn1                 0.4.8
pyasn1-modules         0.2.1
Pygments               2.11.2
PyGObject              3.42.1
PyHamcrest             2.0.2
PyJWT                  2.3.0
pyOpenSSL              21.0.0
pyparsing              2.4.7
pyparted               3.11.7
pyrsistent             0.18.1
pyserial               3.5
python-apt             2.4.0+ubuntu1
python-debian          0.1.43ubuntu1
python-magic           0.4.24
pytz                   2022.1
PyYAML                 5.4.1
requests               2.25.1
SecretStorage          3.3.1
service-identity       18.1.0
setuptools             5[9](https://github.com/italia/spid-aspnetcore/actions/runs/4439735758/jobs/7792609936#step:13:10).6.0
six                    1.16.0
sos                    4.4
ssh-import-id          5.[11](https://github.com/italia/spid-aspnetcore/actions/runs/4439735758/jobs/7792609936#step:13:12)
systemd-python         234
Twisted                22.1.0
ubuntu-advantage-tools 8001
ufw                    0.36.1
urllib3                1.26.5
userpath               1.8.0
virtualenv             20.[13](https://github.com/italia/spid-aspnetcore/actions/runs/4439735758/jobs/7792609936#step:13:14).0+ds
wadllib                1.3.6
WALinuxAgent           2.2.46
wheel                  0.[37](https://github.com/italia/spid-aspnetcore/actions/runs/4439735758/jobs/7792609936#step:13:38).1
zipp                   1.0.0
zope.interface         5.4.0

This is the output of the install command

pip install spid-sp-test --upgrade --no-cache
  
Defaulting to user installation because normal site-packages is not writeable
Collecting spid-sp-test
  Downloading spid_sp_test-1.2.13-py3-none-any.whl (2.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 1[6](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:6).0 MB/s eta 0:00:00
Collecting spid-compliant-certificates>=0.5.3
  Downloading spid_compliant_certificates-0.5.4-py3-none-any.whl (3[6](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:7) kB)
Collecting xmlschema==1.[7](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:8).1
  Downloading xmlschema-1.7.1-py3-none-any.whl (256 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 256.0/256.0 KB 35.1 MB/s eta 0:00:00
Collecting lxml>=4.6.2
  Downloading lxml-4.9.2-cp310-cp310-manylinux_2_17_x[8](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:9)6_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (7.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.1/7.1 MB 5[9](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:10).7 MB/s eta 0:00:00
Collecting pysaml2>=6.5.1
  Downloading pysaml2-7.4.1-py3-none-any.whl (419 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 420.0/420.0 KB 319.8 MB/s eta 0:00:00
Requirement already satisfied: requests>=2.25.1 in /usr/lib/python3/dist-packages (from spid-sp-test) (2.25.1)
Requirement already satisfied: Jinja2>=2.11.3 in /usr/lib/python3/dist-packages (from spid-sp-test) (3.0.3)
Collecting elementpath<3.0.0,>=2.2.2
  Downloading elementpath-2.5.3-py3-none-any.whl (181 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.4/181.4 KB 351.9 MB/s eta 0:00:00
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from pysaml2>=6.5.1->spid-sp-test) (2022.1)
Collecting defusedxml
  Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Requirement already satisfied: cryptography>=3.1 in /usr/lib/python3/dist-packages (from pysaml2>=6.5.1->spid-sp-test) (3.4.8)
Requirement already satisfied: pyopenssl in /usr/lib/python3/dist-packages (from pysaml2>=6.5.1->spid-sp-test) (21.0.0)
Collecting python-dateutil
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 336.4 MB/s eta 0:00:00
Collecting iso3166==2.0.2
  Downloading iso3166-2.0.2-py3-none-any.whl (8.5 kB)
Collecting requests>=2.25.1
  Downloading requests-2.28.2-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 KB 288.6 MB/s eta 0:00:00
Collecting cryptography>=3.1
  Downloading cryptography-39.0.2-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB [10](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:11)3.2 MB/s eta 0:00:00
Collecting packaging==21.2
  Downloading packaging-21.2-py3-none-any.whl (40 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.7/40.7 KB 237.7 MB/s eta 0:00:00
Collecting ruamel.yaml==0.17.19
  Downloading ruamel.yaml-0.17.19-py3-none-any.whl (109 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 KB 321.3 MB/s eta 0:00:00
Requirement already satisfied: pyparsing<3,>=2.0.2 in /usr/lib/python3/dist-packages (from packaging==21.2->spid-compliant-certificates>=0.5.3->spid-sp-test) (2.4.7)
Collecting ruamel.yaml.clib>=0.2.6
  Downloading ruamel.yaml.clib-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (485 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 485.6/485.6 KB 354.4 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.3/199.3 KB 335.7 MB/s eta 0:00:00
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests>=2.25.1->spid-sp-test) (1.26.5)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests>=2.25.1->spid-sp-test) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.25.1->spid-sp-test) (2020.6.20)
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 441.8/441.8 KB 358.2 MB/s eta 0:00:00
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil->pysaml2>=6.5.1->spid-sp-test) (1.16.0)
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl ([11](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:12)8 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 KB 321.0 MB/s eta 0:00:00
Installing collected packages: ruamel.yaml.clib, python-dateutil, pycparser, packaging, lxml, iso3166, elementpath, defusedxml, charset-normalizer, xmlschema, ruamel.yaml, requests, cffi, cryptography, spid-compliant-certificates, pysaml2, spid-sp-test
Successfully installed cffi-1.15.1 charset-normalizer-3.1.0 cryptography-39.0.2 defusedxml-0.7.1 elementpath-2.5.3 iso3166-2.0.2 lxml-4.9.2 packaging-21.2 pycparser-2.21 pysaml2-7.4.1 python-dateutil-2.8.2 requests-2.28.2 ruamel.yaml-0.17.19 ruamel.yaml.clib-0.2.7 spid-compliant-certificates-0.5.4 spid-sp-test-1.2.[13](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:14:14) xmlschema-1.7.1

This is the output of the virtualenv command:

virtualenv -p python3 env
  
created virtual environment CPython3.10.[6](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:11:6).final.0-[6](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:11:7)4 in 66[7](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:11:8)ms
  creator CPython3Posix(dest=/home/runner/work/spid-aspnetcore/spid-aspnetcore/env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/runner/.local/share/virtualenv)
    added seed packages: pip==22.0.2, setuptools==5[9](https://github.com/italia/spid-aspnetcore/actions/runs/4439867920/jobs/7792915665#step:11:10).6.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

@peppelinux
Copy link
Member

By my side: not reproducible locally and neither in github actions CI
I'll try to reach you on slack dev italia

@peppelinux
Copy link
Member

@danielegiallonardo do you have news on this?
did you tried the docker image?

@danielegiallonardo
Copy link
Author

HI,
as reported on this link, I just installed the cryptography dependency as follows:
pip install cryptography==38.0.4
and it works.
Anyway, that sounds like a temporary fix to me, the broken dependency issue should be addressed.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants