eclipse+pydev can't find cuda library for tensorflow

血红的双手。 提交于 2019-12-25 07:57:01

问题


I am trying to debug some computer vision code (say dcgan) built on top of tensorflow. I installed the tf_0.10 in virtualenv (say, py1) and I use eclipse+pydev as the IDE. The problem is that the debugger can't find the cuda library so I get the error like the following,

ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory

On the other hand, the code works correctly on ubuntu command line and py1 in the virtualenv has no problem finding the cuda library.

In my eclipse+pydev setup, I set a py intepreter as py1, by setting eclipse menu->window->preference->intepreters->python intepreter as

/home/zyuan/tensorflowr010/bin/python2.7 (where /home/zyuan/tensorflowr010 is the root of virtualenv)

Also the system PYTHONPATH for the above intepreter is,

/home/zyuan/tensorflowr010/lib/python2.7
/home/zyuan/tensorflowr010/lib/python2.7/lib-dynload
/home/zyuan/tensorflowr010/local/lib/python2.7/site-packages
/home/zyuan/tensorflowr010/lib/python2.7/site-packages
/home/zyuan/tensorflowr010/lib

Then I chose py1 and the intepreter for my computer vision code dcgan,

by setting dcgan -> properities -> pyDev-interpreter/grammer as py1 and add >external Librarie /usr/local/cuda/lib64 on pyDev-PYTHONPATH

Do I miss anything else?


回答1:


Can you run it from the command line? If not, that'd be the first step, if you already can, my suggestion is starting Eclipse from that same shell and then checking if all environment variables when you launch it match the ones from the shell.

As a note, the PYTHONPATH is a special variable in PyDev made up from the files you add in the interpreter and in source folders in projects, so, to check the PYTHONPATH my suggestion is creating a program with:

import sys
print('\n'.join(sorted(sys.path)))

and run that from the command line and from inside Eclipse to compare what may be different (and fix the configuration on PyDev accordingly).

Also, after it works in the command-line, it may be nice launching Eclipse from that same shell (so that it will inherit all the env vars you defined in that shell, which may save you time from having to check many other env vars which may be important too).



来源:https://stackoverflow.com/questions/42987112/eclipsepydev-cant-find-cuda-library-for-tensorflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!