NiftyNet net_segment has no attribute '_logger' - niftynet

When I try to do the quickstart instructions for NiftyNet installed from PyPI I get the following error when running net_segment:
net_segment inference -c ~/niftynet/extensions/dense_vnet_abdominal_ct/config.ini
WARNING:tensorflow:SimpleITK adapter failed to load, reducing the supported file formats.
Traceback (most recent call last):
File "/usr/local/bin/net_segment", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/niftynet/__init__.py", line 51, in main
set_logger()
File "/usr/local/lib/python2.7/dist-packages/niftynet/io/misc_io.py", line 585, in set_logger
tf.logging._logger.handlers = []
AttributeError: 'module' object has no attribute '_logger'
I have tried this on a Linux Mint 18.3 install (this one) as well as an Arch Linux install with SimpleITK.
Here is the same error on Arch Linux with NiftyNet installed from the AUR with SimpleITK installed.
net_segment inference -c ~/niftynet/extensions/dense_vnet_abdominal_ct/config.ini
Traceback (most recent call last):
File "/usr/bin/net_segment", line 11, in <module>
load_entry_point('NiftyNet==0.2.2', 'console_scripts', 'net_segment')()
File "/usr/lib/python3.6/site-packages/niftynet/__init__.py", line 51, in main
set_logger()
File "/usr/lib/python3.6/site-packages/niftynet/io/misc_io.py", line 585, in set_logger
tf.logging._logger.handlers = []
AttributeError: module 'tensorflow.tools.api.generator.api.logging' has no attribute '_logger'
Solved by downgrading TensorFlow to version 1.7.

NiftyNet does not support TF 1.8 yet, as you have discovered.

Related

coral usb example model fails on Ubuntu

I am trying to run the example model on Coral USB accelerator on Ubuntu guest on VirtualBox. I followed the instructions for running the sample model. It all goes well until I run the actual model, where it fails in the following way.
VirtualBox:~/coral/pycoral$ python3 examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 111, in __init__
raise ValueError(capture.message)
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "examples/classify_image.py", line 84, in <module>
main()
File "examples/classify_image.py", line 61, in main
interpreter = make_interpreter(*args.model.split('#'))
File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 66, in make_interpreter
delegates = [load_edgetpu_delegate({'device': device} if device else {})]
File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 42, in load_edgetpu_delegate
return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 154, in load_delegate
raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from libedgetpu.so.1
VirtualBox:~/coral/pycoral$ dpkg -l |grep libedge
ii libedgetpu1-std:amd64 15.0 amd64 Support library for Edge TPU
Any help will be greatly appreciated. Thanks!
Unplug and reinsert the Coral USB adapter. It solved the same issue for me.

Use pytorch on Alpine

I have a docker image in alpine, and need to use pytorch on it. However, as stated in the pytorch website, it requires glibc to run, otherwise it will give error below
import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/torch/__init__.py", line 189, in <module>
_load_global_deps()
File "/usr/lib/python3.7/site-packages/torch/__init__.py", line 142, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File "/usr/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Error relocating /usr/lib/python3.7/site-packages/torch/lib/libgomp-7c85b1e2.so.1: pthread_attr_setaffinity_np: symbol not found
I've tried to install glibc from https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk, but error info stay the same.

AttributeError: module '_version' has no attribute 'version' in mysql connector on docker

I'm getting below error while trying to run the linux image container on windows 10 in docker desktop.
Traceback (most recent call last):
File "app1.py", line 17, in <module>
import mysql.connector
File "/usr/local/lib/python3.8/site-packages/mysql/connector/__init__.py", line 35, in <module>
__version__ = _version.version
AttributeError: module '_version' has no attribute 'version'
I had the same problem on Ubuntu 16.04 using python3.5 with the package mysql_connector_repackaged installed via pip.
I solved by removing it and installing the package mysql-connector-python
pip3 install mysql-connector-python

How can I fix this error and ingest data from Quandl? Thank you

When I try to run the command in my terminal, it raises an error
I'm using anaconda to install my packages and python 2.7.
$ zipline ingest -b quandl
Traceback (most recent call last):
File "/anaconda3/bin/zipline", line 6, in <module>
from pkg_resources import load_entry_point
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'mock>=2.0' distribution was not found and is required by tables
It seems you need to install the mock package:
conda install mock
or, if the previous doesn't work:
conda install -c conda-forge mock

Error in py2app

I am testing py2app on a simple test.py application, doing nothing special.
python == 3.6
py2app == 0.14
It builds fine with no errors when I give this command:
python3.6 setup.py py2app -A
but when I launch it, this is the result:
./dist/test.app/Contents/MacOS/test
Traceback (most recent call last):
File "/Users/fabio/projvenv/dist/test.app/Contents/Resources/__boot__.py", line 132, in <module>
_run()
File "/Users/fabio/projvenv/dist/test.app/Contents/Resources/__boot__.py", line 126, in _run
exec(compile(source, script, 'exec'), globals(), globals())
File "/Users/fabio/projvenv/test.py", line 3, in <module>
import tkinter
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ValueError: character U+6573552f is not in range [U+0000; U+10ffff]
2017-06-24 11:32:26.266 test[65341:8804502] test Error
downgrading to 0.12 fixed the issue for me. More of a workaround that a fix though but good enough for me at this point

Resources