Every time I try to import a Python module from MATLAB (using py.importlib.import_module) it crashes. Sometimes the crash is immediate but other times it hangs for a while before crashing. Some modules seem to work, for example py.importlib.import_module('math') works fine, but py.importlib.import_module('random') causes a crash. I'm also unable to import custom modules.
This is the output of pyversion:
>> pyversion
version: '3.7'
executable: '/home/garden/anaconda3/bin/python3'
library: '/home/garden/anaconda3/lib/libpython3.7m.so'
home: '/home/garden/anaconda3'
isloaded: 0
Any ideas how to fix this?
I'm not sure if this is helpful but I've narrowed it down to a particular line that's causing a crash, line 244 in the hashlib module:
240 for __func_name in __always_supported:
241 # try them all, some may not work due to the OpenSSL
242 # version not supporting that algorithm.
243 try:
244 globals()[__func_name] = __get_hash(__func_name)
245 except ValueError:
246 import logging
247 logging.exception('code for hash %s was not found.', __func_name)