I have this plugin which I want to install, but somehow the installation always breaks due to the error:
urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)>
So I think the problem is maybe that the SSL version is too old, so I printed the version information out:
OpenSSL 0.9.8zh 14 Jan 2016
And after seeing some answers,enter link description here, enter link description here, enter link description here now I have the newest SSL on my mac, but it seems like this plugin is using some external python which is not installed on my disk, and this python always tries to use its own SSL. I found this python which blender uses, Show Package Contents -> Burrow down to Contents -> Resources -> 2.79 -> python, seems like it's python 3.5, and I have python 3.7 installed on the disk.
Here's the installation code of the plugin:
import bpy
import os
import addon_utils
from subprocess import call
from urllib.request import urlretrieve
from zipfile import ZipFile
from tempfile import TemporaryDirectory
from shutil import copytree,rmtree
from os.path import join
python_exec = bpy.app.binary_path_python
path_to_addons = bpy.utils.user_resource('SCRIPTS', "addons")
print('Install Pip')
try:
import pip
except:
rc = call([python_exec,"-m","ensurepip","--default-pip", "--upgrade"])
import pip
print('Download RD')
import ssl
print(ssl.OPENSSL_VERSION)
URL = "https://github.com/HBPNeurorobotics/BlenderRobotDesigner/archive/master.zip"
addon_dir = 'robot_designer_plugin'
zip_dir = "BlenderRobotDesigner-master"
print('Unzip RD')
with TemporaryDirectory() as tmp:
zip_file = join(tmp,"master.zip")
print(zip_file)
urlretrieve(URL,zip_file)
print('Downloaded!')
rc = call([python_exec,"-m","zipfile","-e",zip_file,tmp])
with ZipFile(zip_file, "r") as z:
z.extractall(tmp)
print('Unzip finished')
addon_dir_src = join(tmp,zip_dir,addon_dir)
addon_dir_dst = join(path_to_addons,addon_dir)
print('remove previous addon')
rmtree(addon_dir_dst,True)
print('add latest addon')
copytree(addon_dir_src,addon_dir_dst)
print('enable addon')
addon_utils.enable("robot_designer_plugin", persistent=True)
bpy.ops.wm.save_userpref()
with open(join(addon_dir_src,"requirements.txt")) as f:
for line in f:
rc = call([python_exec,"-m","pip","install",line])
#pip.main(['install', line])
print('RD Installation Done!')
Und this is the error raised in the terminal:
Install Pip
Download RD
OpenSSL 0.9.8zh 14 Jan 2016
Unzip RD
/var/folders/nm/9nfcg98x4hxf1kh08dj8p92h0000gn/T/tmpvd4k0lfi/master.zip
Traceback (most recent call last):
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 1254, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1107, in request
self._send_request(method, url, body, headers)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1152, in _send_request
self.endheaders(body)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1103, in endheaders
self._send_output(message_body)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1261, in connect
server_hostname=server_hostname)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 385, in wrap_socket
_context=self)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 760, in __init__
self.do_handshake()
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 996, in do_handshake
self._sslobj.do_handshake()
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 641, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/gaoyingqiang/Downloads/installer.blend/Text", line 40, in <module>
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 188, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 1297, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 1256, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)>
Error: Python script fail, look in the console for now...
I really don't know where goes wrong since the plugin provides no further imformation on this issue. How can I fix this?
New edition:
I now want to solve the issue of how to upgrade the openssl version in the python which is in the Blender. Blender brings python3.5 with it and how can I brew install openssl
to this python but not the python on my disk?