Failed to load the native TensorFlow runtime : error while importing tensorflow ——问题解决

版权声明:转载请标注来源 https://blog.csdn.net/hehedadaq/article/details/81982371

转载链接:
https://github.com/tensorflow/tensorflow/issues/10026

主要内容是:

conda install -c https://conda.anaconda.org/jjhelmus tensorflow

很明显,第一次还是失败了,本来以为可以一键配置完cuda和cudnn以及tensorflow_gpu,发现我还是想多了~
报错信息:

conda install -c https://conda.anaconda.org/jjhelmus tensorflow
Fetching package metadata .................
Solving package specifications: .

Package plan for installation in environment /home/lyl/anaconda3/envs/gtf:

The following NEW packages will be INSTALLED:

    bleach:         1.5.0-py35_0     https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    cudatoolkit:    7.5-2            https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    cudnn:          5.1-0            https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    html5lib:       0.9999999-py35_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    tensorflow:     0.12.0rc0-py35_0 jjhelmus                                               

The following packages will be SUPERCEDED by a higher-priority channel:

    protobuf:       3.4.0-py35_0     https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free --> 3.1.0-py35_0         jjhelmus                                               
    tensorboard:    1.8.0-py35_0     aaronzs                                                 --> 1.7.0-py35hf484d3e_1 jjhelmus                                               
    tensorflow-gpu: 1.8.0-py35_0     aaronzs                                                 --> 1.0.1-py35_4         https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

Proceed ([y]/n)? y

cudatoolkit-7. 100% |####################################################################| Time: 0:00:27   8.83 MB/s
cudnn-5.1-0.ta 100% |####################################################################| Time: 0:00:09   8.23 MB/s
html5lib-0.999 100% |####################################################################| Time: 0:00:00   8.85 MB/s
bleach-1.5.0-p 100% |####################################################################| Time: 0:00:00  14.92 MB/s
protobuf-3.1.0 100% |####################################################################| Time: 0:01:06 108.88 kB/s
tensorboard-1. 100% |####################################################################| Time: 0:00:13 233.29 kB/s
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

    https://github.com/conda/conda/issues



Current conda install:

               platform : linux-64
          conda version : 4.3.8
       conda is private : False
      conda-env version : 4.3.8
    conda-build version : not installed
         python version : 3.6.0.final.0
       requests version : 2.12.4
       root environment : /home/lyl/anaconda3  (writable)
    default environment : /home/lyl/anaconda3/envs/gtf
       envs directories : /home/lyl/anaconda3/envs
          package cache : /home/lyl/anaconda3/pkgs
           channel URLs : https://conda.anaconda.org/jjhelmus/linux-64
                          https://conda.anaconda.org/jjhelmus/noarch
                          https://conda.anaconda.org/anaconda-fusion/linux-64
                          https://conda.anaconda.org/anaconda-fusion/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /home/lyl/.condarc
           offline mode : False
             user-agent : conda/4.3.8 requests/2.12.4 CPython/3.6.0 Linux/4.15.0-32-generic debian/stretch/sid glibc/2.23
                UID:GID : 1000:1000



`$ /home/lyl/anaconda3/envs/gtf/bin/conda install -c https://conda.anaconda.org/jjhelmus tensorflow`




    Traceback (most recent call last):
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 138, in _new_conn
        (self.host, self.port), self.timeout, **extra_kw)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py", line 98, in create_connection
        raise err
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py", line 88, in create_connection
        sock.connect(sa)
    socket.timeout: timed out

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
        chunked=chunked)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
        self._validate_conn(conn)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
        conn.connect()
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 281, in connect
        conn = self._new_conn()
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 143, in _new_conn
        (self.host, self.timeout))
    requests.packages.urllib3.exceptions.ConnectTimeoutError: (<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f785996b828>, 'Connection to binstar-cio-packages-prod.s3.amazonaws.com timed out. (connect timeout=9.15)')

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 423, in send
        timeout=timeout
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 671, in urlopen
        release_conn=release_conn, **response_kw)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 671, in urlopen
        release_conn=release_conn, **response_kw)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 671, in urlopen
        release_conn=release_conn, **response_kw)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 643, in urlopen
        _stacktrace=sys.exc_info()[2])
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/util/retry.py", line 363, in increment
        raise MaxRetryError(_pool, url, error or ResponseError(cause))
    requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Max retries exceeded with url: /564216837bb5bd601bca65c5/58405ae0da6c991112907fd3?response-content-disposition=attachment%3B%20filename%3D%22tensorflow-0.12.0rc0-py35_0.tar.bz2%22%3B%20filename%2A%3DUTF-8%27%27tensorflow-0.12.0rc0-py35_0.tar.bz2&response-content-type=application%2Fx-tar&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=60&X-Amz-Date=20180823T073032Z&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzECMaDCn%2BySIijjspPjGJ5SK3AzA4QtXI95vEKgrmyzO0ummEYmPmrWRylkkthnHV0Nadta75tr9i7pCbE6XwNk983xZg3G7LcJuNH8oSVW09MqPBQ4axsEKrHUuk%2BRxkJaPTWzQ9hkdVKiU2yfyFFgVCm4%2FzOnVRqO3X2%2Fk%2FWMLcdJaHRMnUO1yE14cZWSnf2AX%2Bypg8ERKHlHLFVPYXF1GaA66YFvJ7HMD%2FDdp0sYUHpuIURLikpFTxlx2xwnpw3bxKeIDuiTFOmq8LMzAMtLaxoenXwBbb%2Fl2p8X08Lv2NUY%2FrLuUV6k393pV1QK5BFEyuKqzZNlaR4oLrO7ITx6SISR5UPD6b5QteULTy6m4KSyQL06l02AOBDv5%2BeJCH%2FZlo2TOzHw80jV7P0Srdng0K0MUeXH09KqW8JpmnRLwLySxnX3JY2ACoQDoCO%2FUEhbCQnNKU3tzVZTTSJqw91V2l0n6tPGOJj2TlZUhMi3R9xao6gTztqiFxG1Qlaz6qOawJhZTQTUClct%2BsoMxz%2BbgIUUxgWu1CG3aSAg4zCelqd%2FKv2sKzzwjXEadbZPPj3LyYIm6wiXyPpwi0tCNkFp%2BDoIour8tgo8UomKr42wU%3D&X-Amz-Credential=ASIAWUI46DZFGCHOYBZL%2F20180823%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=74e410507a6a5aa0d01beacd28759c891dc5645f3475762c3c1334feb956e082 (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f785996b828>, 'Connection to binstar-cio-packages-prod.s3.amazonaws.com timed out. (connect timeout=9.15)'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/gateways/download.py", line 63, in download
        resp = session.get(url, stream=True, proxies=session.proxies, timeout=timeout)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 501, in get
        return self.request('GET', url, **kwargs)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 488, in request
        resp = self.send(prep, **send_kwargs)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 630, in send
        history = [resp for resp in gen] if allow_redirects else []
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 630, in <listcomp>
        history = [resp for resp in gen] if allow_redirects else []
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 190, in resolve_redirects
        **adapter_kwargs
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 609, in send
        r = adapter.send(request, **kwargs)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 479, in send
        raise ConnectTimeout(e, request=request)
    requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Max retries exceeded with url: /564216837bb5bd601bca65c5/58405ae0da6c991112907fd3?response-content-disposition=attachment%3B%20filename%3D%22tensorflow-0.12.0rc0-py35_0.tar.bz2%22%3B%20filename%2A%3DUTF-8%27%27tensorflow-0.12.0rc0-py35_0.tar.bz2&response-content-type=application%2Fx-tar&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=60&X-Amz-Date=20180823T073032Z&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzECMaDCn%2BySIijjspPjGJ5SK3AzA4QtXI95vEKgrmyzO0ummEYmPmrWRylkkthnHV0Nadta75tr9i7pCbE6XwNk983xZg3G7LcJuNH8oSVW09MqPBQ4axsEKrHUuk%2BRxkJaPTWzQ9hkdVKiU2yfyFFgVCm4%2FzOnVRqO3X2%2Fk%2FWMLcdJaHRMnUO1yE14cZWSnf2AX%2Bypg8ERKHlHLFVPYXF1GaA66YFvJ7HMD%2FDdp0sYUHpuIURLikpFTxlx2xwnpw3bxKeIDuiTFOmq8LMzAMtLaxoenXwBbb%2Fl2p8X08Lv2NUY%2FrLuUV6k393pV1QK5BFEyuKqzZNlaR4oLrO7ITx6SISR5UPD6b5QteULTy6m4KSyQL06l02AOBDv5%2BeJCH%2FZlo2TOzHw80jV7P0Srdng0K0MUeXH09KqW8JpmnRLwLySxnX3JY2ACoQDoCO%2FUEhbCQnNKU3tzVZTTSJqw91V2l0n6tPGOJj2TlZUhMi3R9xao6gTztqiFxG1Qlaz6qOawJhZTQTUClct%2BsoMxz%2BbgIUUxgWu1CG3aSAg4zCelqd%2FKv2sKzzwjXEadbZPPj3LyYIm6wiXyPpwi0tCNkFp%2BDoIour8tgo8UomKr42wU%3D&X-Amz-Credential=ASIAWUI46DZFGCHOYBZL%2F20180823%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=74e410507a6a5aa0d01beacd28759c891dc5645f3475762c3c1334feb956e082 (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f785996b828>, 'Connection to binstar-cio-packages-prod.s3.amazonaws.com timed out. (connect timeout=9.15)'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 477, in _execute_action
        action.execute()
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 757, in execute
        download(self.url, self.target_full_path, self.md5sum)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/gateways/download.py", line 124, in download
        getattr(e.response, 'elapsed', None))
    conda.exceptions.CondaHTTPError: <unprintable CondaHTTPError object>

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 617, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 137, in _main
        exit_code = args.func(args, p)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 347, in install
        execute_actions(actions, index, verbose=not context.quiet)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/plan.py", line 837, in execute_actions
        execute_instructions(plan, index, verbose)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 258, in execute_instructions
        cmd(state, arg)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 111, in PROGRESSIVEFETCHEXTRACT_CMD
        progressive_fetch_extract.execute()
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 466, in execute
        self._execute_action(action)
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 482, in _execute_action
        exceptions.append(CondaError(repr(e)))
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/__init__.py", line 43, in __repr__
        return '%s: %s\n' % (self.__class__.__name__, text_type(self))
      File "/home/lyl/anaconda3/lib/python3.6/site-packages/conda/__init__.py", line 46, in __str__
        return text_type(self.message % self._kwargs)
    TypeError: not enough arguments for format string

不死心第二次继续执行这个命令,然后卡住了,第三次就好了:

conda install -c https://conda.anaconda.org/jjhelmus tensorflow
Fetching package metadata .................
Solving package specifications: .

# All requested packages already installed.
# packages in environment at /home/lyl/anaconda3/envs/gtf:
#
tensorflow                0.12.0rc0                py35_0    jjhelmus

开心的一批
执行python,进入命令行模式,然后输入导入tf,发现可以使用cuda了,美滋滋

python
Python 3.5.4 |Continuum Analytics, Inc.| (default, Aug 14 2017, 13:26:58) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.7.5 locally
>>> exit()

猜你喜欢

转载自blog.csdn.net/hehedadaq/article/details/81982371