I want to call Python modules or user-defined functions/scripts I built in python through Matlab. I'm aware of many of the things I need to cover before something like this is possible, I'll make a list of everything I've done so far.
- Created Virtual Environment with Anaconda and istalled all the dependencies I needed. Python version 3.5.2
- Ran the scripts using PyCharm and all runs good/as expected.
- When running
pyversion(mypath)
in Matlab, though it appears "loaded: 1", I can't call anything on the site-packages module. For example, I can't even call something like numpy (py.importlib.import_module('numpy')
) because I get the following error:
Python Error: ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try
git clean -xdf
(removes all files not under version control). Otherwise reinstall numpy. Original error was: DLL load failed: The specified module could not be found.
I've verified everything I could so far. Python and Matlab (2016a) are both 64 bits. Although, I can run this small snippet of code with the expected outcome:
T = 'MATLAB(R) is a high-level language'
wrapped = py.textwrap.wrap(T);
whos wrapped
Since I can execute everything properly from PyCharm, and I can't from Matlab's side, I'm wondering if there's any restriction to enable from Matlab or Anaconda (in the configuration).
Is there a setting in the configuration of Anaconda that is maybe not allowing me to do this? Or is this an issue within Matlab? I'm not sure, I'm clueless.