Error loading Python Module with Tensorflow
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to load a python module with tensorflow into matlab but always result crashing. When I load tensorflow in Python it works. When I load other module like cv2 into matlab it also works. But when I load python module tensorflow directly into matlab it crashes all the time. Does anyone have any suggestion? I'm using Windows10, MATLAB R2017b. Thanks!
My Attempts: (1) I tried to open matlab from command line doesn't work. (2) I tried to Use Python 3.6 still doesn't work.
============================= Matlab Code =====================================
>> pyversion
version: '3.5'
executable: 'C:\Program Files\Anaconda3\python.exe'
library: 'C:\Program Files\Anaconda3\python35.dll'
home: 'C:\Program Files\Anaconda3'
isloaded: 0
>> py.importlib.import_module('tensorflow')
=============================Below is the the Trace=====================================
------------------------------------------------------------------------ Access violation detected at Wed Oct 17 10:46:59 2018 ------------------------------------------------------------------------
Configuration: Crash Decoding : Disabled - No sandbox or build area path Crash Mode : continue (default) Current Graphics Driver: Unknown hardware Default Encoding : windows-1252 Deployed : false Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce GT 730 Version 21.21.13.7651 (2016-12-25) Host Name : ec-matlab2-ec MATLAB Architecture : win64 MATLAB Entitlement ID: 865653 MATLAB Root : C:\Program Files\MATLAB\R2017b MATLAB Version : 9.3.0.713579 (R2017b) OpenGL : hardware Operating System : Microsoft Windows 10 Enterprise Processor ID : x86 Family 6 Model 58 Stepping 9, GenuineIntel Virtual Machine : Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot™ 64-Bit Server VM mixed mode Window System : Version 10.0 (Build 15063)
Fault Count: 1
Abnormal termination: Access violation
Register State (from fault): RAX = 0000000000000000 RBX = 0000000000000000 RCX = 0300005a03000059 RDX = 0000000000000000 RSP = 00000000043efdb8 RBP = 0000000031d883b8 RSI = 00000000c42cc810 RDI = 0000000031d769d8
R8 = 00007ffe4d8ee770 R9 = 0000000030ef0000
R10 = 000000003ac056a0 R11 = 00000000ec4c45d0
R12 = 00000000ec3785c0 R13 = 00007ffe4d8e5370
R14 = 00000000043efec8 R15 = 0000000000000000
RIP = 0000000000000000 EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault): [ 0] 0x0000000000000000 unknown-module+00000000 [ 1] 0x00007ffe4d8e540a C:\Program Files\Anaconda3\lib\site-packages\h5py\_conv.cp35-win_amd64.pyd+00021514 PyInit__conv+00007034 [ 2] 0x00007ffe4d8e5379 C:\Program Files\Anaconda3\lib\site-packages\h5py\_conv.cp35-win_amd64.pyd+00021369 PyInit__conv+00006889 [ 3] 0x0000000031079b77 C:\Program Files\Anaconda3\python35.dll+01612663 PyEval_GetFuncDesc+00000455 [ 4] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 5] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 6] 0x0000000031073858 C:\Program Files\Anaconda3\python35.dll+01587288 PyEval_EvalCode+00000056 [ 7] 0x000000003106f073 C:\Program Files\Anaconda3\python35.dll+01568883 PyAST_FromNode+00033331 [ 8] 0x000000003106d522 C:\Program Files\Anaconda3\python35.dll+01561890 PyAST_FromNode+00026338 [ 9] 0x0000000030ffe2c2 C:\Program Files\Anaconda3\python35.dll+01106626 PyCFunction_Call+00000290 [ 10] 0x000000003107a6fd C:\Program Files\Anaconda3\python35.dll+01615613 PyEval_GetFuncDesc+00003405 [ 11] 0x0000000031076b90 C:\Program Files\Anaconda3\python35.dll+01600400 PyEval_EvalFrameEx+00013088 [ 12] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 13] 0x0000000031079fb0 C:\Program Files\Anaconda3\python35.dll+01613744 PyEval_GetFuncDesc+00001536 [ 14] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 15] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 16] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 17] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 18] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 19] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 20] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 21] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 22] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 23] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 24] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 25] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 26] 0x0000000030fe84f1 C:\Program Files\Anaconda3\python35.dll+01017073 PyFunction_SetAnnotations+00002929 [ 27] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [ 28] 0x0000000030fb6508 C:\Program Files\Anaconda3\python35.dll+00812296 PyObject_CallMethodIdObjArgs+00000152 [ 29] 0x000000003109674d C:\Program Files\Anaconda3\python35.dll+01730381 PyImport_ImportModuleLevelObject+00001981 [ 30] 0x000000003106df9f C:\Program Files\Anaconda3\python35.dll+01564575 PyAST_FromNode+00029023 [ 31] 0x0000000030ffe1d0 C:\Program Files\Anaconda3\python35.dll+01106384 PyCFunction_Call+00000048 [ 32] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [ 33] 0x000000003107992c C:\Program Files\Anaconda3\python35.dll+01612076 PyEval_CallObjectWithKeywords+00000204 [ 34] 0x0000000031076168 C:\Program Files\Anaconda3\python35.dll+01597800 PyEval_EvalFrameEx+00010488 [ 35] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 36] 0x0000000031073858 C:\Program Files\Anaconda3\python35.dll+01587288 PyEval_EvalCode+00000056 [ 37] 0x000000003106f073 C:\Program Files\Anaconda3\python35.dll+01568883 PyAST_FromNode+00033331 [ 38] 0x000000003106d522 C:\Program Files\Anaconda3\python35.dll+01561890 PyAST_FromNode+00026338 [ 39] 0x0000000030ffe2c2 C:\Program Files\Anaconda3\python35.dll+01106626 PyCFunction_Call+00000290 [ 40] 0x000000003107a6fd C:\Program Files\Anaconda3\python35.dll+01615613 PyEval_GetFuncDesc+00003405 [ 41] 0x0000000031076b90 C:\Program Files\Anaconda3\python35.dll+01600400 PyEval_EvalFrameEx+00013088 [ 42] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 43] 0x0000000031079fb0 C:\Program Files\Anaconda3\python35.dll+01613744 PyEval_GetFuncDesc+00001536 [ 44] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 45] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 46] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 47] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 48] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 49] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 50] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 51] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 52] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 53] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 54] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 55] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 56] 0x0000000030fe84f1 C:\Program Files\Anaconda3\python35.dll+01017073 PyFunction_SetAnnotations+00002929 [ 57] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [ 58] 0x0000000030fb6508 C:\Program Files\Anaconda3\python35.dll+00812296 PyObject_CallMethodIdObjArgs+00000152 [ 59] 0x000000003109674d C:\Program Files\Anaconda3\python35.dll+01730381 PyImport_ImportModuleLevelObject+00001981 [ 60] 0x000000003106df9f C:\Program Files\Anaconda3\python35.dll+01564575 PyAST_FromNode+00029023 [ 61] 0x0000000030ffe1d0 C:\Program Files\Anaconda3\python35.dll+01106384 PyCFunction_Call+00000048 [ 62] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [ 63] 0x000000003107992c C:\Program Files\Anaconda3\python35.dll+01612076 PyEval_CallObjectWithKeywords+00000204 [ 64] 0x0000000031076168 C:\Program Files\Anaconda3\python35.dll+01597800 PyEval_EvalFrameEx+00010488 [ 65] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 66] 0x0000000031073858 C:\Program Files\Anaconda3\python35.dll+01587288 PyEval_EvalCode+00000056 [ 67] 0x000000003106f073 C:\Program Files\Anaconda3\python35.dll+01568883 PyAST_FromNode+00033331 [ 68] 0x000000003106d522 C:\Program Files\Anaconda3\python35.dll+01561890 PyAST_FromNode+00026338 [ 69] 0x0000000030ffe2c2 C:\Program Files\Anaconda3\python35.dll+01106626 PyCFunction_Call+00000290 [ 70] 0x000000003107a6fd C:\Program Files\Anaconda3\python35.dll+01615613 PyEval_GetFuncDesc+00003405 [ 71] 0x0000000031076b90 C:\Program Files\Anaconda3\python35.dll+01600400 PyEval_EvalFrameEx+00013088 [ 72] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 73] 0x0000000031079fb0 C:\Program Files\Anaconda3\python35.dll+01613744 PyEval_GetFuncDesc+00001536 [ 74] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 75] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 76] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 77] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 78] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 79] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 80] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 81] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 82] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 83] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 84] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 85] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 86] 0x0000000030fe84f1 C:\Program Files\Anaconda3\python35.dll+01017073 PyFunction_SetAnnotations+00002929 [ 87] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [ 88] 0x0000000030fb6508 C:\Program Files\Anaconda3\python35.dll+00812296 PyObject_CallMethodIdObjArgs+00000152 [ 89] 0x000000003109674d C:\Program Files\Anaconda3\python35.dll+01730381 PyImport_ImportModuleLevelObject+00001981 [ 90] 0x000000003106df9f C:\Program Files\Anaconda3\python35.dll+01564575 PyAST_FromNode+00029023 [ 91] 0x0000000030ffe1d0 C:\Program Files\Anaconda3\python35.dll+01106384 PyCFunction_Call+00000048 [ 92] 0x000000003107a6fd C:\Program Files\Anaconda3\python35.dll+01615613 PyEval_GetFuncDesc+00003405 [ 93] 0x0000000031076b90 C:\Program Files\Anaconda3\python35.dll+01600400 PyEval_EvalFrameEx+00013088 [ 94] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [ 95] 0x0000000031079fb0 C:\Program Files\Anaconda3\python35.dll+01613744 PyEval_GetFuncDesc+00001536 [ 96] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [ 97] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [ 98] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [ 99] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [100] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [101] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [102] 0x0000000030fe84f1 C:\Program Files\Anaconda3\python35.dll+01017073 PyFunction_SetAnnotations+00002929 [103] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [104] 0x0000000030fb6508 C:\Program Files\Anaconda3\python35.dll+00812296 PyObject_CallMethodIdObjArgs+00000152 [105] 0x000000003109674d C:\Program Files\Anaconda3\python35.dll+01730381 PyImport_ImportModuleLevelObject+00001981 [106] 0x000000003106df9f C:\Program Files\Anaconda3\python35.dll+01564575 PyAST_FromNode+00029023 [107] 0x0000000030ffe1d0 C:\Program Files\Anaconda3\python35.dll+01106384 PyCFunction_Call+00000048 [108] 0x0000000030fb5df8 C:\Program Files\Anaconda3\python35.dll+00810488 PyObject_Call+00000120 [109] 0x000000003107992c C:\Program Files\Anaconda3\python35.dll+01612076 PyEval_CallObjectWithKeywords+00000204 [110] 0x0000000031076168 C:\Program Files\Anaconda3\python35.dll+01597800 PyEval_EvalFrameEx+00010488 [111] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [112] 0x0000000031073858 C:\Program Files\Anaconda3\python35.dll+01587288 PyEval_EvalCode+00000056 [113] 0x000000003106f073 C:\Program Files\Anaconda3\python35.dll+01568883 PyAST_FromNode+00033331 [114] 0x000000003106d522 C:\Program Files\Anaconda3\python35.dll+01561890 PyAST_FromNode+00026338 [115] 0x0000000030ffe2c2 C:\Program Files\Anaconda3\python35.dll+01106626 PyCFunction_Call+00000290 [116] 0x000000003107a6fd C:\Program Files\Anaconda3\python35.dll+01615613 PyEval_GetFuncDesc+00003405 [117] 0x0000000031076b90 C:\Program Files\Anaconda3\python35.dll+01600400 PyEval_EvalFrameEx+00013088 [118] 0x00000000310789de C:\Program Files\Anaconda3\python35.dll+01608158 PyEval_EvalFrameEx+00020846 [119] 0x0000000031079fb0 C:\Program Files\Anaconda3\python35.dll+01613744 PyEval_GetFuncDesc+00001536 [120] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [121] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [122] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [123] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [124] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923 [125] 0x0000000031079f28 C:\Program Files\Anaconda3\python35.dll+01613608 PyEval_GetFuncDesc+00001400 [126] 0x0000000031079de1 C:\Program Files\Anaconda3\python35.dll+01613281 PyEval_GetFuncDesc+00001073 [127] 0x0000000031076aeb C:\Program Files\Anaconda3\python35.dll+01600235 PyEval_EvalFrameEx+00012923
If this problem is reproducible, please submit a Service Request via: http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.
0 个评论
回答(2 个)
FergusNie
2019-2-23
Hi, you guy. I also have this question in two times, these days and serval months ago. And right now, this question has been solved. So I will offer my solution here, and I hope it can help you if your problem is still not solved.
Serval months ago, when I first meet this question just exactly the same ac your, I have no idea of it indeed. But just a few days after that, some fault occurs with my disk, so I have to format my computer and reinstall the system. And after I reinstall MATLAB R2018b and Python 3.6.7, it is OK, and this peoblem never happens at all.
Just a days before I migrated code to server, after installing MATLAB R2018b and Tensorflow-gpu 1.4, this problem occured again. And during this process, I first installed tensorflow-gpu 1.12 and found this version is not be support by CUDA 8, so I uninstall it and reinstall tensorflow-gpu 1.4, and the problem occured. Just the moment I have no idea about that, I tried to uninstall the python virtual environment and reinstall tensorflow-gpu 1.4. And surpisely, it works.
So I guess the problem is that the patchs installed when installing tersorflow-gpu 1.12(including numpy, keras and so on) are not compatible with tensorflow-gpu 1.4, actually there is no problem with MATLAB, it is that the python patchs installed are messy. So I suggest unintall python and reinstall, I hope my solution will help you.
0 个评论
jiayi lee
2019-8-29
hi I also have this question 2,but I found this link https://zhuanlan.zhihu.com/p/74220623 also use MATLAB R2018b, is it possible only matlab2018b can call tensorflow directly?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!