tensorflow gpu can not be called from jupyterhub/jupyter notebook, why?

徘徊边缘 提交于 2019-12-01 21:57:09

I got the solution from here:

[https://github.com/jupyter/notebook/issues/1290][1]

Basically, something was 'wrong' with jupyter in that it could not read my LD_LIBRARY_PATH variable. I did put everything correctly inside .bashrc so I don't know why.

Switch to the command line (terminal). Switch into your virtual environment if you have one.

type in: jupyter notebook --generate-config

It will tell you the directory in which your jupyter configuration file is stored. If you want to list it again type: jupyter --config-dir

Mine jupyter_notebook_config.py file is located here: /home/me/.jupyter/jupyter_notebook_config.py

At the very top of this file, jupyter_notebook_config.py, add in the following code:

import os
c = get_config()
os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda-8.0/lib64:usr/local/cuda-8.0/lib64/libcudart.so.8.0'
c.Spawner.env.update('LD_LIBRARY_PATH')

Then restart jupyterhub or jupyter notebook (type in at the command line: jupyter notebook

Tensorflow gpu should work.

The same thing applies even if you are running jupyterhub. Make the changes in jupyter, not jupyterhub. (Each user of jupyterhub will have their own jupyter process, so make the changes not at the 'hub' level, but the jupyter notebook level.

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