raspberry pi 4 tensorflow installation - python

pi#raspberrypi:~/examples/lite/examples/object_detection/raspberry_pi $ python3 detect_picamera.py --model /tmp/detect.tflite --labels /tmp/coco_labels.txt
2019-12-28 17:43:12.464130: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "detect_picamera.py", line 34, in
from tf.lite.interpreter import Interpreter
ModuleNotFoundError: No module named 'tf'
Installed using pip3

It's actually error in the package when it comes to raspberry
Use
from tensorflow.lite.interpreter import Interpreter

Your error might be with your Tensorflow installation. You could try to reinstall Tensorflow. Check out my answer here https://raspberrypi.stackexchange.com/a/107920/114206 to do that.

Related

How do I install GNU Radio in a Python virtualenv

I am trying to get gnuradio to work in a virtualenv. I want to keep my system somewhat clean and my project needs Python 3.9, but my system Python is 3.8 (Ubuntu 20.04.4 LTS).
I install it using sudo apt install gnuradio, but then it ends up in the system dist-packages and I can't import it in my virtualenv. The imports work fine when running the system Python.
I have tried to recreate my virtualenv to use system packages:
python3.9 -m venv --system-site-packages venv
This at least made my virtualenv able to find gnuradio, but when I try importing stuff it fails in several different ways.
>>> from gnuradio import uhd
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 21, in _prepare_uhd_python
from . import uhd_python
ImportError: cannot import name 'uhd_python' from partially initialized module 'gnuradio.uhd' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 68, in <module>
_prepare_uhd_python()
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 26, in _prepare_uhd_python
from . import uhd_python
ImportError: cannot import name 'uhd_python' from partially initialized module 'gnuradio.uhd' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py)
>>> import pmt
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pmt/__init__.py", line 34, in <module>
from .pmt_python import *
ModuleNotFoundError: No module named 'pmt.pmt_python'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pmt/__init__.py", line 38, in <module>
from .pmt_python import *
ModuleNotFoundError: No module named 'pmt.pmt_python'
I have struggled with this for several days now and found no solution. Is it even possible to run GNU Radio from within a virtualenv?
I have struggled with this for several days now and found no solution.
Your distro's GNU Radio package is built against your distro's python, so you can't use it with a different python.
So, this is expected.
Is it even possible to run GNU Radio from within a virtualenv?
Sure, you'd need to build it from that virtualenv as well, and tell cmake -DCMAKE_INSTALL_PREFIX=/path/to/virtualenv/ to install into it.
We have a pretty nice anaconda packager, so installing GNU Radio into a Python prefix using conda might be the easiest alternative to that.
Alternatively:
Ubuntu 20.04.4 LTS
There's a new Ubuntu LTS version out! If you go for a system upgrade to Ubuntu 22.04 LTS, you get Python 3.10, and a current GNU Radio 3.10.1 "for free".

Can't import pymatgen.core "No module named 'pymatgen.core'"

I've used pip install pymatgen with Python 3.9.1 on Windows 10 to install pymatgen, but I'm getting the following error:
Traceback (most recent call last):
File "D:\code\pymatgen\pymatgen.py", line 1, in <module>
import pymatgen.core as mg
File "D:\code\pymatgen\pymatgen.py", line 1, in <module>
import pymatgen.core as mg
ModuleNotFoundError: No module named 'pymatgen.core'; 'pymatgen' is not a package
I have also tried to install the previous 2 versions but still getting the same error though I can already see it in the pip list
pymatgen 2022.3.22
What am I missing?
Maybe try using conda ? if this doesn't work then there is definitely some dependencies issue
https://pymatgen.org/installation.html

Issues with onnxruntime on Ubuntu 16.04

I'm trying to run inference on an ONNX model on Ubuntu 16.04 using onnxruntime. But the import statement gives me this error:
>>> import onnxruntime
/opt/conda/lib/python3.6/site-packages/onnxruntime/capi/_pybind_state.py:13: UserWarning: Cannot load onnxruntime.capi. Error: '/opt/conda/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-36m-x86_64-linux-gnu.so: cannot enable executable stack as shared object requires: Permission denied'
warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'".format(str(e)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/lib/python3.6/site-packages/onnxruntime/__init__.py", line 12, in <module>
from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, RunOptions, SessionOptions, set_default_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, ExecutionMode, OrtDevice, SessionIOBinding
ImportError: cannot import name 'get_all_providers'
After searching online, I have tried using execstack -c on the .so mentioned in the warning. But I get this message and the issue still persists:
section file offsets not monotonically increasing
I would really appreciate some pointers to fix this.
P.S. I even tried installing onnxruntime-gpu (I have CUDA 10.0) but I get the same error.
Not sure if you've SELinux installed? https://ceisoftware.zendesk.com/hc/en-us/articles/202370087-Cannot-enable-executable-stack-as-shared-object-requires-Permission-denied. This doesn't seem to

Unable to install packages PyCharm

I am trying to install packages with PyCharm but each time I try to do so it gives me an error:
The full command output:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.2\helpers\packaging_tool.py", line 2, in <module>
import traceback
ModuleNotFoundError: No module named 'traceback'
What would be a way to fix this?
Edit: I am trying to install the "Python packaging tools" which results in that error.
Try to reset from the right hand side at the top of the window of the Interpreter and try to install again

How to install the Pyinstaller on Win 7

I am using win7 to install the PyInstaller.
I have tried the method accroding to (How to install PyInstaller? )but I failed and there is the log,is there anything wrong?
C:\Python27\pyinstaller-2.0\PyInstaller>python Configure.py
Traceback (most recent call last):
File "Configure.py", line 28, in <module>
from PyInstaller import HOMEPATH, PLATFORM
ImportError: No module named PyInstaller
Thanks!
Try going to the system properties and go to the environment variables and set the PATH to the address of where the pyinstaller is located.

Categories

Resources