Skip to content

ImportError: cannot import name Aravis #4

Open

Description

@sur83

Dear all;
Thank you for share your work.
I have Aravis installed and working (I downloaded it from https://github.com/AravisProject/aravis ). I am able to see the streaming of my camera with the viewer.

When trying to compile python-aravis it raise this error:

ImportError: cannot import name Aravis

The error come from the 9th line in "aravis.py" which says:
from gi.repository import Aravis

I am totally lost. In internet I have found (https://github.com/ssafarik/aravis/blob/master/tests/python/arv-camera-test.py):
" If you have installed aravis in a non standard location, you may need
to make GI_TYPELIB_PATH point to the correct location. For example:
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:/opt/bin/lib/girepositry-1.0/
You may also have to give the path to libaravis.so, using LD_PRELOAD or
LD_LIBRARY_PATH. "

However, I made an standard installation of aravis without apparent problems. Also, I am pretty sure I made the installation with Introspection files writing:

./autogen.sh --enable-viewer --enable-gst-plugin --enable-introspection=yes
make
make install

In this page, you said a solution to this http://www.freelists.org/post/aravis/Aravis-Python-Support,1
I implemented the idea by:

sudo nano /etc/profile
and adding these two lines to the end of the file
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:/home/username/aravis/src
export LD_LIBRARY_PATH=/home/username/aravis/src/.libs
(where username is my username)
and afterthat, running:
source /etc/profile

However nothing works
Please, could you spread some light about this problem?

Activity

  1. oroulet commented on Sep 19, 2016

    @oroulet
    Collaborator

    This means that the GI bindings for aravis are not installed. Look at the
    readme in python aravis. I think I wrote how to compile aravis with the
    right options

    On Thu, Sep 15, 2016, 17:59 sur83 notifications@github.com wrote:

    Dear all;
    Thank you for share your work.
    I have Aravis installed and working (I downloaded it from
    https://github.com/AravisProject/aravis ). I am able to see the streaming
    of my camera with the viewer.

    When trying to compile python-aravis it raise this error:
    ImportError: cannot import name Aravis

    The error come from the 9th line in "aravis.py" which says:
    from gi.repository import Aravis

    I am totally lost. In internet I have found (
    https://github.com/ssafarik/aravis/blob/master/tests/python/arv-camera-test.py
    ):
    If you have installed aravis in a non standard location, you may need to
    make GI_TYPELIB_PATH point to the correct location. For example: export
    GI_TYPELIB_PATH=$GI_TYPELIB_PATH:/opt/bin/lib/girepositry-1.0/ You may
    also have to give the path to libaravis.so, using LD_PRELOAD or
    LD_LIBRARY_PATH.

    However, I made an standard installation of aravis.
    Please, could you spread some light about this problem?

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #4,
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/ACcfzkmD-Iq_kzS-feTeuERnwqQLydX8ks5qqWtvgaJpZM4J-Cql
    .

  2. sur83 commented on Sep 20, 2016

    @sur83
    Author

    Dear oroulet;
    the readme file in python aravis says:
    "Rmq: Aravis needs to be compiled with intropsection support.
    It requires at least libgirepository1.0-dev and gobject-introspection packges on ubuntu"

    I have previously installed the two packages in ubuntu:

    s@s-VirtualBox:~/aravis/python-aravis-master$ sudo apt-get install gobject-introspection
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    gobject-introspection is already the newest version (1.46.0-3ubuntu1).
    The following package was automatically installed and is no longer required:
      linux-image-extra-4.4.0-34-generic
    Use 'sudo apt autoremove' to remove it.
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    
    s@s-VirtualBox:~/aravis/python-aravis-master$ sudo apt-get upgrade libgirepository1.0-dev
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    libgirepository1.0-dev is already the newest version (1.46.0-3ubuntu1).
    Calculating upgrade... Done
    The following package was automatically installed and is no longer required:
      linux-image-extra-4.4.0-34-generic
    Use 'sudo apt autoremove' to remove it.
    The following packages have been kept back:
      ubuntu-core-launcher
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    

    After that, I installed aravis with:

    git clone https://github.com/sightmachine/aravis.git
    cd aravis
    ./autogen.sh
    ./configure --enable-viewer --enable-gst-plugin --enable-introspection=yes
    make    (1 warning:    arvheartbeattest.c:141:6: warning: implicit declaration of function ‘g_printf’       [-Wimplicit-function-declaration]
                (1 error: arvbuffer.c:121: Error: Aravis: identifier not found on the first line:
     * arv_buffer_data address:)
    
    sudo make install           (1 warning: libtool: warning: relinking 'libgstaravis-0.4.la')
    

    and after that, the test work fine:
    s@s-VirtualBox:~/aravis/tests/python$ ./launch arv-camera-test.py

    arv-camera-test.py:35: PyGIWarning: Aravis was imported without specifying a version first. Use gi.require_version('Aravis', '0.4') before import to ensure that the right version gets loaded.
      from gi.repository import Aravis
    Camera vendor : PHOTONIS USA DIGITAL IMAGING
    Camera model  : NOCTURN GV MONOCHROME
    Camera id     : 1405-001016
    ROI           : 128x128 at 0,0
    Payload       : 16384
    Pixel format  : Mono8
    Start acquisition
    Acquisition
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c70ed0)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c70f40)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c71040)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c710b0)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c71120)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c71190)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c71200)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c71270)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c712e0)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c71350)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c70ed0)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c70f40)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c71040)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c710b0)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c71120)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c71190)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c71200)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c71270)>
    <Aravis.Buffer object at 0x7f5c4f76e870 (ArvBuffer at 0x1c712e0)>
    <Aravis.Buffer object at 0x7f5c4f76e8c0 (ArvBuffer at 0x1c71350)>
    Stop acquisition
    

    I downloaded python aravis from https://github.com/SintefRaufossManufacturing/python-aravis and I installed it with "sudo python setup.py install". Hiowever, the same error raised:
    s@s-VirtualBox:~/aravis/python-aravis-master$ sudo python setup.py installTraceback (most recent call last):

     File "setup.py", line 9, in <module>
        import make_deb
      File "/home/s/aravis/python-aravis-master/make_deb.py", line 9, in <module>
        import aravis
      File "/home/s/aravis/python-aravis-master/aravis.py", line 9, in <module>
        from gi.repository import Aravis
    ImportError: cannot import name Aravis
    

    Any idea of what am I doing wrong?

  3. IamSierraCharlie commented on Apr 6, 2017

    @IamSierraCharlie

    I know that this is an old thread, but guaranteed someone else will run into the issue.
    The problem is around your lib directory
    When installing without specifying directories, the default install for the "Aravis-0.6.typelib" is something like "/usr/local/lib/girepository-1.0" because the default lib directory is /usr/local/lib.
    That typelib appears to be responsible for aravis being detected by python and if in the wrong place, will throw an error as you've seen above.

    All good if you are using the default install of python.
    In myh case, I am using anaconda. After pulling my hair out for most of the day, then faking it with some dodgy linkages, I found the best way to do the install and make it work was to specify the lib directory.
    In my case (for example)
    ./configure --enable-usb --enable-viewer --enable-gst-plugin --enable-fast-heartbeat --enable-introspection=yes --enable-gtk-doc --enable-zlib-pc --libdir=/home/yourhomedir/anaconda/envs/fruit/lib

    I am still learning, but as soon as I build aravis specifying the lib dir, it worked.

    I hope that this is useful for someone
    Great project guys - keep up the great work.
    Steve

  4. IamSierraCharlie commented on Apr 6, 2017

    @IamSierraCharlie

    Just an update on this one.
    Whilst the above works, it may cause issues with gstreamer not being recognised as installed on your system. Another way to get around the issue is to set up a link between the location of Aravis-0.6.typelib file and where is should be.

    The typical install location for that file is
    /usr/local/lib/girepository-1.0/Aravis-0.6.typelib in a Ubuntu install
    For example:
    ln -s /usr/local/lib/girepository-1.0/Aravis-0.6.typelib /path/to/where/your/python/install/needs/the/file/to/be

  5. tobeycarman commented on Jul 18, 2017

    @tobeycarman

    @IamSierraCharlie, this was very helpful. It took me quite a while to figure out the /path/to/where/your/python/install/needs/the/file/to/be, but once I found that location, creating the link worked. I found the path where my Python was looking for Aravis-0.6.typlib by using find and looking for another typelib file that I knew to work:

    $ find / -name "*Gst-1.0.typelib"
    /usr/lib/girepository-1.0/Gst-1.0.typelib
    

    I am not entirely sure how the Gst-1.0.typelib worked after my previous install steps and Aravis-0.6.typelib did not work without making this symlink.

  6. pengy8 commented on Nov 30, 2017

    @pengy8

    Hi, I'm having the same issue running Ok with ./launch arv-camera-test.py:

    yc@yc-ideacentre-Y700-34ISH:~/Camera/aravis/tests/python$ ./launch arv-camera-test.py
    arv-camera-test.py:35: PyGIWarning: Aravis was imported without specifying a version first. Use gi.require_version('Aravis', '0.4') before import to ensure that the right version gets loaded.
      from gi.repository import Aravis
    Camera vendor : Teledyne DALSA
    Camera model  : Nano-C2450
    Camera id     : S1138369
    ROI           : 272x128 at 0,0
    Payload       : 0
    Pixel format  : BayerRG8
    Start acquisition
    Acquisition
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd2d0)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd340)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd440)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd4b0)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd520)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd590)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd600)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd670)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd6e0)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd750)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd2d0)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd340)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd440)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd4b0)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd520)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd590)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd600)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd670)>
    <Aravis.Buffer object at 0x7f28133ab280 (ArvBuffer at 0x15dd6e0)>
    <Aravis.Buffer object at 0x7f28133ab2d0 (ArvBuffer at 0x15dd750)>
    Stop acquisition
    

    I've also linked the library (since it's already linked):

    yc@yc-ideacentre-Y700-34ISH:~/Camera/python-aravis-master$ sudo find / -name "*Gst-1.0.typelib"
    find: ‘/run/user/1000/gvfs’: Permission denied
    /usr/lib/girepository-1.0/Gst-1.0.typelib
    yc@yc-ideacentre-Y700-34ISH:~/Camera/python-aravis-master$ ln -s /usr/local/lib/girepository-1.0/Aravis-0.6.typelib /usr/lib/girepository-1.0/
    ln: failed to create symbolic link '/usr/lib/girepository-1.0/Aravis-0.6.typelib': File exists 
    

    However, I still got the same error:

    yc@yc-ideacentre-Y700-34ISH:~/Camera/python-aravis-master$ sudo python setup.py install
    [sudo] password for yc: 
    Traceback (most recent call last):
      File "setup.py", line 9, in <module>
        import make_deb
      File "/home/yc/Camera/python-aravis-master/make_deb.py", line 9, in <module>
        import aravis
      File "/home/yc/Camera/python-aravis-master/aravis.py", line 9, in <module>
        from gi.repository import Aravis
    ImportError: cannot import name Aravis
    

    This repo seems potential and useful to me, and just I'm being too silly to make it work.
    Could anybody please advice?
    Thank you very much.

  7. bobotus commented on Mar 7, 2018

    @bobotus

    For Ubuntu 16.04.4 LTS Desktop the following was required to get the Aravis module working for python3.5. Hopefully this helps.

    Configure with introspection:

    ./configure --enable-viewer --enable-gst-plugin --enable-introspection=yes
    make
    sudo make install
    

    Locate .typelib location:

    find / -name "*.typelib"
    

    Create a symlink:

    sudo ln -s /usr/local/lib/girepository-1.0/Aravis-0.6.typelib  /usr/local/lib/python3.5/dist-packages/
    

    Install python-aravis from github repository (Optional):

    sudo python3 setup.py install
    
  8. maxlem commented on Jul 9, 2018

    @maxlem

    For me, in debian stretch, the symlink did not work. I used this instead
    sudo ln -s /usr/local/lib/girepository-1.0/Aravis-0.6.typelib /usr/lib/i386-linux-gnu/girepository-1.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions