Python-modules installation fails because of ssl error

Hi,
on ubuntu 20.04 I see after the recent move to Openssl 1.1 an error when installing the python modules:

++ python3 -m pip install -IU pip
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/

I tried to install ssl via pip manually, but this failed with the error:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-k0efjr4w/ssl_13d538801ed84594a09f90cf426fd12e/setup.py", line 33
          print 'looking for', f
                ^
      SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?
      Error in sys.excepthook:
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
          from apport.fileutils import likely_packaged, get_recent_crashes
        File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
          from apport.report import Report
        File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
          from urllib.request import urlopen
        File "/usr/lib/python3.8/urllib/request.py", line 88, in <module>
          import http.client
        File "/usr/lib/python3.8/http/client.py", line 1368, in <module>
          import ssl
        File "/tmp/pip-install-k0efjr4w/ssl_13d538801ed84594a09f90cf426fd12e/ssl/__init__.py", line 140
          except SSLError, x:
                         ^
      SyntaxError: invalid syntax

Has someone else stumbled upon this error and has a solution/workaround available?

Cheers,
Ole

Hi @oschmidt ,

Yes, it is also reported here:

and in mails.
In github, @eulisse suggested to try Use own python on ubuntu by ktf · Pull Request #4118 · alisw/alidist · GitHub, but @victor reported that it did not work for him

Cheers,

Chiara

Hi Chiara,

many thanks for the pointers! I remember now also David talking about it and suggesting as a workaround for building O2 locally to disable OpenSSL and curl to force the usage of the system libraries:

aliBuild build O2 --defaults o2 --disable curl --disable OpenSSL

Unfortunately, this triggers many rebuilds. And I ended up with the setuptools issue for the xjalienfs package. So this did not help me :frowning:

Cheers,
Ole

Hi @oschmidt and @zampolli,

new version of Use own python on ubuntu by ktf · Pull Request #4118 · alisw/alidist · GitHub seems to be working so far

Cheers,
Víctor.

Hi @victor

thanks a lot, with this it works for me as well. Just getting a warning now from xjalien, because of the older python 3.6.10 which is built by aliBuild now:

alien_ls /alice
/ssd0/oschmidt/alice/sw/ubuntu2004_x86-64/xjalienfs/1.3.7-local1/lib/python/site-packages/OpenSSL/crypto.py:8: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
  from cryptography import utils, x509

But it still works.

Cheers,
Ole

What is of course a bit annoying now is that with the OpenSSL loaded from aliBuild I have issues with git. So for doing a git push I have to unload the environment.

git push -f martenole HEAD:trdtracker
/usr/bin/ssh: symbol lookup error: /usr/bin/ssh: undefined symbol: EC_KEY_set_private_key, version OPENSSL_1_1_0
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

This should be fixed by Use OpenSSL from the system if > 1.0 by ktf · Pull Request #4179 · alisw/alidist · GitHub which should pick up OpenSSL from the system if recent enough. Can you check? I will merge it this weekend to reduce the chances of breaking stuff while people are working.