MATLAB Answers

How can I call a python function which imports cvxopt in Matlab in Windows?

5 views (last 30 days)
Kaixuan Chen
Kaixuan Chen on 11 Jan 2020
Answered: Shrinidhi KR on 8 May 2020
I am trying to use a python function which imports cvxopt module in Matlab. My computer is based on Win10.
When the cvxopt module is not imported, the Matlab can call the python funtion well using py.command. However, such error happens when the cvxopt is imported in python function:
error using __init__><module> (line 50)
Python error ImportError: DLL load failed: can not find the module
error <frozen importlib>_call_with_frames_removed (line 219)
error <frozen importlib>exec_module (line 678)
error <frozen importlib>_load_unlocked (line 665)
error <frozen importlib>_find_and_load_unlocked (line 955)
error <frozen importlib>_find_and_load (line 971)
error <frozen importlib>_gcd_import (line 994)
error __init__>import_module (line 126)
return _bootstrap._gcd_import(name[level:], package, level)
Can anyone help me? Thank you so much

  0 Comments

Sign in to comment.

Answers (1)

Shrinidhi KR
Shrinidhi KR on 8 May 2020
There seems to be an issue with the python cvxopt library itself and the issues is not arising from matlab end. As it gives error when I tried to import it normally in python script as well. I got the following error:
>>> import cvxopt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\XXXX\AppData\Local\Programs\Python\Python36\lib\site-packages\cvxopt\__init__.py", line 50, in <module>
import cvxopt.base
ImportError: DLL load failed: The specified module could not be found.
Verify if you are able to successfully import cvxopt in python at your end before using it in matlab. If it works fine in python end then it should get imported properly in matlab as well.
This issue is also mentioned in following links: https://github.com/cvxopt/cvxopt/issues/127
Hope this helps!

  0 Comments

Sign in to comment.

Products


Release

R2019a