pythontensorflowniftynet

ImportError: cannot import name '_get_logger' Niftynet


I'm trying to run Niftynet on my PC. but it keeps showing this error. I had a CPU version for tensorflow and it worked. After that I installed tensorflow-gpu and now it stopped working.

Please do note that import tensorflow as tf works fine so I'm not sure what do to now to solve this problem.

Traceback (most recent call last):
  File "c:\users\halim\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\halim\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\halim\AppData\Local\Programs\Python\Python36\Scripts\net_run.exe\__main__.py", line 5, in <module>
  File "c:\users\halim\appdata\local\programs\python\python36\lib\site-packages\niftynet\__init__.py", line 48, in <module>
    set_logger()
  File "c:\users\halim\appdata\local\programs\python\python36\lib\site-packages\niftynet\io\misc_io.py", line 724, in set_logger
    from tensorflow.python.platform.tf_logging import _get_logger
ImportError: cannot import name '_get_logger' 

Solution

  • You need to install only tensorflow-gpu, and install the correct version for it. First uninstall everything:

    pip3 uninstall tensorflow-gpu tensorflow
    

    Then reinstall the correct tensorflow-gpu version

    pip3 install --user tensorflow-gpu==1.12
    

    The version is mentioned in the installation guide: https://niftynet.readthedocs.io/en/dev/installation.html