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 20:03

I encountered the same problem and I fixed it by:

pip install --ignore-installed tensorflow

The problem occurred because I complied a local version of tensorflow (to enable some CPU features) with python 3.5 earlier. I installed python 3.6 recently and the new tensorlfow already supported those CPU features, so I just installed the official version.

Update:

After some update of tensorflow the approach above doesn't work any more.

Another workaround is using virtual environment such as anaconda to create a python3.5 environment:

conda create -n py35 python=3.5
source activate py35
pip install tensorflow

To work with ipython or jupyter notebook, be sure to install ipykernel inside the virtual environment:

pip install ipykernel
查看更多
做个烂人
3楼-- · 2019-01-22 20:04

I got the same issue and I was able to solve it by installing 1.3 version rather than using 1.4 of tensorflow. Use the following command to do so.

 pip3 install tensorflow==1.3.0
查看更多
登录 后发表回答