MATLAB Answers

Matlab can't find site-packages folder from Python environment.

7 views (last 30 days)
Ajpaezm
Ajpaezm on 16 Jan 2019
Hello guys,
I'd like to call 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 all the things I've done so far.
1) Created Virtual Environment with Anaconda and istalled all the dependencies I needed.
2) Ran the scripts using PyCharm and all runs good/as expected.
3) 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 this because I get this error:
py.importlib.import_module('numpy')
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 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 (a Python IDE), 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).
Can anyone here help me out please? Thanks in advance.

Answers (0)

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by