Problems with python3-urllib3 in snap

I’m currently running in a very strange problem. I’m packaging a python-based software (Pymol) which can download files from the internet.

When i try to download a file in the program the following exception is thrown:

PyMOL>fetch 1abi
Traceback (most recent call last):
  File "/snap/pymol-oss/x5/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 654, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/snap/pymol-oss/x5/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 274, in _get_conn
    return conn or self._new_conn()
  File "/snap/pymol-oss/x5/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 965, in _new_conn
    raise SSLError(
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

What is happening there? Why does the python installation in the snap cannot use SSL-connections?

You are probably missing the python3-openssl package which should be added to stage-packages.

Nope. That doesn’t help.

It seems that somehow the SSL-installation is broken in my snap-package. But i cannot figure out why. Maybe Python cannot find the SSL-libs in the snap.

After months of trying i’ve found the solution for me problem:

I’ve always included the “python”-Runtime (package “python-minimal”) in my snap. Including it has broken the “python3-urllib3” respectively the SSL-dependencies of Python3.

After removing “python3-minimal” from “stage-packages” my snap-package works now perfectly again.

Here is the link to the working YAML-file:

1 Like