Tensorflow install fails with "compiletime version 3.5 of module does not match runtime version 3.6"

19,658

Solution 1

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'

Solution 2

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

Solution 3

Just install 1.3 version of tensorflow. Problem solved.

pip install tensorflow==1.3.0

Solution 4

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

Solution 5

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

Share:
19,658
nbecker
Author by

nbecker

Updated on June 18, 2022

Comments

  • nbecker
    nbecker about 2 years

    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?

  • Kristada673
    Kristada673 over 6 years
    So, is this warning non-harmful, so that we can afford to suppress it? And if yes, is there any way to permanently suppress it instead of doing os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' every time I want to use tensorflow?
  • Maxim
    Maxim over 6 years
    @Kristada673 Yes, it's mentioned in this answer - stackoverflow.com/a/47227886/712995 Do export TF_CPP_MIN_LOG_LEVEL=2 from the command line
  • Kristada673
    Kristada673 over 6 years
    I was referring to the warning RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6. When I do export TF_CPP_MIN_LOG_LEVEL=2, this warning does not go away. Is it non-harmful? If yes, how can I ignore it? And if no, how can I fix it?
  • Maxim
    Maxim over 6 years
    @Kristada673 I see. No, this warning won't go away that easily. It seems not break tf, but certain internal packages won't import, you never know which function may fail. All currently available fixes are in the answer
  • Z Alward
    Z Alward over 6 years
    I also found that by installing a virtual environment with python 3.6.3 then activating the environment before installing tensorflow, the issue was resolved. $conda create -n tensorflow python=3.6.3 Anaconda --y $conda update conda $source activate envname $conda install tensorflow