PyTorch Compatibility Issue with MATLAB Engine

15 ビュー (過去 30 日間)
Kevin Chu
Kevin Chu 2020 年 12 月 17 日
コメント済み: Yushi Liu 2021 年 2 月 4 日
I'm trying to use MATLAB Engine to extract features for a PyTorch model, but I'm receiving the following error.
File "xxxx", line 22, in <module>
import torch
File "/home/lab/anaconda3/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: /usr/local/MATLAB/R2019b/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /home/lab/anaconda3/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
Interestingly, the error occurs on the line where I try to import PyTorch, not where I import MATLAB Engine. I was previously able to import PyTorch prior to installing MATLAB Runtime. I'm running Ubuntu 16.04.
Any ideas on what I'm doing wrong?

採用された回答

Kevin Chu
Kevin Chu 2020 年 12 月 31 日
It turns out that this was not a MATLAB-specific issue, but rather an issue with PyTorch. I upgraded the CUDA version but did not re-install PyTorch. I solved this problem by upgrading to a newer version of PyTorch.
  1 件のコメント
Yushi Liu
Yushi Liu 2021 年 2 月 4 日
Upgrading torch did not work for me.
I solved the issue by switching the order of imports, i.e., importing torch first gives me errors but importing matlab.engine prior to importing torch worked without errors.
Kevin, do you want to help us with this? Switch the order of imports, and see if you can import the two in both order, with the latest torch release. Thanks in advance.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by