version 3.3.1 on Mac OS X Yosemite "No backend available".

984 views
Skip to first unread message

monte freeman

unread,
Jan 14, 2016, 7:26:07 PM1/14/16
to weewx-user
I was given an AcuRite 5-In-1 02032C weather station as a birthday gift.
My goal is to be able to upload my weather data to Weather Underground.

I don't have anything in my house that runs Windows, so I can't use the AcuRite software. 

Ideally, I'd love to use my Mac mini; since it's on the same desk with my AcuRite's display.
The USB cable is plugged into the back of the AcuRite display and into one of the USB ports of my Mac.
I'm running OS X Yosemite 10.10.5

I followed the install instructions from the user guide here:

I installed pip 7.1.2, and used it to subsequently install 

Cheetah

pillow

pyserial

pyusb

pyephem


No errors of any kind were reported in the install of those additional packages.


My python version is:

python --version

Python 2.7.10



No errors displayed by

"./setup.py build"


I changed the install location in setup.cfg

#home = /home/weewx

home = /usr/local/weewx


No errors from the "./setup.py install" command.


The installer asked me for a name, altitude, lat/lon, etc. No errors were observed.


I'm running weewx by:


cd /use/local/weewx

./bin/weewxd ./weewx.conf


This gets me:


./bin/weewxd ./weewx.conf

Traceback (most recent call last):

  File "./bin/weewxd", line 64, in <module>

    weewx.engine.main(options, args)

  File "/usr/local/weewx/bin/weewx/engine.py", line 848, in main

    engine.run()

  File "/usr/local/weewx/bin/weewx/engine.py", line 182, in run

    for packet in self.console.genLoopPackets():

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 477, in genLoopPackets

    with Station() as station:

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 598, in __enter__

    self.open()

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 605, in open

    dev = self._find_dev(self.vendor_id, self.product_id, self.device_id)

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 937, in _find_dev

    for bus in usb.busses():

  File "/Library/Python/2.7/site-packages/usb/legacy.py", line 340, in busses

    _interop._sorted(core.find(find_all=True), key=lambda d: d.bus),

  File "/Library/Python/2.7/site-packages/usb/core.py", line 1199, in find

    raise ValueError('No backend available')

ValueError: No backend available

bash-3.2# 


I couldn't find any discussion about this error in any other posts here.  I'm not a Python programmer, so I'm not even sure where to start looking for the possible cause and/or fix.

Anyone have any suggestions/thoughts?


  -Monte

vince

unread,
Jan 14, 2016, 7:42:34 PM1/14/16
to weewx-user
A google for "mac core.py no backend available" has some promising hits you might read.....

Thomas Keffer

unread,
Jan 14, 2016, 7:44:13 PM1/14/16
to weewx-user
A little Googling around reveals this post on StackOverflow.

You need to install libusb. There are instructions on how to do this using both macports and brew. Whichever you use, make sure you install the "legacy" version. 

When you're done, perhaps you could write up an entry for our Wiki on how to install on the Mac?

-tk



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

monte freeman

unread,
Jan 14, 2016, 8:07:21 PM1/14/16
to weewx-user
This machine has libusb installed already via MacPorts. It's needed in order to run any of the SDR applications like Gqrx or CubicSDR. Both of which work just fine.

According to "port list installed", I have libusb version 1.0.20 installed.

Just because the code is on the box, doesn't mean that weewxd knows how to reference it I suppose..

 find / -iname libusb* -print

/Library/Python/2.7/site-packages/usb/backend/libusb0.py

/Library/Python/2.7/site-packages/usb/backend/libusb0.pyc

/Library/Python/2.7/site-packages/usb/backend/libusb1.py

/Library/Python/2.7/site-packages/usb/backend/libusb1.pyc

/opt/local/include/libusb-1.0

/opt/local/include/libusb-1.0/libusb.h

/opt/local/lib/libusb-1.0.0.dylib

/opt/local/lib/libusb-1.0.a

/opt/local/lib/libusb-1.0.dylib

/opt/local/lib/pkgconfig/libusb-1.0.pc


Setting debug = 1 in the .conf file didn't return any additional error messages beyond what I originally posted.


How do I determine if weewxd is trying to use the libusb version that's installed and failing, or not finding it at all?

mwall

unread,
Jan 14, 2016, 9:05:57 PM1/14/16
to weewx-user
On Thursday, January 14, 2016 at 8:07:21 PM UTC-5, monte freeman wrote:
This machine has libusb installed already via MacPorts. It's needed in order to run any of the SDR applications like Gqrx or CubicSDR. Both of which work just fine.

According to "port list installed", I have libusb version 1.0.20 installed.


monte,

you might try installing libusb 0.1.  it should install just fine alongside 1.0.x

you'll also need to verify which python installation is updated when you use pip versus easy_install versus ports versus brew.

all of the weewx drivers that use usb are written using the pyusb 0.4 api

supposedly pyusb does the abstraction to handle multiple backends (typically libusb 0.1 or libusb 1.0, but supposedly also openusb).  in practice we've had most reliable results with pyusb 0.1 and libusb 0.1.

once you get the right combination of pyusb/libusb that lets weewx see the device, we'll probably have to deal with getting the macosx kernel to unclaim the hid (usb) device.  i've done some experimentation with a kext, but that was on macosx 10.6.8.

m

monte freeman

unread,
Jan 14, 2016, 9:52:10 PM1/14/16
to weewx-user
mwall,

  Thanks. That seems to have helped some. Or at least it's changed the point where things fail.

  It seems that libusb 0.1 is referred to by MacPorts as "libusb-legacy". So doing a "port install libusb-legacy" gets me libusb-legacy-0.1.4.dylib.

  I'm not sure I follow what you mean by "verify which python installation is updated".... Is there likely to be more than one version installed?

  I also did "export DYLD_LIBRARY_PATH=/opt/local/lib", since that seems to be where all of the Python related libraries are installed.

  It's still failing, but now with different errors:

./bin/weewxd ./weewx.conf 

Traceback (most recent call last):

  File "./bin/weewxd", line 64, in <module>

    weewx.engine.main(options, args)

  File "/usr/local/weewx/bin/weewx/engine.py", line 848, in main

    engine.run()

  File "/usr/local/weewx/bin/weewx/engine.py", line 182, in run

    for packet in self.console.genLoopPackets():

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 477, in genLoopPackets

    with Station() as station:

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 598, in __enter__

    self.open()

  File "/usr/local/weewx/bin/weewx/drivers/acurite.py", line 623, in open

    self.handle.detachKernelDriver(interface)

  File "/Library/Python/2.7/site-packages/usb/legacy.py", line 294, in detachKernelDriver

    self.dev.detach_kernel_driver(interface)

  File "/Library/Python/2.7/site-packages/usb/core.py", line 1005, in detach_kernel_driver

    interface)

  File "/Library/Python/2.7/site-packages/usb/backend/libusb1.py", line 838, in detach_kernel_driver

    _check(self.lib.libusb_detach_kernel_driver(dev_handle.handle, intf))

  File "/Library/Python/2.7/site-packages/usb/backend/libusb1.py", line 550, in _check

    raise NotImplementedError(_strerror(ret))

NotImplementedError: Operation not supported or unimplemented on this platform

bash-3.2# 

monte freeman

unread,
Jan 14, 2016, 9:54:30 PM1/14/16
to weewx-user
I've also found a blog post from someone who seems to have weewx running on OS X Yosemite; but he makes no mention of specifics of libusb versions...

mwall

unread,
Jan 14, 2016, 10:14:55 PM1/14/16
to weewx-user
On Thursday, January 14, 2016 at 9:52:10 PM UTC-5, monte freeman wrote:
  It seems that libusb 0.1 is referred to by MacPorts as "libusb-legacy". So doing a "port install libusb-legacy" gets me libusb-legacy-0.1.4.dylib.

good.  at some point we might need a usb abstraction in weewx to make this all work automagically.  jim easterbrook has done this in pywws (see the device_*.py files in src/pywws).  it is a bit more of a challenge in weewx since we support more than 50 different hardware variants, while pywws supports only two.
 
  I'm not sure I follow what you mean by "verify which python installation is updated".... Is there likely to be more than one version installed?

i've had some machines that end up with some stuff in /sw, other stuff in /opt, other stuff in /usr/local, other stuff in /Library, and other stuff in /System

usually only a problem if you do not do a clean install of the system every once in awhile, or if you use all of brew and pip and ports across major operating system releases.


this is because there is no detach_kernel_driver method for macosx.  on linux, detach_kernel_driver makes the kernel release its claim on usb device.

as a workaround, in weewx/drivers/acurite.py change this:

        # for linux systems, be sure kernel does not claim the interface       
        try:
            self.handle.detachKernelDriver(interface)
        except (AttributeError, usb.USBError):
            pass

to this:

        # for linux systems, be sure kernel does not claim the interface       
        try:
            self.handle.detachKernelDriver(interface)
        except (NotImplementedError, AttributeError, usb.USBError):
            pass


on some platforms/systems/versions this comes through as an AttributeError, but in your case it is a NotImplementedError.

next up will be to get the kernel to release the HID...

m

monte freeman

unread,
Jan 14, 2016, 10:28:54 PM1/14/16
to weewx-user
Ah-HA! Good call! 
Both on the suggested change, and on the kernel HID issue.
weewxd now stays running, and is logging the following to /var/log/system.log:

Jan 14 22:20:33 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:20:33 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 1 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:21:03 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:21:03 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 2 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:21:33 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:21:33 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 3 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:22:03 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:22:03 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 4 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:22:33 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:22:33 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 5 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:23:03 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:23:03 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 6 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:23:33 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:23:33 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 7 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:24:03 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:24:03 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 8 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:24:33 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:24:33 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 9 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:25:03 admins-MacBook-Pro.local weewx[3360]: acurite: Unable to claim USB interface 0: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:25:03 admins-MacBook-Pro.local weewx[3360]: acurite: Failed attempt 10 of 10 to get LOOP data: [Errno 13] Access denied (insufficient permissions)

Jan 14 22:25:33 admins-MacBook-Pro.local weewx[3360]: acurite: Max retries (10) exceeded for LOOP data

Jan 14 22:25:33 admins-MacBook-Pro.local weewx[3360]: engine: Caught WeeWxIOError: Max retries (10) exceeded for LOOP data

Jan 14 22:25:33 admins-MacBook-Pro.local weewx[3360]:     ****  Waiting 60 seconds then retrying...

mwall

unread,
Jan 14, 2016, 10:46:04 PM1/14/16
to weewx-user
On Thursday, January 14, 2016 at 10:28:54 PM UTC-5, monte freeman wrote:
Ah-HA! Good call! 
Both on the suggested change, and on the kernel HID issue.


see if we get lucky. try running with sudo:

sudo ./bin/weewxd ./weewx.conf

if you still get the 'access denied', then you'll have to figure out how to make and install a kext (do some googling).  the idea is to have a dummy kernel extension that claims the usb device before the macosx kernel gets it.  then when weewx tries to claim the weather station, the kernel won't interfere.  the reason this is an issue is because the acurite weather stations show up as a HID (human interface device), i.e., a mouse or a keyboard, instead of as a weather station.  acurite is not the only vendor to do this - they all do it to save money and to avoid having to write custom usb drivers.  on linux, the detach_kernel makes the kernel release the device.  unfortunately there is no equivalent method for macosx.  and to complicate things further, there is not yet a standard fake kext that will work across all versions of macosx.

m

mwall

unread,
Jan 14, 2016, 10:55:54 PM1/14/16
to weewx-user
i think i have posted these before, but here is the plist for a codeless extension plus a readme that explains the basic idea.

Info.plist
readme.txt

monte freeman

unread,
Jan 14, 2016, 11:09:26 PM1/14/16
to weewx-user
I was already running as root.
I'd done "sudo bash" early on in this tonight, thinking there may be permission problems


id

uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),701(com.apple.sharepoint.group.1),703(com.apple.sharepoint.group.3),702(com.apple.sharepoint.group.2),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh)

bash-3.2# ./weewxd ../weewx.conf



Writing a kernel extension is way above my skill level. I'm not a programmer. :(


Sounds like I'm out of luck with getting the acurite to communicate with Weather Underground through my Mac. 

I don't really want to have another full computer running, just for this purpose.


I wonder how the Mike Revitt at https://www.cougar.eu.com/useful-guides/weewx-guides/weewx-installation-on-osx-2.html is getting around the problem?

He seems to have it working.


Mike, are you by chance monitoring this mailing list?


 -Monte

mwall

unread,
Jan 14, 2016, 11:24:05 PM1/14/16
to weewx-user
On Thursday, January 14, 2016 at 11:09:26 PM UTC-5, monte freeman wrote:
Writing a kernel extension is way above my skill level. I'm not a programmer. :(


Sounds like I'm out of luck with getting the acurite to communicate with Weather Underground through my Mac. 

I don't really want to have another full computer running, just for this purpose.


it may not be as bad as you think - no coding required.  the codeless kext is simply a plist.  the trick is to get the parameters right, put it in the right location, then do the right invocation to load it.  see the readme file.  it includes additional references for various macosx versions.

m

mwall

unread,
Jan 14, 2016, 11:28:47 PM1/14/16
to weewx-user
On Thursday, January 14, 2016 at 11:09:26 PM UTC-5, monte freeman wrote:
I wonder how the Mike Revitt at https://www.cougar.eu.com/useful-guides/weewx-guides/weewx-installation-on-osx-2.html is getting around the problem?

He seems to have it working.


mike is using a vantage station, which uses a usb-serial converter.  those show up as a serial port, not a HID.

monte freeman

unread,
Jan 14, 2016, 11:42:29 PM1/14/16
to weewx-user
In the event it will be of some benefit in the future to someone more skilled than me, I'm going to add this information to this thread, since it seems relevant..

Running System Information, and looking in the USB section with the acurite console plugged into a USB port; gets me this:

 Chaney Instrument:


  Product ID: 0x0003

  Vendor ID: 0x24c0

  Version: 0.20

  Speed: Up to 1.5 Mb/sec

  Location ID: 0xfd120000 / 4

  Current Available (mA): 500

  Current Required (mA): 100


 I'm pretty sure this is the acurite console, since this entry goes away if I unplug the USB cable; and the bottom of the back page of the owners manual that came with the hardware references "Copyright Chaney Instrument Company"


 Running "ioreg -p IOUSB |grep -i chaney" gets me:


ioreg -p IOUSB |grep -i chaney

      +-o Chaney Instrument@fd120000  <class IOUSBDevice, id 0x10000126b, registered, matched, active, busy 0 (682 ms), retain 10>


 I realize this is the user mailing list, not the development mailing list; but there are likely developers who read this.  If my acurite hardware connected to my MacBook Pro can be of any assistance in furthering development of weewx to make it more stable for OS X; get in touch with me.  Maybe we can work out some kind of access while I research finding a way to achieve my goal.

monte freeman

unread,
Jan 14, 2016, 11:46:36 PM1/14/16
to weewx-user
Hmm. OK. 
:-)

I'll install more caffeine and a fresh set of contact lenses and have a closer look at the two files you posted.
Maybe I can come up with something that works and can contribute it back to the project.
Thanks for the encouragement and assistance! :-)

monte freeman

unread,
Jan 15, 2016, 5:01:16 PM1/15/16
to weewx-user
I've gotta be doing something wrong. No matter how I try to download the "Info.plist" file you attached; I get an empty folder. 
Somehow that doesn't seem right... Is it?
What am I missing?


On Thursday, January 14, 2016 at 10:55:54 PM UTC-5, mwall wrote:

mwall

unread,
Jan 15, 2016, 5:37:27 PM1/15/16
to weewx-user
On Friday, January 15, 2016 at 5:01:16 PM UTC-5, monte freeman wrote:
I've gotta be doing something wrong. No matter how I try to download the "Info.plist" file you attached; I get an empty folder. 
Somehow that doesn't seem right... Is it?
What am I missing?

don't know - something on your system is probably trying to be helpful and fscking things up instead. 

a plist is simply a text file.  here are the contents of this one:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>com.apple.kpi.iokit</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>CodelessKext</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>CodelessKext</key>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>com.apple.kpi.iokit</string>
            <key>IOClass</key>
            <string>IOService</string>
            <key>IOProviderClass</key>
            <string>IOUSBInterface</string>
            <key>idProduct</key>
            <integer>3</integer>
            <key>idVendor</key>
            <integer>9408</integer>
            <key>bInterfaceNumber</key>
            <integer>0</integer>
            <key>bConfigurationValue</key>
            <integer>1</integer>
        </dict>
    </dict>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2015 Matthew Wall. All rights reserved.</string>
</dict>
</plist>
 

monte freeman

unread,
Jan 15, 2016, 9:28:22 PM1/15/16
to weewx-user
It seems that starting with Yosemite, Apple no longer allows non-signed kexts to be loaded.
So even though I have a "coddles kext" based on mall's template that I want to try; the system refuses to load it:

admin$ sudo kextutil -tn /System/Library/Extensions/CodelessKext.kext

Diagnostics for /System/Library/Extensions/CodelessKext.kext:

Code Signing Failure: not code signed

/System/Library/Extensions/CodelessKext.kext appears to be loadable (including linkage for on-disk libraries).

Reply all
Reply to author
Forward
0 new messages