Tensorflow install fails with “compiletime version

2019-01-22 19:07发布

I tried installing from pip:

pip3 install --user --no-cache https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl

Then tried importing and got:

 Using TensorFlow backend.
  /usr/lib64/python3.6/importlib/_bootstrap.py:205: RuntimeWarning: 
  compiletime version 3.5 of module 
  'tensorflow.python.framework.fast_tensor_util' does not match runtime 
  version 3.6
    return f(*args, **kwds)

  2017-11-10 09:35:01.206112: I 
  tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports 
  instructions that this TensorFlow binary was not compiled to use: SSE4.1 
  SSE4.2 AVX

Questions:

  1. I don't understand why the wheel says 3.6, but I get the warning about 3.5

  2. I want to compile to optimize for my cpu, so can I use pip to install from source rather than from binary wheel?

8条回答
何必那么认真
2楼-- · 2019-01-22 19:41

RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6

This is a known issue, which is got prioritized and likely to be fixed soon. Right now the workaround is to use python 3.5.

UPDATE:

The issue has been fixed in the nightly tensorflow builds: "tf-nightly and tf-nightly-gpu now has a python3.6 binary built from scratch for Linux."

I.e., the following command should work with python 3.6:

# tf-nightly or tf-nightly-gpu
pip3 install tf-nightly

Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX

This warning comes from the fact that the default tensorflow distributions are compiled without CPU extensions support (more on this here). If you want to get a CPU optimized tensorflow package, your only option is to build it yourself. It's a bit tedious, but absolutely doable. The build will produce the wheel file, which you can install with just

pip3 install /path/to/the/tensorflow.whl

But if you just want to suppress the warning, this will do:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
查看更多
相关推荐>>
3楼-- · 2019-01-22 19:42

For now you can use python version less than 3.6.x because now Tensorflow 1.4.0 is not working properly with python 3.6.x. It will surly work.

查看更多
smile是对你的礼貌
4楼-- · 2019-01-22 19:48

solution 1. the way I solved this is by downgrading to the latest python3.5, go to python.org download the latest Python3.5, install it and then use normalpip3 install tensorflow this should be able to fix the issue if not try the second solution.

solution 2(also you need to downgrade from python3.6 to python3.5 I used Pycharm to solve the issue, I created a project inside the pycharm editor then I changed the Project Interpreter from python3.6 to python3.5, to do this as well go to File > Preferences search for Project Interpreter, and from the drop-down menu change from python3.6 to python3.5 hit Apply wait for the operation to finish

enter image description here and then in the same window using the + icon

enter image description here

A window will appear that will let you search and install python libraries easily without using pip, in our case we want tensorflow, so just search tensorflow, select tensorflow on search result and click Install Package this will install the package

enter image description here

and voila you're ready to roll, now you got tensorflow installed on your python3.5, keep that in mind.

查看更多
Lonely孤独者°
5楼-- · 2019-01-22 19:49

This issue was resolved on ubuntu 17.10 by running

$ conda install tensorflow

查看更多
三岁会撩人
6楼-- · 2019-01-22 19:50

Just install 1.3 version of tensorflow. Problem solved.

pip install tensorflow==1.3.0
查看更多
Fickle 薄情
7楼-- · 2019-01-22 20:00

i use tensorflow 1.4.0, meet the same problem. but you can use tensorflow 1.6.0, now.

查看更多
登录 后发表回答