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.
Related
I try to run a docker container with a tkinter gui app in python and x11 forwarding for a machine learning application. When I run the image with
sudo docker run --runtime=nvidia --gpus='all' --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" -i ganspace
I got the following display connection error, but the app seams to run
Downloading https://drive.google.com/uc?export=download&id=1FJRwzAkV-XWbxgTwxEmEACvuqF5DsBiV
Not cached
[19.07 19:59] Computing stylegan2-ffhq_style_ipca_c80_n1000000_w.npz
Reusing InstrumentedModel instance
Using W latent space
Feature shape: torch.Size([1, 512])
B=10000, N=1000000, dims=512, N/dims=1953.1
Sampling latents: 100%|██████████| 101/101 [00:08<00:00, 11.80it/s]
Fitting batches (NB=10000): 100%|##########| 100/100 [00:19<00:00, 5.11it/s]Authorization required, but no authorization protocol specified
Authorization required, but no authorization protocol specified
Total time: 0:00:28.239383
Loaded components for ffhq from /ganspace/cache/components/stylegan2-ffhq_style_ipca_c80_n1000000_w.npz
Traceback (most recent call last):
File "interactive.py", line 645, in <module>
setup_ui()
File "interactive.py", line 214, in setup_ui
root = tk.Tk()
File "/opt/conda/envs/ganspace/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":1"
If I run the image in the following way with
sudo docker run -u=$(id -u $USER):$(id -g $USER) -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --rm -it --runtime=nvidia --gpus='all' ganspace
the display connection is working (I tested it with another tkinter image), but I got the following permission error due to the user I think
Traceback (most recent call last):
File "interactive.py", line 644, in <module>
setup_model()
File "interactive.py", line 143, in setup_model
inst = get_instrumented_model(model_name, class_name, layer_name, torch.device('cuda'), use_w=args.use_w)
File "/opt/conda/envs/ganspace/lib/python3.7/functools.py", line 840, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/ganspace/models/wrappers.py", line 695, in get_instrumented_model
model = get_model(name, output_class, device, **kwargs)
File "/opt/conda/envs/ganspace/lib/python3.7/functools.py", line 840, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/ganspace/models/wrappers.py", line 680, in get_model
model = StyleGAN2(device, class_name=output_class)
File "/ganspace/models/wrappers.py", line 125, in __init__
self.load_model()
File "/ganspace/models/wrappers.py", line 160, in load_model
os.makedirs(checkpoint.parent, exist_ok=True)
File "/opt/conda/envs/ganspace/lib/python3.7/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/opt/conda/envs/ganspace/lib/python3.7/os.py", line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/ganspace/models/checkpoints'
ERROR conda.cli.main_run:execute(49): `conda run python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w -n=1_000_000 -b=10_000` failed. (See above for error)
Any ideas how to fix this or another solution to have the right permission and get the connection to the display correctly? thanks in advance!
It says permission issue because current user is not having the permission for
/ganspace/models/checkpoints directory
Add the below line in your Dockerfile to give permission for that path
RUN chmod -R 777 /ganspace/models/checkpoints
Note: 777 gives full permission. change it accordingly based on what all permission you require. check permissions in linux
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.
I export database json doing commands explained here:
http://kiwitcms.org/blog/atodorov/2018/07/30/how-to-backup-docker-volumes-for-kiwi-tcms/
I'm running latest version of Kiwi.
docker exec -it kiwi_web /bin/bash -c '/Kiwi/manage.py sqlflush | /Kiwi/manage.py dbshell'
2.cat database.json | docker exec -i kiwi_web /Kiwi/manage.py loaddata --format json -
and I get this error:
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 564, in get_field
return self.fields_map[field_name]
KeyError: 'description'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
yield from PythonDeserializer(objects, **options)
File "/venv/lib/python3.6/site-packages/django/core/serializers/python.py", line 116, in Deserializer
field = Model._meta.get_field(field_name)
File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 566, in get_field
sh-4.2$ cat database.json | ./manage.py loaddata --format json -
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 564, in get_field
return self.fields_map[field_name]
KeyError: 'description'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
yield from PythonDeserializer(objects, **options)
File "/venv/lib/python3.6/site-packages/django/core/serializers/python.py", line 116, in Deserializer
field = Model._meta.get_field(field_name)
File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 566, in get_field
raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Classification has no field named 'description'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 113, in loaddata
self.load_label(fixture_label)
File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 168, in load_label
for obj in objects:
File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 73, in Deserializer
raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture '-':
In which version of Kiwi TCMS did you make your backup ?
It looks like backup is from an older version because 6.5 ships with migrations that remove Build.description and Classification.description fields!
I am not sure it is technically possible to handle this gracefully. Please file an issue on GitHub so we can investigate in more details and link back to this SO thread.
A work around for you will be to launch not the latest version of Kiwi TCMS but the version in which you made the backup. Then restore your data, upgrade to the latest version, run the migrations which will change DB schema and then backup again.
If you do not keep around your older docker image you will have to build it from source.
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.
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