pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
288 stars 124 forks source link

PYVISA-py visa.ResourceManager('@py') not working. rm.list_resources() not working #78

Closed iitmrohan closed 6 years ago

iitmrohan commented 8 years ago

The package was working fine 2 days ago. Suddenly from yesterday rm.list_resources() is throwing errors. Since I know the instrument address from when everything was working fine earlier I can communicate with the device. However I cant id any new device connected. This is what I use to establish connection import visa rm = visa.ResourceManager('@py') rm.list_resources() scope = rm.open_resource('USB0::1689::874::C037144::0::INSTR') However step 3 is throwing error since yesterday. Details are as follows rohan@Jarvis:~$ python -m visa info Machine Details: Platform ID: Linux-3.13.0-76-generic-x86_64-with-Ubuntu-14.04-trusty Processor: x86_64

Python: Implementation: CPython Executable: /usr/bin/python Version: 2.7.6 Compiler: GCC 4.8.2 Bits: 64bit Build: Jun 22 2015 17:58:13 (#default) Unicode: UCS4

PyVISA Version: 1.8

Backends: ni: Version: 1.8 (bundled with PyVISA)

1: /usr/lib/x86_64-linux-gnu/libvisa.so.0.0.0:

     found by: auto
     bitness: 64
     Could not get more info:
        VI_ERROR_NSUP_ATTR (-1073807331): The specified attribute is not defined or supported by the referenced object.

py: Version: 0.3.dev0 ASRL INSTR: Available via PySerial (3.0.1) TCPIP INSTR: Available USB RAW: Available via PyUSB (1.0.0b2). Backend: libusb1 USB INSTR: Available via PyUSB (1.0.0b2). Backend: libusb1 GPIB INSTR: Available via Linux GPIB (4.0.2) TCPIP SOCKET: Available sim: Version: 0.3 Spec version: 1.1

I'll also attach a pip list rohan@Jarvis:~$ pip list adium-theme-ubuntu (0.3.4) apt-xapian-index (0.45) argparse (1.2.1) astroid (1.0.1) chardet (2.0.1) colorama (0.2.5) command-not-found (0.3) debtagshw (0.1) decorator (3.4.0) defer (1.0.6) dirspec (13.10) dnspython (1.11.1) docutils (0.11) duplicity (0.6.23) enum34 (1.1.2) gpib (1.0) html5lib (0.999) httplib2 (0.8) ipython (1.2.1) Jinja2 (2.7.2) lockfile (0.8) logilab-common (0.61.0) lxml (3.3.3) MarkupSafe (0.18) matplotlib (1.3.1) mercurial (2.8.2) numpy (1.8.2) oauthlib (0.6.1) oneconf (0.3.7.14.04.1) PAM (0.4.2) pep8 (1.4.6) pexpect (3.1) Pillow (2.3.0) pip (1.5.4) piston-mini-client (0.7.5) psutil (1.2.1) py (1.4.20) pycrypto (2.6.1) pycups (1.9.66) pycurl (7.19.3) pyflakes (0.8.1) Pygments (1.6) pygobject (3.12.0) pygpgme (0.3) pylint (1.1.0) pyOpenSSL (0.13) pyparsing (2.0.1) pyserial (3.0.1) pysmbc (1.0.14.1) python-apt (0.9.3.5ubuntu2) python-dateutil (1.5) python-debian (0.1.21-nmu2ubuntu2) pytz (2012c) pyusb (1.0.0b2) PyVISA (1.8) PyVISA-py (0.3.dev0) PyVISA-sim (0.3) pyxdg (0.25) PyYAML (3.11) pyzmq (14.0.1) reportlab (3.0) requests (2.2.1) roman (2.0.0) rope (0.9.2) scipy (0.13.3) sessioninstaller (0.0.0) setuptools (3.3) simplegeneric (0.8.1) six (1.5.2) software-center-aptd-plugins (0.0.0) Sphinx (1.2.2) spyder (2.2.5) ssh-import-id (3.21) stringparser (0.4.1) system-service (0.1.6) Twisted-Core (13.2.0) Twisted-Web (13.2.0) unity-lens-photos (1.0) urllib3 (1.7.1) usbtc08 (0.1.1) wheel (0.24.0) wsgiref (0.1.2) xdiagnose (3.6.3build2) zope.interface (4.0.5)

dalonsoa commented 8 years ago

Same problem here:

import visa rm = visa.ResourceManager('@py') rm.list_resources() Traceback (most recent call last): File "<pyshell#2>", line 1, in rm.list_resources() File "/usr/lib/python3/dist-packages/pyvisa/highlevel.py", line 1560, in list_resources return self.visalib.list_resources(self.session, query) File "/usr/lib/python3/dist-packages/pyvisa/highlevel.py", line 669, in list_resources raise NotImplementedError NotImplementedError

I am afraid I don't have any known device address to test if it works directly.

Best wishes

hgrecco commented 8 years ago

Have you installed from github or PyPI?

dalonsoa commented 8 years ago

In my case, from the Ubuntu repositories. They should be pretty updated, but I admit it might be a bug solved in newer versions. The one installed is 0.1-2.

iitmrohan commented 8 years ago

Hi everyone, @hgrecco : I installed with pip () The issue has been resolved for now. I uninstalled the linux-gpib library which I had compiled from source. I'm using a Tektronix TDS2024B DSO which I can connect via USB so pyVisa works fine if pyUSB is present. I'll try installing linux - gpib via pip and then observe what happens. Also I observed that my python packages were 'fragemented' . Used to use apt-get earlier, so there were some conflicts in some cases where pip wouldn't correctly id some packages installed via apt-get and vice versa. I removed everything related to pyVisa like pyVisa, pyVisa-py, pyVisa-sim, pyserial, pyusb and reinstalled via pip. People may try this solution.For the most part I followed the steps listed here by @hgrecco : http://python-in-the-lab.blogspot.in/2014/10/communicating-with-instruments-using.html The only difference I see now is that rm.list_resources() outputs just the USB instrument connected whereas earlier I would see a whole bunch of other stuff with the USB instrument listed last.

dalonsoa commented 8 years ago

Solved!

Un-installing the version of pyvisa and pyvisa-py in the repositories and re-installing them with pip solved the problem. Definitely it looks as a bug in the older version available in Ubuntu repositories.

Many thanks

manuelgodoy commented 8 years ago

I have a similar problem when running the list_resources() function:

import visa
rm = visa.ResourceManager('@py')
rm.list_resources()
(u'ASRL/dev/cu.Bluetooth-Incoming-Port::INSTR',)
##
rm2 = visa.ResourceManager()
rm2.list_resources()
(u'ASRL1::INSTR', u'GPIB0::12::INSTR', u'GPIB1::7::INSTR', u'GPIB2::8::INSTR')

As you can see, if I run the ResourceManager() using the NI backend, I can read all the instruments. However if I use the py backend I am out of luck.

rakansha commented 8 years ago

Hi everyone!! I installed and upgraded py visa as well as its python -py backend and Py USB all through pip. When I try to run rm=visa.REsourceManager('@py'), I get

_Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8-py2.7.egg/pyvisa/highlevel.py", line 1488, in new visa_library = open_visa_library(visa_library) File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8-py2.7.egg/pyvisa/highlevel.py", line 1457, in open_visa_library cls = get_wrapper_class(wrapper) File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8-py2.7.egg/pyvisa/highlevel.py", line 1441, in get_wrapper_class raise ValueError('Wrapper not found: No package named pyvisa-%s' % backend_name) ValueError: Wrapper not found: No package named pyvisa-py _ Thanks for your time

hgrecco commented 8 years ago

I cannot reproduce this. Any others getting the same thing?

manuelgodoy commented 8 years ago

Are you on a linux? @hgrecco I am on Mac

rakansha commented 8 years ago

@hgrecco and @manuelgodoy Its sorted now. Thanks. Yes I am on Linux.

Harshit1622 commented 6 years ago

Hello rakansha,

I am also facing the same error (Wrapper not found: No package named pyvisa-py).

Can you guide us for solution? How you sorted out?

Regards, Harshit