Home > Net >  AssertionError: only tensorflow v1 is supported
AssertionError: only tensorflow v1 is supported

Time:01-04

I have installed tensorflow by pip install. And when i run the application i have this arrow. What I should do?

Traceback (most recent call last):
  File "C:\Users\1\Desktop\PathPlanning-main\Supervisor\__init__.py", line 4, in <module>
    assert str(tf.__version__).startswith('1.'), "only tensorflow v1 is supported"
AssertionError: only tensorflow v1 is supported
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'  # or any {'0', '1', '2'}
import tensorflow as tf
assert str(tf.__version__).startswith('1.'), "only tensorflow v1 is supported"

Ihave searched the internet about this problem but i didnt find

CodePudding user response:

Well, from the error I'd imagine you've installed Tensorflow 2 and "the application" requires Tensorflow 1.x, as the error says.

You could do pip install 'tensorflow<2.0' to install the latest 1.x version available – however if "the application" has a requirements.txt file or similar, you should probably install the versions specified there.

CodePudding user response:

  • The error you are encountering is due to the code expecting a version 1.x release of TensorFlow, but a different version is being used.

  • To fix the error, you can either install a version 1.x release of
    TensorFlow or update the code to support the version of TensorFlow
    that you are currently using.

  • You can check the version of TensorFlow that you are using by running

    import tensorflow as tf; print(tf.__version__)

  • You can install a specific version of TensorFlow using pip install tensorflow==X.X, where X.X is the version number you want to install.

  • Related