2

I'm trying to install a third party python package in a QGIS plugin with the following code:

import sys
import platform
import subprocess
try:
    import matplotlib
except ModuleNotFoundError:
    print('installing matplotlib')
    if platform.system() == 'Windows':
        subprocess.call([sys.exec_prefix + '/python', "-m", 'pip', 'install', 'matplotlib'])
    else:
        subprocess.call(['python3', '-m', 'pip', 'install', 'matplotlib'])

This code snipped have worked previously but with the new(?) OSGeo4W package it fails since the SSL module is not loaded? The error message looks like this:

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/matplotlib/

Is it a bug or some intended change?

2
  • Did you find an answer to this question?
    – TSJ
    Commented May 16, 2022 at 20:52
  • 1
    No, now I guide my users of the plugin to manually install instead :(
    – axel_ande
    Commented May 17, 2022 at 5:28

1 Answer 1

0

I was able to solve this, but I did a lot of things, and am not sure what all contributed to the solution. However, I think the following step is all you need to do.

Use the osgeo4w setup (advanced install, and in administrator mode) to install the openssl module. enter image description here I ran everything in the advanced installer that was on by default, but I think you could specify only the OpenSSL package.

2
  • Hi, no the openssl module did not solve it for me (I think it was installed by default, or it at least installed now but it doesn't work for me :( )
    – axel_ande
    Commented May 27, 2022 at 9:59
  • same for me, but I did with a non-admin user.
    – Abs_0_
    Commented Mar 20, 2023 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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