内部错误:anaconda3中的cudaGetDevice()失败

时间:2018-11-21 10:37:44

标签: python tensorflow

我知道有很多类似的问题,但是他们无法解决我的问题。

在anaconda3中运行tensorflow代码时收到错误消息:

我的环境:

操作系统:Windows 10

GPU:NVIDIA GeForce 940MX

CPU:Intel Core i7

工具:Anaconda 3

Jupiter Notebook:Anaconda中包含5.6.0

TensorFlow:Anaconda UI中安装了基于tensorflow的1.12

Cuda:Anaconda UI中安装了Cudatoolkit 9.0

错误信息

    ERROR:tensorflow:==================================
    Object was never used (type <class 'tensorflow.python.framework.ops.Operation'>):
    <tf.Operation 'init' type=NoOp>
    If you want to mark it as used call its "mark_used()" method.
    It was originally created here:
      File "C:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)  File "C:\anaconda3\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)  File "C:\anaconda3\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
        app.launch_new_instance()  File "C:\anaconda3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
        app.start()  File "C:\anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 499, in start
        self.io_loop.start()  File "C:\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 132, in start
        self.asyncio_loop.run_forever()  File "C:\anaconda3\lib\asyncio\base_events.py", line 422, in run_forever
        self._run_once()  File "C:\anaconda3\lib\asyncio\base_events.py", line 1435, in _run_once
        handle = None  # Needed to break cycles when an exception occurs.  File "C:\anaconda3\lib\asyncio\events.py", line 157, in _run
        self = None  # Needed to break cycles when an exception occurs.  File "C:\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 122, in _handle_events
        handler_func(fileobj, events)  File "C:\anaconda3\lib\site-packages\tornado\stack_context.py", line 302, in null_wrapper
        _state.contexts = current_state  File "C:\anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 463, in _handle_events
        raise  File "C:\anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv
        self._run_callback(callback, msg)  File "C:\anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 438, in _run_callback
        raise  File "C:\anaconda3\lib\site-packages\tornado\stack_context.py", line 302, in null_wrapper
        _state.contexts = current_state  File "C:\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
        return self.dispatch_shell(stream, msg)  File "C:\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 241, in dispatch_shell
        self._publish_status(u'idle')  File "C:\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 421, in execute_request
        self._abort_queues()  File "C:\anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 258, in do_execute
        return reply_content  File "C:\anaconda3\lib\site-packages\ipykernel\zmqshell.py", line 537, in run_cell
        return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)  File "C:\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2667, in run_cell
        return result  File "C:\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2801, in _run_cell
        return result  File "C:\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2902, in run_ast_nodes
        return True  File "C:\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2981, in run_code
        return outflag  File "<ipython-input-19-06b55504a78f>", line 22, in <module>
        init = tf.initialize_all_variables()  File "C:\anaconda3\lib\site-packages\tensorflow\python\util\tf_should_use.py", line 189, in wrapped
        return _add_should_use_warning(fn(*args, **kwargs))
    ==================================
    ---------------------------------------------------------------------------
    InternalError                             Traceback (most recent call last)
    <ipython-input-20-7104265d1e89> in <module>()
         21 
         22 init = tf.global_variables_initializer()
    ---> 23 with tf.Session() as sess:
         24     sess.run(init)
         25 

    C:\anaconda3\lib\site-packages\tensorflow\python\client\session.py in __init__(self, target, graph, config)
       1549 
       1550     """
    -> 1551     super(Session, self).__init__(target, graph, config=config)
       1552     # NOTE(mrry): Create these on first `__enter__` to avoid a reference cycle.
       1553     self._default_graph_context_manager = None

    C:\anaconda3\lib\site-packages\tensorflow\python\client\session.py in __init__(self, target, graph, config)
        674     try:
        675       # pylint: disable=protected-access
    --> 676       self._session = tf_session.TF_NewSessionRef(self._graph._c_graph, opts)
        677       # pylint: enable=protected-access
        678     finally:

    InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version

0 个答案:

没有答案