FAQ
I have unpacked the PyVISA files into the Python/lib/site-packages dir
and from the IDLE GUI I get and error

import visa

Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
import visa
ImportError: No module named visa



There must be more to just putting the files in the correct directory.
Need help configuring PyVISA to work.
My ultimate goal is to control electronic instruments with Python
through visa.

Search Discussions

  • Yashwin Kanchan at Apr 1, 2011 at 3:52 pm
    Hi

    Have you installed the module after unzipping it?

    python setup.py install

    Got it from the README file in the downloaded tar.

    Regards
    Yashwin Kanchan
    On 1 April 2011 16:29, Manatee wrote:

    I have unpacked the PyVISA files into the Python/lib/site-packages dir
    and from the IDLE GUI I get and error

    import visa

    Traceback (most recent call last):
    File "<pyshell#25>", line 1, in <module>
    import visa
    ImportError: No module named visa



    There must be more to just putting the files in the correct directory.
    Need help configuring PyVISA to work.
    My ultimate goal is to control electronic instruments with Python
    through visa.
    --
    http://mail.python.org/mailman/listinfo/python-list
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20110401/1cbe0f49/attachment.html>
  • Eryksun () at Apr 1, 2011 at 4:34 pm

    On Friday, April 1, 2011 11:29:10 AM UTC-4, Manatee wrote:
    I have unpacked the PyVISA files into the Python/lib/site-packages dir
    and from the IDLE GUI I get and error

    import visa

    Traceback (most recent call last):
    File "
    ", line 1, in <module>
    import visa
    ImportError: No module named visa


    There must be more to just putting the files in the correct directory.
    Need help configuring PyVISA to work.
    My ultimate goal is to control electronic instruments with Python
    through visa.
    If you're on Windows, they have a win32 executable installer available on SourceForge. Otherwise you can just easy_install the egg.

    http://sourceforge.net/projects/pyvisa/files/PyVISA/1.3/

    You'll also need a VISA library (.dll or .so file) for your GPIB adapter.
  • Günther Dietrich at Apr 1, 2011 at 6:05 pm

    Manatee wrote:
    I have unpacked the PyVISA files into the Python/lib/site-packages dir
    and from the IDLE GUI I get and error

    import visa

    Traceback (most recent call last):
    File "<pyshell#25>", line 1, in <module>
    import visa
    ImportError: No module named visa



    There must be more to just putting the files in the correct directory.
    Yes, there is more:

    - DON'T unpack the files into any site-packages folder. If you already
    have done it, remove them.
    - Unpack the PyVISA archive to any other folder.
    - On the command line, change into the PyVISA folder. There you should
    find - among others - the two files setup.py and setup.cfg (at least
    if you use PyVISA-1.3.tar.gz).
    - Now, it depends on what variant of python you use and want to install
    PyVISA for and on the configuration of your PYTHONPATH rsp. sys.path
    and the folders they point to.
    You can simply try: 'sudo python ./setup install'
    If you are lucky, that's it. If not, you have to decide, where the
    installation script has to put the files to. For example, for my
    python 2.6, I chose
    '/Library/Frameworks/Python.framework/Versions/2.6/'. In this path,
    there is a folder 'lib/site-packages', which is pointed to by
    sys.path, and where .pth files are evaluated.
    - Edit the file setup.cfg. Near the end, in section '[install]', you will
    find the line 'prefix=/usr'. Replace the '/usr' by your chosen path.
    - Save the file and retry the install (see above).



    Best regards,

    G?nther
  • Manatee at Apr 1, 2011 at 7:40 pm

    On Apr 1, 2:05?pm, "G?nther Dietrich" wrote:
    Manatee wrote:
    I have unpacked the PyVISA files into the Python/lib/site-packages dir
    and from the IDLE GUI I get and error
    import visa
    Traceback (most recent call last):
    ?File "<pyshell#25>", line 1, in <module>
    ? ?import visa
    ImportError: No module named visa
    There must be more to just putting the files in the correct directory.
    Yes, there is more:

    - DON'T unpack the files into any site-packages folder. If you already
    ? have done it, remove them.
    - Unpack the PyVISA archive to any other folder.
    - On the command line, change into the PyVISA folder. There you should
    ? find - among others - the two files setup.py and setup.cfg (at least
    ? if you use PyVISA-1.3.tar.gz).
    - Now, it depends on what variant of python you use and want to install
    ? PyVISA for and on the configuration of your PYTHONPATH rsp. sys.path
    ? and the folders they point to.
    ? You can simply try: 'sudo python ./setup install'
    ? If you are lucky, that's it. If not, you have to decide, where the
    ? installation script has to put the files to. For example, for my
    ? python 2.6, I chose
    ? '/Library/Frameworks/Python.framework/Versions/2.6/'. In this path,
    ? there is a folder 'lib/site-packages', which is pointed to by
    ? sys.path, and where .pth files are evaluated.
    - Edit the file setup.cfg. Near the end, in section '[install]', you will
    ? find the line 'prefix=/usr'. Replace the '/usr' by your chosen path.
    - Save the file and retry the install (see above).

    Best regards,

    ? G?nther
    Well, ok, I'll try some of that. But I am running window 7, not Linux.
    The "sudo" command sounds like Linux.
  • Eryksun () at Apr 1, 2011 at 8:05 pm

    On Friday, April 1, 2011 3:40:23 PM UTC-4, Manatee wrote:
    Well, ok, I'll try some of that. But I am running window 7, not Linux.
    The "sudo" command sounds like Linux.
    Again, there's a win32 exe installer available here:

    http://sourceforge.net/projects/pyvisa/files/PyVISA/1.3/PyVISA-1.3.win32.exe/download

    If your account is a standard user and the installer doesn't load a UAC prompt, you'll probably have to right-click it and choose to "Run as administrator".
  • Manatee at Apr 1, 2011 at 8:22 pm

    On Apr 1, 4:05?pm, "eryksun ()" wrote:
    On Friday, April 1, 2011 3:40:23 PM UTC-4, Manatee wrote:

    Well, ok, I'll try some of that. But I am running window 7, not Linux.
    The "sudo" command sounds like Linux.
    Again, there's a win32 exe installer available here:

    http://sourceforge.net/projects/pyvisa/files/PyVISA/1.3/PyVISA-1.3.wi...

    If your account is a standard user and the installer doesn't load a UAC prompt, you'll probably have to right-click it and choose to "Run as administrator".
    Aaaaahhhhhh... now we are getting somewhere. I had the wrong version.
    Ok, let me try accessing a simple instrument.
  • Manatee at Apr 2, 2011 at 2:24 am

    On Apr 1, 4:05?pm, "eryksun ()" wrote:
    On Friday, April 1, 2011 3:40:23 PM UTC-4, Manatee wrote:

    Well, ok, I'll try some of that. But I am running window 7, not Linux.
    The "sudo" command sounds like Linux.
    Again, there's a win32 exe installer available here:

    http://sourceforge.net/projects/pyvisa/files/PyVISA/1.3/PyVISA-1.3.wi...

    If your account is a standard user and the installer doesn't load a UAC prompt, you'll probably have to right-click it and choose to "Run as administrator".
    Ok, I have the correct version. I can run "from visa import *" and get
    no error. How ever when I run this command I get and error:

    My_Instrument = instrument("GPIB::5")

    Traceback (most recent call last):
    File "C:/Users/Rivetmr/MyPythonScripts/My_GPIB.py", line 2, in
    <module>
    my_instrument = instrument("GPIB::5")
    File "C:\Python27_32bit\lib\site-packages\pyvisa\visa.py", line 288,
    in instrument
    vpp43.parse_resource(resource_manager.session, resource_name)
    File "C:\Python27_32bit\lib\site-packages\pyvisa\vpp43.py", line
    777, in parse_resource
    byref(interface_board_number))
    File "C:\Python27_32bit\lib\site-packages\pyvisa\vpp43.py", line
    398, in check_status
    raise visa_exceptions.VisaIOError, status
    VisaIOError: VI_ERROR_INTF_NUM_NCONFIG: The interface type is valid
    but the specified interface number is not configured.

    My instrument is on GPIB 5 and I can do a *IDN? with another program
    and get a response. So I must still have something not configured
    correct. Getting closer though :)
  • Eryksun () at Apr 2, 2011 at 3:03 am

    On Friday, April 1, 2011 10:24:58 PM UTC-4, Manatee wrote:
    VisaIOError: VI_ERROR_INTF_NUM_NCONFIG: The interface type is valid
    but the specified interface number is not configured.

    My instrument is on GPIB 5 and I can do a *IDN? with another program
    and get a response. So I must still have something not configured
    correct. Getting closer though :)
    If you have more than one board, you might need a more complete resource name, such as 'GPIB1::5' for board 1. You can query the available instruments using get_instruments_list(), which calls the VISA library's viFindRsrc function.
  • P S at Apr 23, 2011 at 12:26 am
    I did a little writeup for setting PyVISA up in Windows. It's not exactly polished, but it can get you through the difficult bits. If you need any additional help, leave comments/questions on my blog.

    http://psonghi.wordpress.com/2011/03/29/pyvisa-setup-in-windows/
    On Friday, April 01, 2011 11:29 AM Manatee wrote:
    I have unpacked the PyVISA files into the Python/lib/site-packages dir
    and from the IDLE GUI I get and error

    import visa

    Traceback (most recent call last):
    File "<pyshell#25>", line 1, in <module>
    import visa
    ImportError: No module named visa



    There must be more to just putting the files in the correct directory.
    Need help configuring PyVISA to work.
    My ultimate goal is to control electronic instruments with Python
    through visa.
    On Friday, April 01, 2011 2:05 PM G?ntherDietrich wrote:
    Yes, there is more:

    - DON'T unpack the files into any site-packages folder. If you already
    have done it, remove them.
    - Unpack the PyVISA archive to any other folder.
    - On the command line, change into the PyVISA folder. There you should
    find - among others - the two files setup.py and setup.cfg (at least
    if you use PyVISA-1.3.tar.gz).
    - Now, it depends on what variant of python you use and want to install
    PyVISA for and on the configuration of your PYTHONPATH rsp. sys.path
    and the folders they point to.
    You can simply try: 'sudo python ./setup install'
    If you are lucky, that is it. If not, you have to decide, where the
    installation script has to put the files to. For example, for my
    python 2.6, I chose
    '/Library/Frameworks/Python.framework/Versions/2.6/'. In this path,
    there is a folder 'lib/site-packages', which is pointed to by
    sys.path, and where .pth files are evaluated.
    - Edit the file setup.cfg. Near the end, in section '[install]', you will
    find the line 'prefix=/usr'. Replace the '/usr' by your chosen path.
    - Save the file and retry the install (see above).



    Best regards,

    G??nther
    On Friday, April 01, 2011 3:40 PM Manatee wrote:
    .

    Well, ok, I will try some of that. But I am running window 7, not Linux.
    The "sudo" command sounds like Linux.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 1, '11 at 3:29p
activeApr 23, '11 at 12:26a
posts10
users5
websitepython.org

People

Translate

site design / logo © 2022 Grokbase