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?
-
Did you find an answer to this question?TSJ– TSJ2022年05月16日 20:52:34 +00:00Commented May 16, 2022 at 20:52
-
1No, now I guide my users of the plugin to manually install instead :(axel_ande– axel_ande2022年05月17日 05:28:39 +00:00Commented May 17, 2022 at 5:28
1 Answer 1
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.
-
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– axel_ande2022年05月27日 09:59:45 +00:00Commented May 27, 2022 at 9:59
-
same for me, but I did with a non-admin user.Abs_0_– Abs_0_2023年03月20日 19:32:23 +00:00Commented Mar 20, 2023 at 19:32