Issues with onnxruntime on Ubuntu 16.04 - python

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

Related

Import cv2 error: Symbol not found: _av_buffer_default_free

I'm getting this weird runtime (I think) error with cv2 (assumingly) and cannnot resolve it.
i'm using python3.7 on mac:
(proj) user#user-MacBook-Pro:~/Desktop/proj/controllers$ python
Experiments/n_Experiment.py
pybullet build time: Dec 10 2021 09:53:34
Traceback (most recent call last):
File "Experiments/n_Experiment.py", line 1, in <module>
from experiment import Experiment
File "/Users/user/Desktop/proj/ontrollers/experiment.py", line 1, in <module>
from simulation import LinkServer as SimServer
File "/Users/user/Desktop/proj/controllers/pybulletsim/simulation.py", line 11, in <module>
import cv2
ImportError: dlopen(/Users/user/opt/anaconda3/envs/proj/lib/python3.7/site- packages/cv2.cpython-37m-darwin.so, 2): Symbol not found: _av_buffer_default_free
Referenced from: /Users/user/opt/anaconda3/envs/proj/lib/libavformat.58.dylib
Expected in: /Users/user/opt/anaconda3/envs/proj/lib/libavcodec.58.dylib
in /Users/user/opt/anaconda3/envs/proj/lib/libavformat.58.dylib
So far, I've tried to update conda, and all of the following actions which did not help:
update conda navigtors
symbolyc link
ln -s libavformat.58.dylib
reinstall opencv in various ways (using conda, pip3, brew (also tried to brew build from source).
reinstall numpy (there might be a connection apparently).
Any ideas how to resolve it??
Thanks!

Having trouble with the aiy-python-wheels on Raspberry Pi 3. How do I resolve incompatible glibc issue?

I've gotten my hands on a AIY voice kit v1 and am stuck with the assistant_grpc_demo.py with it failing at an import statement with the grpc. I should have everything installed already, yet google.auth.transport can't seem to find it. I am using a pi 3 A+. Below is the terminal commands I used and their outputs.
pi#raspberrypi:~ $ cat testinput.py
import google.auth.transport.grpc
pi#raspberrypi:~ $ python3 testinput.py
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/google/auth/transport/grpc.py", line 30, in <module>
import grpc
File "/home/pi/.local/lib/python3.7/site-packages/grpc/__init__.py", line 22, in <module>
from grpc import _compression
File "/home/pi/.local/lib/python3.7/site-packages/grpc/_compression.py", line 15, in <module>
from grpc._cython import cygrpc
ImportError: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /home/pi/.local/lib/python3.7/site-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-gnueabihf.so)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "testinput.py", line 1, in <module>
import google.auth.transport.grpc
File "/home/pi/.local/lib/python3.7/site-packages/google/auth/transport/grpc.py", line 37, in <module>
caught_exc,
File "<string>", line 3, in raise_from
ImportError: gRPC is not installed, please install the grpcio package to use the gRPC transport.
*Maybe the glibc part is the problem. Not sure how to resolve that as I already have libc6 2.28. Is there a way to get the aiy-python-wheels to work with my set-up or a previous version. Already tried flashing a pre-built official image built on 4-13-2018 with everything set up, though it failed to boot. Trying to download all packages manually. assistant_library_with_button.sh works though.
Not sure how to resolve that as I already have libc6 2.28
The error message says: .../site-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-gnueabihf.so requires GLIBC_2.33.
Your libc6 is too old for that gRPC package to work -- it was compiled on a newer system.
You must either:
get a different gRPC package -- one compiled on and suitable for running on a GLIBC-2.28 (or earlier) based system, or
get a different GLIBC package (2.33 or later).

Why do i get this segdault import numpy error?

When I try to import numpy I get some long error which gives me instructions to try and fix the problem.
I read it through and tried the solutions but none worked. I just want to import numpy.
import numpy
The error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/numpy/core/__init__.py", line 40, in <module>
File "/usr/local/lib/python3.7/site-packages/numpy/core/multiarray.py", line 12, in <module>
File "/usr/local/lib/python3.7/site-packages/numpy/core/overrides.py", line , in <module>
ImportError: PyCapsule_Import could not import module "datetime"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Solution.py", line 1, in <module>
import numpy
File "/usr/local/lib/python3.7/site-packages/numpy/__init__.py", line 142, in <module>
File "/usr/local/lib/python3.7/site-packages/numpy/core/__init__.py", line 71, in <module>
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
22(removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
1. Check that you are using the Python you expect (you're using /usr/local/bin/python3),
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy versions you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
how you installed Python
how you installed numpy
your operating system
whether or not you have multiple versions of Python installed
if you built from source, your compiler versions and ideally a build log
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: PyCapsule_Import could not import module "datetime"
Also when I run any numpy function I get a segmentation error what does that mean and are there any fixes?

unable to install opencv in mac for python.. below is the error. else suggest a better way to install opencv

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/cv2.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/glog/lib/libglog.0.3.5.dylib
Referenced from: /usr/local/Cellar/opencv/3.4.3_1/lib/libopencv_sfm.3.4.dylib
Reason: image not found
above is the error - how to fix ?
I searched for this problem and also got to github.com/opencv/opencv/issues/8652 where they recommended installing the missing library.
However, our error message references a different library -- glog: brew install glog worked for me!

Python Path error - No Module Found error

I'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?

Categories

Resources