ImportError: cannot import name 'abs'

后端 未结 9 1846
我寻月下人不归
我寻月下人不归 2020-12-17 18:42

I got problem while doing object detection using tensorflow-gpu

I was follwing the youtube tutorials :https://www.youtube.com/watch?v=Rgpfk6eYxJA

I\'m trying

相关标签:
9条回答
  • 2020-12-17 19:19

    I encountered the same error messages while trying seq2seq tutorial. I used tensorflow-cpu, python3.6, Anaconda3 and Ubuntu16.04.

    The problem was that the path of tensorflow was not variable on my PC. I couldn't import tensorflow, though I could a few hours before. Try "import tensorflow" on python interactive shell. If you cannot import it, your problem would be the same as mine.

    How to solve the problem was deleting everything about tensorflow on your computer and re-install them.

    By the way, 'abs' is a function defined in the following file: ~/anaconda3/envs/tensorflow/lib/python3.6/site\ -packages/tensorflow/python/keras/_impl/keras/backend.py

    And after re-installing tensorflow, I don't know why, "_impl" directory was disappeared.

    0 讨论(0)
  • 2020-12-17 19:21

    Mostly this issues coming from the abnormal action of pip (python package manager)

    In my case, one of my package named protobuf has problem to be deleted by utilizing the pip uninstall command. so, I did it manually and then I could use tensorflow in right way.

    Hope this help someone.

    0 讨论(0)
  • 2020-12-17 19:22

    Had same problem in windows 10 when installing using anaconda Navigator and selecting all packages available for tensorflow and keras.

    Solution was to clean up and install from command line, using "conda install" selecting only "gpu" packages:

    conda remove keras*
    conda remove tensorflow*
    conda remove protobuf 
    pip uninstall tensorflow*
    pip uninstall protobuf
    conda install tensorflow-gpu
    conda install keras-gpu
    
    0 讨论(0)
  • 2020-12-17 19:23

    This is because that you have install some library and some dependencies of the tensorflow had changes by the installed library.

    do the following command it will solve the problem

    sudo pip install --upgrade tensorflow-gpu
    
    0 讨论(0)
  • 2020-12-17 19:24

    If you use Win10+cuda_10.0+cuDNNv7.4.2.24, follow this will help you!

    1. uninstall all tensorflow and keras related.
    2. uninstall all protobuf related.
    3. delete tensorflow, keras, protobuf related folds in your 'Anaconda3_install_path'\Lib\site-packages, e.g.E:\ProgramData\Anaconda3\Lib\site-packages.
    4. install tensorflow and keras showed below in picture.
    0 讨论(0)
  • 2020-12-17 19:28
    • Edit:

    Create a virtual env and install TF-GPU, Its faster and safer.

    • Original Answer:

    OS : Ubuntu 18.04.1

    Python Version 3.6

    Solution :

    Uninstalled tensorflow 1.10

    python3 -m pip uninstall tensorflow

    Re-installed it again

    python3 -m pip install tensorflow==1.8.0

    This issue is created cause of older versions of tensorflow dependencies like protobuff and others which gets installed during tensorflow installation, So if you wanna use tensorflow 1.10 you have to uninstall rest of the dependencies or upgrade them.

    In case you want to install 1.10.1 then you have to remove these packages

    absl-py
    astor
    gast 
    grpcio 
    markdown 
    numpy 
    protobuf 
    setuptools 
    six 
    tensorboard 
    tensorflow 
    termcolor 
    werkzeug 
    wheel
    protobuf
    

    then do sudo python3 -m pip uninstall tensorflow In case a tensorflow is installed in root user then install it using python3 -m pip install tensorflow --user --no-cache

    IF you still face this problem then repeat all the steps above and do find ~/ -name tensorflow and delete every folder that pops up and retry installation.

    0 讨论(0)
提交回复
热议问题