Matlab Linux Python: Numba causes Python Process to terminate unexpectedly

8 ビュー (過去 30 日間)
Daniel Ringel
Daniel Ringel 2020 年 12 月 17 日
回答済み: Rushikesh 2024 年 10 月 9 日
I am trying to import the python module "numba" (0.51.2) in Matlab 2020b (update 3 installed) running on Ubuntu 18.04 (Linux).
I set-up anaconda with basic modules installed (running Python 3.8.5)
pyenv('Version','/home/myusername/anaconda3/bin/python', "ExecutionMode","OutOfProcess")
I can then import a module such as numpy as follows:
py.importlib.import_module('numpy');
This works without any problems.
But when I try to import numba as follows, I get an error:
py.importlib.import_module('numba');
Error using py.importlib.import_module
Python process terminated unexpectedly. To restart the Python interpreter,
first call "terminate(pyenv)" and then call a Python function.
I checked my Python Environment Properties before trying to import numba:
PythonEnvironment with properties:
Version: "3.8"
Executable: "/home/myusername/anaconda3/bin/python"
Library: "/home/myusername/anaconda3/lib/libpython3.8.so"
Home: "/home/myusername/anaconda3"
Status: Loaded
ExecutionMode: OutOfProcess
ProcessID: "15165"
ProcessName: "MATLABPyHost"
Side note: All python modules are up to date. Numba is joinlty installed with llvmlite 0.32.1
MATLAB Version: 9.9.0.1538559 (R2020b) Update 3
Operating System: Linux 5.4.0-53-generic #59~18.04.1-Ubuntu SMP Wed Oct 21 12:14:56 UTC 2020 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

回答 (1 件)

Rushikesh
Rushikesh 2024 年 10 月 9 日
I understand that you are experiencing a "Python process terminated unexpectedly" error, which I couldn't reproduce on my system using MATLAB R2020b and Conda Python 3.8. In your case, this issue is most likely due to library dependency conflicts within your Conda environment.
Following steps will help you to resolve the issue.
1. Create a New Conda Environment: To avoid duplicate dependency errors, try installing your libraries in a fresh Conda environment. This can help isolate any conflicts in library dependencies that might be causing the issue.
2. Check the 'numba' Library: It's possible that the specific version of the numba library you're using has compatibility issues. Consider trying a different version of numba to see if that resolves the problem.

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by