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

后端 未结 1 1750
悲&欢浪女
悲&欢浪女 2021-01-20 11:26

Well I figure eight hours is enough time trying to fix this on my own, so I\'ll just ask folks:

I am running tensorflow-gpu 1.1.0 just fine in my virtual environment

相关标签:
1条回答
  • 2021-01-20 11:56

    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.

    0 讨论(0)
提交回复
热议问题