Anaconda安装tensorflow-gpu

 

哈喽,永不放弃小明哥,就要死磕。接上一篇及这一篇

安装个指定版本的tf-gpu并且能够使用GPU这是一个深度学习搬砖工的基本素质和要求,如果这一点都搞不定我觉得我可以回家卖包子了。

仍然是老套路。bash安装下载好的文件,yes

仔细看人家的提示,别瞎几把yes,因为我名下内存不足,所以安装在了指定文件下./yes/,哈哈,但是我发现conda有点傻逼,如果安装VS加速的话老是不成功,所以放弃了-no,这就安装好了。注意:如果安装多次,请将安装文件都删了,最好始终如一,否则一会就乱了。

安装Anaconda版本号固定、指定文件夹固定、yes和no都要固定。这样有助于解决问题,不然一会就傻逼了。

【建议安装3.5.1的,其实没用,因为后面要升级,不升级不能成功安装tf-gpu】

【老子来时,除了保洁大妈公司没有人了,可见小明哥是最优秀的员工,不,是最优秀的搬砖工】

安装tf-gpu方法:

conda install tensorflow-gpu=1.14.0

如果这一步提示conda不知道是啥玩意,抱歉,你没安装成功【我另外一个服务器就是如此】,请换服务器或者重新来过,或者试试pip安装conda,这种方法不推荐,因为可能也是坑。下面是安装成功的:

Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.10
  latest version: 4.7.12

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: ./yes

  added / updated specs: 
    - tensorflow-gpu=1.14.0


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    openssl-1.1.1d             |       h7b6447c_3         3.7 MB
    numpy-1.17.2               |   py37haad9e8e_0           4 KB
    protobuf-3.9.2             |   py37he6710b0_0         701 KB
    gast-0.3.2                 |             py_0          13 KB
    mkl-service-2.3.0          |   py37he904b0f_0         208 KB
    tensorflow-base-1.14.0     |gpu_py37he45bfe2_0       327.9 MB
    absl-py-0.8.0              |           py37_0         161 KB
    xz-5.2.4                   |       h14c3975_4         366 KB
    werkzeug-0.16.0            |             py_0         255 KB
    ncurses-6.1                |       he6710b0_1         958 KB
    python-3.7.5               |       h0371630_0        36.7 MB
    h5py-2.9.0                 |   py37h7918eee_0         1.2 MB
    libgcc-ng-9.1.0            |       hdf63c60_0         8.1 MB
    numpy-base-1.17.2          |   py37hde5b4d6_0         5.3 MB
    ca-certificates-2019.10.16 |                0         131 KB
    zlib-1.2.11                |       h7b6447c_3         120 KB
    libedit-3.1.20181209       |       hc058e9b_0         188 KB
    certifi-2019.9.11          |           py37_0         154 KB
    cudnn-7.6.0                |       cuda10.1_0       240.9 MB
    six-1.12.0                 |           py37_0          22 KB
    _tflow_select-2.1.0        |              gpu           2 KB
    cudatoolkit-10.1.243       |       h6bb024c_0       513.2 MB
    blas-1.0                   |              mkl           6 KB
    astor-0.8.0                |           py37_0          45 KB
    scipy-1.3.1                |   py37h7c811a0_0        18.1 MB
    readline-7.0               |       h7b6447c_5         392 KB
    tensorflow-1.14.0          |gpu_py37h74c33d7_0           4 KB
    wheel-0.33.6               |           py37_0          40 KB
    cupti-10.1.168             |                0         1.7 MB
    libstdcxx-ng-9.1.0         |       hdf63c60_0         4.0 MB
    mkl_fft-1.0.14             |   py37ha843d7b_0         172 KB
    sqlite-3.30.1              |       h7b6447c_0         1.9 MB
    pip-19.3.1                 |           py37_0         1.9 MB
    setuptools-41.6.0          |           py37_0         652 KB
    libprotobuf-3.9.2          |       hd408876_0         4.7 MB
    wrapt-1.11.2               |   py37h7b6447c_0          49 KB
    c-ares-1.15.0              |    h7b6447c_1001         102 KB
    mkl-2019.4                 |              243       204.1 MB
    hdf5-1.10.4                |       hb1b8bf9_0         5.3 MB
    tk-8.6.8                   |       hbc83047_0         3.1 MB
    ------------------------------------------------------------
                                           Total:        1.35 GB

The following NEW packages will be INSTALLED:

    _libgcc_mutex:        0.1-main                 
    _tflow_select:        2.1.0-gpu                
    absl-py:              0.8.0-py37_0             
    astor:                0.8.0-py37_0             
    blas:                 1.0-mkl                  
    c-ares:               1.15.0-h7b6447c_1001     
    cudatoolkit:          10.1.243-h6bb024c_0      
    cudnn:                7.6.0-cuda10.1_0         
    cupti:                10.1.168-0               
    gast:                 0.3.2-py_0               
    google-pasta:         0.1.7-py_0               
    grpcio:               1.16.1-py37hf8bcb03_1    
    keras-applications:   1.0.8-py_0               
    keras-preprocessing:  1.1.0-py_1               
    libprotobuf:          3.9.2-hd408876_0         
    markdown:             3.1.1-py37_0             
    mkl_fft:              1.0.14-py37ha843d7b_0    
    mkl_random:           1.1.0-py37hd6b4f25_0     
    numpy-base:           1.17.2-py37hde5b4d6_0    
    protobuf:             3.9.2-py37he6710b0_0     
    tensorboard:          1.14.0-py37hf484d3e_0    
    tensorflow:           1.14.0-gpu_py37h74c33d7_0
    tensorflow-base:      1.14.0-gpu_py37he45bfe2_0
    tensorflow-estimator: 1.14.0-py_0              
    tensorflow-gpu:       1.14.0-h0d30ee6_0        
    termcolor:            1.1.0-py37_1             

The following packages will be UPDATED:

    ca-certificates:      2017.08.26-h1d4fec5_0     --> 2019.10.16-0           
    certifi:              2018.1.18-py36_0          --> 2019.9.11-py37_0       
    h5py:                 2.7.1-py36h3585f63_0      --> 2.9.0-py37h7918eee_0   
    hdf5:                 1.10.1-h9caa474_1         --> 1.10.4-hb1b8bf9_0      
    libedit:              3.1-heed3624_0            --> 3.1.20181209-hc058e9b_0
    libgcc-ng:            7.2.0-h7cc24e2_2          --> 9.1.0-hdf63c60_0       
    libstdcxx-ng:         7.2.0-h7a57d05_2          --> 9.1.0-hdf63c60_0       
    mkl:                  2018.0.1-h19d6760_4       --> 2019.4-243             
    mkl-service:          1.1.2-py36h17a0993_4      --> 2.3.0-py37he904b0f_0   
    ncurses:              6.0-h9df7e31_2            --> 6.1-he6710b0_1         
    numpy:                1.14.0-py36h3dfced4_1     --> 1.17.2-py37haad9e8e_0  
    openssl:              1.0.2n-hb7f436b_0         --> 1.1.1d-h7b6447c_3      
    pip:                  9.0.1-py36h6c6f9ce_4      --> 19.3.1-py37_0          
    python:               3.6.4-hc3d631a_1          --> 3.7.5-h0371630_0       
    readline:             7.0-ha6073c6_4            --> 7.0-h7b6447c_5         
    scipy:                1.0.0-py36hbf646e7_0      --> 1.3.1-py37h7c811a0_0   
    setuptools:           38.4.0-py36_0             --> 41.6.0-py37_0          
    six:                  1.11.0-py36h372c433_1     --> 1.12.0-py37_0          
    sqlite:               3.22.0-h1bed415_0         --> 3.30.1-h7b6447c_0      
    tk:                   8.6.7-hc745277_3          --> 8.6.8-hbc83047_0       
    werkzeug:             0.14.1-py36_0             --> 0.16.0-py_0            
    wheel:                0.30.0-py36hfd4bba0_1     --> 0.33.6-py37_0          
    wrapt:                1.10.11-py36h28b7045_0    --> 1.11.2-py37h7b6447c_0  
    xz:                   5.2.3-h55aa19d_2          --> 5.2.4-h14c3975_4       
    zlib:                 1.2.11-ha838bed_2         --> 1.2.11-h7b6447c_3      

Proceed ([y]/n)? n

如果选择n,则python3下并没有tensorflow:

(base) gege@alibaba:$ python3
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'tensorflow'

所以我无法选择,只能y

不要以为y就万事大吉了,没有,远没有。如果人生如此容易,又何来郁闷的我??

又失败了,可能是网络原因,特么的。老子安装一个小时啦,卧槽

Anaconda安装tensorflow-gpu_第1张图片

我记得mkl这玩意一开始就是安装的这个啊,卧槽,咋又出错呢?而且开始安装完了啊。

当我按照里面提示先更新conda时又出现网络问题,真是人生艰难啊。

(base) gege@alibaba:$ conda update -n base conda
Solving environment: done

## Package Plan ##

  environment location: ./yes

  added / updated specs: 
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    tqdm-4.36.1                |             py_0          50 KB
    urllib3-1.24.2             |           py37_0         153 KB
    conda-package-handling-1.6.0|   py37h7b6447c_0         872 KB
    cffi-1.13.1                |   py37h2e261b9_0         224 KB
    pycparser-2.19             |           py37_0         172 KB
    openssl-1.0.2t             |       h7b6447c_1         3.1 MB
    pysocks-1.7.1              |           py37_0          30 KB
    ruamel_yaml-0.15.46        |   py37h14c3975_0         245 KB
    pyopenssl-19.0.0           |           py37_0          82 KB
    cryptography-2.3.1         |   py37hc365091_0         585 KB
    pycosat-0.6.3              |   py37h14c3975_0         105 KB
    asn1crypto-1.2.0           |           py37_0         162 KB
    python-3.7.0               |       hc3d631a_0        31.7 MB
    ncurses-6.1                |       hf484d3e_0         943 KB
    idna-2.8                   |           py37_0         101 KB
    requests-2.22.0            |           py37_0          89 KB
    chardet-3.0.4              |        py37_1003         173 KB
    ------------------------------------------------------------
                                           Total:        38.7 MB

The following NEW packages will be INSTALLED:

    _libgcc_mutex:          0.1-main              
    conda-package-handling: 1.6.0-py37h7b6447c_0  
    tqdm:                   4.36.1-py_0           

The following packages will be UPDATED:

    asn1crypto:             0.24.0-py36_0          --> 1.2.0-py37_0           
    ca-certificates:        2017.08.26-h1d4fec5_0  --> 2019.10.16-0           
    certifi:                2018.1.18-py36_0       --> 2019.9.11-py37_0       
    cffi:                   1.11.4-py36h9745a5d_0  --> 1.13.1-py37h2e261b9_0  
    chardet:                3.0.4-py36h0f667ec_1   --> 3.0.4-py37_1003        
    conda:                  4.4.10-py36_0          --> 4.7.12-py37_0          
    cryptography:           2.1.4-py36hd09be54_0   --> 2.3.1-py37hc365091_0   
    idna:                   2.6-py36h82fb2a8_1     --> 2.8-py37_0             
    libedit:                3.1-heed3624_0         --> 3.1.20181209-hc058e9b_0
    libgcc-ng:              7.2.0-h7cc24e2_2       --> 9.1.0-hdf63c60_0       
    ncurses:                6.0-h9df7e31_2         --> 6.1-hf484d3e_0         
    openssl:                1.0.2n-hb7f436b_0      --> 1.0.2t-h7b6447c_1      
    pip:                    9.0.1-py36h6c6f9ce_4   --> 19.3.1-py37_0          
    pycosat:                0.6.3-py36h0a5515d_0   --> 0.6.3-py37h14c3975_0   
    pycparser:              2.18-py36hf9f622e_1    --> 2.19-py37_0            
    pyopenssl:              17.5.0-py36h20ba746_0  --> 19.0.0-py37_0          
    pysocks:                1.6.7-py36hd97a5b1_1   --> 1.7.1-py37_0           
    python:                 3.6.4-hc3d631a_1       --> 3.7.0-hc3d631a_0       
    readline:               7.0-ha6073c6_4         --> 7.0-h7b6447c_5         
    requests:               2.18.4-py36he2e5f8d_1  --> 2.22.0-py37_0          
    ruamel_yaml:            0.15.35-py36h14c3975_1 --> 0.15.46-py37h14c3975_0 
    setuptools:             38.4.0-py36_0          --> 41.6.0-py37_0          
    six:                    1.11.0-py36h372c433_1  --> 1.12.0-py37_0          
    sqlite:                 3.22.0-h1bed415_0      --> 3.30.1-h7b6447c_0      
    tk:                     8.6.7-hc745277_3       --> 8.6.8-hbc83047_0       
    urllib3:                1.22-py36hbe7ace6_0    --> 1.24.2-py37_0          
    wheel:                  0.30.0-py36hfd4bba0_1  --> 0.33.6-py37_0          
    xz:                     5.2.3-h55aa19d_2       --> 5.2.4-h14c3975_4       
    zlib:                   1.2.11-ha838bed_2      --> 1.2.11-h7b6447c_3      

Proceed ([y]/n)? y


Downloading and Extracting Packages
tqdm 4.36.1: ###################################################################################### | 100% 
urllib3 1.24.2: ################################################################################### | 100% 
conda-package-handling 1.6.0: ##################################################################### | 100% 
cffi 1.13.1: ###################################################################################### | 100% 
pycparser 2.19: ################################################################################### | 100% 
openssl 1.0.2t: ################################################################################### | 100% 
pysocks 1.7.1: #################################################################################### | 100% 
ruamel_yaml 0.15.46: ############################################################################## | 100% 
pyopenssl 19.0.0: ################################################################################# | 100% 
cryptography 2.3.1: ############################################################################### | 100% 
pycosat 0.6.3: #################################################################################### | 100% 
asn1crypto 1.2.0: ################################################################################# | 100% 
python 3.7.0: ########################1                                                             |  28% 
ncurses 6.1: ###################################################################################### | 100% 
idna 2.8: ######################################################################################### | 100% 
requests 2.22.0: ################################################################################## | 100% 
chardet 3.0.4: #################################################################################### | 100% 

CondaHTTPError: HTTP 000 CONNECTION FAILED for url 
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
Downloading and Extracting Packages
mkl 2019.4: ####################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Traceback (most recent call last):
  File "./yes/bin/conda", line 7, in 
    from conda.cli import main
ModuleNotFoundError: No module named 'conda'

上面的就是这个错误,再执行conda就不识别了,卧槽,这真是厉害啊,我安装完就不认识conda了,试试import tf又是失败。

。。。。。。。。。。。。。。。。。。。。。人生艰难。。。。。。。。。。。。。。。。。。。。。。

试试import numpy没问题,于是试试将原有的tf-gpu删除,然后再重新安装Anaconda,当然yes/文件删除了

结果发现进入不了base了,卧槽。安装conda失败了。卧槽。这是几个意思???我明明是用bash安装的啊。

ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer.  You can download the miniconda installer from
https://conda.io/miniconda.html.

难道因为我开了两个Xshell界面??不是

from conda.cli import main

这个出错咋解决吧

>>> tf.test.is_gpu_available()
2019-11-03 15:45:19.149027: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimize to use the following CPU instructions in performance critical operations:  SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
To enable them in operations, rebuild TensorFlow with the appropriate compiler flags.
2019-11-03 15:45:19.170865: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2299975000 Hz
2019-11-03 15:45:19.173375: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55a160c94e50 executing computations on platform Host. Devices:
2019-11-03 15:45:19.173400: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): , 
False

 

另外有相关问题可以加入QQ群讨论,不设微信群

QQ群:868373192 

语音深度学习群

你可能感兴趣的:(python,Anaconda,tensorflow-gpu,服务器,安装,GPU)