Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Required #541

Closed
jiapei100 opened this issue Jul 26, 2021 · 10 comments
Closed

Python Required #541

jiapei100 opened this issue Jul 26, 2021 · 10 comments

Comments

@jiapei100
Copy link

Is your feature request related to a problem? Please describe.
It looks by strictly following meson manual, there is no such a python wrapper built out??? I wonder how I can use Aravis via Python.

Describe the solution you'd like
Successfully call the following couple of lines:

~ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Aravis

Describe alternatives you've considered

  • Tested under the test folder already, the direct command:
python ls
arv-buffer-test.py  arv-camera-test.py  arv-enum-test.py  arv-evaluator-test.py  arv-feature-test.py  arv-genicam-test.py  arv-single-buffer-test.pypython python arv-camera-test.py 
Traceback (most recent call last):
  File "arv-camera-test.py", line 14, in <module>
    gi.require_version ('Aravis', '0.8')
  File "~/.local/lib/python3.8/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Aravis not available
  • Tried python-aravis, but failed to install that python package.

Additional context
N/A

@EmmanuelP
Copy link
Contributor

Hi,

In order to be able to import Aravis directly, you have to proceed to a system wide installation in /usr. By default, meson installs everything in /usr/ocal.

Alternatively, you can tell python the path to the Aravis modules, using GI_TYPELIB_PATH and LD_LIBRARY_PATH environment variables.

https://stackoverflow.com/questions/19156974/how-to-get-python-to-recognize-find-homebrew-installed-gi-repository-pygobjects

`

@jiapei100
Copy link
Author

@EmmanuelP
Thank you..

I successfully installed Aravis again, using ➜ aravis-0.8.15 meson --prefix /usr --buildtype=plain builddir.
And, I did ➜ export GI_TYPELIB_PATH="/usr/lib/x86_64-linux-gnu/girepository-1.0"

As for LD_LIBRARY_PATH, it does have included /usr/lib/x86_64-linux-gnu .
Still, import Aravis does NOT work.

Any more suggestions?

@EmmanuelP
Copy link
Contributor

On some systems, you have to run ldconfig as root after a library installation.

@jiapei100
Copy link
Author

jiapei100 commented Jul 27, 2021

@EmmanuelP
Tried...

➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
➜  ~ echo $GI_TYPELIB_PATH                        
/usr/lib/x86_64-linux-gnu/girepository-1.0
➜  ~ ls /usr/lib/x86_64-linux-gnu/girepository-1.0/Aravis-0.8.typelib 
/usr/lib/x86_64-linux-gnu/girepository-1.0/Aravis-0.8.typelib
➜  ~ python --version
Python 3.8.10
➜  ~ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Aravis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Aravis'
>>> 

@EmmanuelP
Copy link
Contributor

Aravis python binding is provided by gobject introspection. You can not directly import Aravis. Here are the needed steps:

import gi
gi.require_version ('Aravis', '0.8')
from gi.repository import Aravis

@jiapei100
Copy link
Author

@EmmanuelP
Great ... Thank you ...
Any more documentation for Aravis Python? And, any sample code of Aravis Python?

Thank you ....

@EmmanuelP
Copy link
Contributor

EmmanuelP commented Jul 27, 2021

Not much documentation I'm afraid. There is this page about Aravis openCV and Python, but a it outdated.

https://kushalvyas.github.io/gige_ubuntu.html

@jiapei100
Copy link
Author

jiapei100 commented Jul 28, 2021

@EmmanuelP

  1. How to call these 2 functions?
camera.set_gain_auto()
camera.set_exposure_time_auto()

Both of these 2 functions require 2 parameters:

xception has occurred: TypeError
Aravis.Camera.set_gain_auto() takes exactly 2 arguments (1 given)
  File "....../arv-camera-test.py", line 34, in <module>
    camera.set_gain_auto()
  1. Why there is ALWAYS such an ERROR while writing into USB3Vision camera?
Exception has occurred: GError
arv-device-error-quark: USB3Vision write_memory error (access-denied) (5)
  File "....../arv-camera-test.py", line 31, in <module>
    camera.set_region (0,0,1440,1080)

@jiapei100
Copy link
Author

jiapei100 commented Jul 28, 2021

What's more, @EmmanuelP
How to let Aravis automatically find multiple cameras?
I mean camera2 = Aravis.Camera.new (None) ONLY finds the very FIRST camera, but NOT the other cameras.

@EmmanuelP
Copy link
Contributor

Hi,

Github issues is not the right place for these questions. Please use the Aravis discourse instance.

https://aravis-project.discourse.group/c/using-aravis/8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants