QGIS: SSLError, A failure in the SSL library occured

Hello Evryone,
I’m facing same probleme I have intaled the pyhton libraries as indicated in privious reply but still the issue any help suggestion thanks

Hi @Nomade_House ! Once you open the plugin, do you see a warning message (a blue popup) suggesting to resolve dependencies for Speckle plugin?

If not, could you go to Plugins-> Python Console and type this:

import requests, urllib3; print(requests.__version__); print(urllib3.__version__)

and see what versions of this libraries are installed?

Hi Kateryna,
I couldn’t upgrade the urllib3 any help?

Try to run the command in the QGIS native Python console instead (Plugins-> Python Console) and share the output please (I edited a typo in the command):


If you don’t see the blue warning when you open the plugin (it should offer you to automatically update the libraries), please run the following command in the same Python console after checking the versions:

def upgradeDependencies():
    import subprocess
    from speckle.utils.utils import get_qgis_python_path as path
    result = subprocess.run([path(), "-m", "pip", "install", "requests==2.31.0"],capture_output=True,timeout=1000,)
    print(result.returncode)
    result = subprocess.run([path(), "-m", "pip", "install", "urllib3==1.26.16"],capture_output=True,timeout=1000,)
    print(result.returncode)
    result = subprocess.run([path(), "-m", "pip", "install", "requests_toolbelt==0.10.1"],capture_output=True,timeout=1000,)
    print(result.returncode)


and then:

upgradeDependencies()

If there are no errors, the libraries should be updated and will work after restarting QGIS :pray:

Hi Kateryna,
Thank you


I stii have the same problem
I don’t know why the urllib3 wont upgrade
Is there any tutorial ?

Would you mind sharing any screenshots of your QGIS Python console after typing the commands I shared? Then we can understand exactly what is going wrong :pray:

Command#1:

import requests, urllib3; print(requests.__version__); print(urllib3.__version__)

Command#2:

def upgradeDependencies():
    import subprocess
    from speckle.utils.utils import get_qgis_python_path as path
    result = subprocess.run([path(), "-m", "pip", "install", "requests==2.31.0"],capture_output=True,timeout=1000,)
    print(result.returncode)
    result = subprocess.run([path(), "-m", "pip", "install", "urllib3==1.26.16"],capture_output=True,timeout=1000,)
    print(result.returncode)
    result = subprocess.run([path(), "-m", "pip", "install", "requests_toolbelt==0.10.1"],capture_output=True,timeout=1000,)
    print(result.returncode)


Command#3:

upgradeDependencies()

Thanks!

Thank you!
I am seeing 2 things that are causing the problem:

  1. The first command has a typo: there should be a comma between “requests” and “urllib3” (my bad)
  2. After command 2 press Enter (maybe even couple times), so the command will exit the function. And only then place the 3rd command

Thanks Kateryna,


I think that my urllib3 is not upgraded


How can I upgrade those two I still have the 1.25?

Please click Enter before “upgradeDependencies()” command. You will see “>>>” symbol in the beginning of the line, which means you have actually placed a line break (see the screenshot above). Only then enter “upgradeDependencies()”.

You will see 0 0 0 as response. Then restart QGIS🙃

P.S. the installed versions will not necessarily be in the folder you showed, depending on your user permissions.

Thanks Kateryna,
I see the 0 0 0 as response and I have restarted QGIS still having the same issue


Moving this to a separate topic, as the cause of the issue is different than in the previous topic with “Transport is already connected” error. Will investigate further :ok_hand:

Meanwhile, could you pls let me know your OS, QGIS version and whether you have updated any Python libraries on your own? Also, which QGIS installer have you used? From a very quick search I found that in some older versions it was the installer that could be a reason for SSLError (e.g. here)

Thanks Kateryna,
I’m using this version

But in the folder site-packages I have deleted the two folder that you mention and I don’t know how to upgrade to the new verrsion urllib3.

Thanks for the update! May I ask again, which installer did you use for QGIS? (you can share a link where you downloaded the QGIS installer)

P.S. Your libraries are already upgraded as I can see from one of your screenshots, they might be just stored in a different folder, you don’t need to worry about them. If I were you, I would reinstall QGIS, because it is not recommended to delete anything from site-packages manually.

Yes I have reinstalled QGIS, dowload from here Télécharger QGIS.

1 Like

Hey,
I had this problem with SSL certificates too.
However, in my case I didn’t actually get any error message, which made it a bit more complicated to figure out what actually was the issue. In the end I figured out that the SSL certificates were the problem because of running an adaptation of the script provided by Kateryna in this post

Python script with error traceback I adapted Kateryna's script to also print the traceback of an error in case it occured:
import traceback
import specklepy
from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import get_local_accounts

query = ""
speckle_accounts = get_local_accounts()
for i, acc in enumerate(speckle_accounts):
    try:
        print(acc)
        print(acc.token)
        speckle_client = SpeckleClient(acc.serverInfo.url, acc.serverInfo.url.startswith("https"))
        speckle_client.authenticate_with_token(token=acc.token)
        streams = speckle_client.stream.search(query)
        for stream in streams:
            print(stream)
        
    except Exception:
        print(traceback.format_exc())
        pass
    
    print("")

print("done")

In order to solve the SSL errors I

  1. Opened the OSGeo4W Shell
  2. Ran pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pip_system_certs

This installs pip_system_certs, which pip, and I guess Python too, to use the system’s SSL certificates instead of its own bundled ones. This resolved my SSL certificate issues with the QGIS connector.

4 Likes