1

I am on Kubuntu 18.10 with python 2.7.15 and 3.6.7 installed and output of lsb_release -a is

LSB Version:    core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.10
Release:        18.10
Codename:       cosmic

pip works on my machine since its for python 2.7 and output of pip -V is

pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

But typing pip3 gives segfault. The output is just Segmentation fault. Same output for pipenv. I have tried removing and installing python3-pip several times, deleted pip cache in /home/<username>/.cache. When i try to add any PPA using apt-add, i get this output

  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 380, in get_ppa_info
    ret = get_ppa_info_from_lp(user, ppa)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 110, in get_ppa_info_from_lp
    return get_info_from_lp(lp_url)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 104, in get_info_from_lp
    return get_info_from_https(lp_url, True)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 96, in get_info_from_https
    data = func(lp_url=url, accept_json=accept_json, retry_delays=retry_delays)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 139, in _get_https_content_py3
    cafile=LAUNCHPAD_PPA_CERT)
  File "/usr/lib/python3.6/urllib/request.py", line 210, in urlopen
    raise ValueError('SSL support not available')
ValueError: SSL support not available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 136, in <module>
    shortcut = shortcut_handler(line)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 1020, in shortcut_handler
    ret = factory(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 469, in shortcut_handler
    return PPAShortcutHandler(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 426, in __init__
    info = get_ppa_info(self.shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 392, in get_ppa_info
    _get_suggested_ppa_message(user, ppa))
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 349, in _get_suggested_ppa_message
    lp_user = get_info_from_lp(LAUNCHPAD_USER_API % user)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 104, in get_info_from_lp
    return get_info_from_https(lp_url, True)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 96, in get_info_from_https
    data = func(lp_url=url, accept_json=accept_json, retry_delays=retry_delays)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 139, in _get_https_content_py3
    cafile=LAUNCHPAD_PPA_CERT)
  File "/usr/lib/python3.6/urllib/request.py", line 210, in urlopen
    raise ValueError('SSL support not available')
ValueError: SSL support not available

Another symptom why i think there is an issue with ssl is that when i import ssl in python2 terminal, it works. But importing ssl in python 3.6 gives segfault

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Segmentation fault (core dumped)

UPDATE

When i import any other module before ssl, say hashlib, i get a different error

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/ssl.py", line 101, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: /usr/local/lib/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/lib/python3.6/lib-dynload/_ssl.cpython-36m-x86_64-linux-gnu.so)
  • Can you try reinstalling the libpython3.6-minimal package? This is supposed to provide the /usr/lib/python3.6/ssl.py file that seems to break the interpreter. – Byte Commander Apr 23 at 17:07
  • @ByteCommander, Yes, like sudo apt remove libpython3.6-minimal and then sudo apt install libpython3.6-minimal? When i try removing it with sudo apt remove libpython3.6-minimal, it shows a large number of packages that will be removed like apparmor, apport-kde, lots of libboost libs. Can it make the system unusable? – lovesh Apr 23 at 17:12
  • Don't remove it, that would indeed uninstall many other important things. sudo apt install --reinstall libpython3.6-minimal reinstalls the package without changing any dependencies. Should have mentioned that directly, sorry. – Byte Commander Apr 23 at 17:18
  • @ByteCommander No apologies please :). I tried that. Still same issue. – lovesh Apr 23 at 17:24
  • Can you paste this exact command and show the output? sudo dpkg -V | awk '$2!="c"{print $NF}' | xargs dpkg -S | grep -Ev 'diversion|, ' | grep -Po '.*(?=: )' | sort -u What this does is to let dpkg scan all files that belong to any installed package on your system and compare them to the respective hash that is stored with the package. That way it can find any changed or corrupted files. The rest of the line processes the output to give you back a list of the packages they belong to instead of the changed files themselves. – Byte Commander Apr 23 at 17:30
2

Removing existing openssl from /usr/bin/openssl and /usr/local/bin/openssl and reinstalling openssl using this answer fixed the issue. Before that i also tried the following as @ByteCommander suggested

sudo apt install --reinstall openssl
sudo apt install --reinstall code 
sudo apt install --reinstall python3-update-manager
  • Oh nice, you found a solution. /usr/local/bin/openssl looks like something that was manually installed outside the package manager (compiled from source maybe?). If both exist, the one in /usr/local/bin would take priority (PATH order), and if that is an incompatible or broken version, it can cause the issues in question. Good find :) – Byte Commander Apr 23 at 22:19
  • In my case, all of three install --reinstall and removing anything steps were not necessary; following askubuntu.com/a/1102966/14148 was quite enough for complete success. – Eugene Gr. Philippov Jun 29 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.