ADALM1000 python Linux libsmu 2019

Hello

I try to use Adalm 1000 with simple python command under Linux ubuntu 18.04
I follow python tutorial:
https://wiki.analog.com/university/tools/python-tutorial/table-of-contents

I try to found the required files :
pysmu.py and libpysmu.so  :no more available, not found in :
https://github.com/analogdevicesinc/libsmu

I follow libsmu installation and building in previous link. No error.
I start simple example found here:
https://wiki.analog.com/_media/university/tools/python-tutorial/alm1000_tutorial.zip

<python blink_led.py
    session = Session(ignore_dataflow=True, queue_size=10000)
NameError: name 'Session' is not defined

lsusb and dmesg show adalm1000 module
I miss something in libsmu installation. Link? Path? usr?? Thanks for help


tagged
[edited by: JValeriani at 4:51 PM (GMT 0) on 3 Oct 2019]
Parents
  • 0
    •  Analog Employees 
    on Oct 2, 2019 6:47 PM over 1 year ago

    I'm not a Linux user. It sounds like you are following the right steps. Maybe one of the libsmu support people who work on the linux side can help.

    Everything works fine on Windows (using the libsmu Windows installer) for me.

  • 0
    •  Analog Employees 
    on Oct 2, 2019 6:57 PM over 1 year ago in reply to dmercer

    Did you build and install the libsmu library as documented in the libsmu readme? https://github.com/analogdevicesinc/libsmu/blob/master/README.md

    -Travis

  • Hello travis,
    Yes I do exactly this:

    sudo apt-get install python-setuptools python-pip
    sudo pip install cython
    git clone https://github.com/analogdevicesinc/libsmu.git
    cd libsmu
    mkdir build && cd build
    cmake -DBUILD_PYTHON=ON .. ( fo binding python)
    make
    sudo ldconfig
    sudo udevadm control --reload-rules
    export PYTHONPATH=/usr/lib/python2.7/site-packages:${PYTHONPATH}

    I don't see any error during make, cmake, installation

    <locate pysmu results:
    /usr/bin/pysmu
    /usr/lib/python2.7/site-packages/pysmu
    /usr/lib/python2.7/site-packages/pysmu-1.0.0-py2.7.egg-info
    /usr/lib/python2.7/site-packages/pysmu/__init__.py
    /usr/lib/python2.7/site-packages/pysmu/__init__.pyc
    /usr/lib/python2.7/site-packages/pysmu/_vendor
    /usr/lib/python2.7/site-packages/pysmu/exceptions.py
    /usr/lib/python2.7/site-packages/pysmu/exceptions.pyc
    /usr/lib/python2.7/site-packages/pysmu/libsmu.so
    /usr/lib/python2.7/site-packages/pysmu/utils.py
    /usr/lib/python2.7/site-packages/pysmu/utils.pyc
    /usr/lib/python2.7/site-packages/pysmu/_vendor/__init__.py
    /usr/lib/python2.7/site-packages/pysmu/_vendor/__init__.pyc /usr/lib/python2.7/site-packages/pysmu/_vendor/enum.py /usr/lib/python2.7/site-packages/pysmu/_vendor/enum.pyc /usr/lib/python2.7/site-packages/pysmu-1.0.0-py2.7.egg-info/PKG-INFO /usr/lib/python2.7/site-packages/pysmu-1.0.0-py2.7.egg-info/SOURCES.txt /usr/lib/python2.7/site-packages/pysmu-1.0.0-py2.7.egg-info/dependency_links.txt /usr/lib/python2.7/site-packages/pysmu-1.0.0-py2.7.egg-info/top_level.txt
    <python blink_led.py : same error :
    Traceback (most recent call last):
      File "blink_led.py", line 39, in <module>
        session = Session(ignore_dataflow=True, queue_size=10000)
    NameError: name 'Session' is not defined
    
    
    This demo board works under windows after the two exe files : 
    libsmu and Gui installation

    Any suggestion?

    Regards.

  • 0
    •  Analog Employees 
    on Oct 4, 2019 6:28 AM over 1 year ago in reply to remis73

    Hello,

    It looks like the import from pysmu didn't work as expected. Could you try 2 scenarios and let us know the results?
    1)  At the beginning of your python script, write "from pysmu import Session" and try again.

    2) At the beginning of your python script write "import pysmu" and modify the script like this:

     session = pysmu.Session(ignore_dataflow=True, queue_size=10000)


    Thank you,

    -Alexandra

Reply
  • 0
    •  Analog Employees 
    on Oct 4, 2019 6:28 AM over 1 year ago in reply to remis73

    Hello,

    It looks like the import from pysmu didn't work as expected. Could you try 2 scenarios and let us know the results?
    1)  At the beginning of your python script, write "from pysmu import Session" and try again.

    2) At the beginning of your python script write "import pysmu" and modify the script like this:

     session = pysmu.Session(ignore_dataflow=True, queue_size=10000)


    Thank you,

    -Alexandra

Children
  • Hello
    
    1/
    I add the line : from pysmu import Session
    Result after python blink.led:
    ...from pysmu import Session ImportError: cannot import name Session
    
    2/ I suppress previous line and replace with:
    session = pysmu.Session(ignore_dataflow=True, queue_size=10000)
    
    error message :
    session = pysmu.Session(ignore_dataflow=True, queue_size=10000)
    AttributeError: 'module' object has no attribute 'Session'

    There is an issue with the section part of pysmu module.
    Regards
  • 0
    •  Analog Employees 
    on Oct 9, 2019 12:59 PM over 1 year ago in reply to remis73

    Hi, 

    We still can't reproduce the issue. Let us investigate further and we will come back with more info as soon as possible.
    Can you run "python --version" to check what Python version are you using? (2.7 or 3.7)
    Can you run the "smu" utility? Does that work fine for you? You can open a terminal an write "smu" or "smu -l" and post the output here.


    Thank you. 
    -Alexandra

  • Hello Alexandra,

    smu -l

    <ADALM1000: serial 2031205051485435313330303530323 : fw 2.16 : hw F

    python --version

    <Python 2.7.15+

    Maybe python version is to old. I try also with python3:

    python3 --version

    <Python 3.6.8

    Thus I try again Led example: I need to change Tkinter :” from tkinter import *”

    python3 blink_led.py..error with pysmu.py file :

    In Python 3.x, the urlretrieve function is located in the urllib.request module:

    and urlib2 is no more available. I replace ‘’import urllib2’’ with “from urllib.request import urlopen”

    Try again : error in blink_led.py:

    File "blink_led.py", line 39, in <module>

    session = Session(ignore_dataflow=True, queue_size=10000)

    NameError: name 'Session' is not defined

    Regards

  • Hello

    Do you think this board  is usable under Python 3.X ?

    Regards

  • +1
    •  Analog Employees 
    on Oct 21, 2019 1:39 PM 11 months ago in reply to remis73

    Hi,

    We still could not reproduce a scenario like this.
    Can you run: "locate libsmu.so " and send us the output?
    Might be that some of the library files or library dependencies are not properly installed.

    Did you have another version of libsmu installed before this one? 

    -Alexandra