Linux Mint ImportError: No module named hid

790 views
Skip to first unread message

Alex Gajewski

unread,
Jul 2, 2013, 5:23:41 PM7/2/13
to plove...@googlegroups.com
I'm using Linux Mint 15, the installation went fine, but when I run Plover, I get the error message "ImportError: No module named hid".  Any ideas?

Hesky Fisher

unread,
Jul 2, 2013, 9:42:54 PM7/2/13
to plove...@googlegroups.com
Which instructions did you follow?


On Tue, Jul 2, 2013 at 5:23 PM, Alex Gajewski <aga...@gmail.com> wrote:
I'm using Linux Mint 15, the installation went fine, but when I run Plover, I get the error message "ImportError: No module named hid".  Any ideas?

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

Alex Gajewski

unread,
Jul 2, 2013, 10:09:20 PM7/2/13
to plove...@googlegroups.com
The Ubuntu instructions, as with most programs I've used, Ubuntu instructions tend to work.

Hesky Fisher

unread,
Jul 2, 2013, 10:28:46 PM7/2/13
to plove...@googlegroups.com
I meant to say, did you follow the current set of instructions here:

It has instructions for installing the hid package.


On Tue, Jul 2, 2013 at 10:09 PM, Alex Gajewski <aga...@gmail.com> wrote:
The Ubuntu instructions, as with most programs I've used, Ubuntu instructions tend to work.

Alex Gajewski

unread,
Jul 3, 2013, 8:29:53 AM7/3/13
to plove...@googlegroups.com
Thanks, but now I get an error when building hid: hid-libusb.c:43:20: fatal error: libusb.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

What's wrong with libusb?

Hesky Fisher

unread,
Jul 3, 2013, 9:25:22 AM7/3/13
to plove...@googlegroups.com
Hi Alex,

Sorry this is causing you so  much trouble. I am working to make it better. In the meantime, please try running this command:
sudo apt-get install libusb-1.0-0-dev

And then try continuing from building hid. 

Please let me know how this goes so I can update the instructions.

Hesky

Brent Nesbitt

unread,
Jul 3, 2013, 9:43:28 AM7/3/13
to plove...@googlegroups.com

Note: at the end of the instructions it says "now you should be able to run python."  I think you meant to say plover.

Hesky Fisher

unread,
Jul 3, 2013, 10:36:46 AM7/3/13
to plove...@googlegroups.com
Oops. Thanks and fixed.

Alex Gajewski

unread,
Jul 3, 2013, 1:50:34 PM7/3/13
to plove...@googlegroups.com
now there's the error (still building hid) /usr/bin/ld: cannot find -ludev
collect2: error: ld returned 1 exit status

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Why?

Hesky Fisher

unread,
Jul 3, 2013, 4:03:42 PM7/3/13
to plove...@googlegroups.com
OK, progress.

Now you need to run this and try again:
sudo apt-get install libudev-dev

I've update the instructions to include these two packages. Thanks for the report.

Alex Gajewski

unread,
Jul 3, 2013, 5:21:05 PM7/3/13
to plove...@googlegroups.com
This time the installation went without a glitch, but now when I run Plover I get the error ImportError: /usr/local/lib/python2.7/dist-packages/hid.so: undefined symbol: libusb_open

Any suggestions?

Daniel Langlois

unread,
Jul 4, 2013, 5:09:49 AM7/4/13
to plove...@googlegroups.com
I'm inclined to juxtapose this thread, with the Plover Aviary thread here:

A 'sharpertongue' has been trying to install Plover on Linux since Friday. The thread has grown to 18 posts. The guy is wonderfully serene and patient. I'm hoping to learn from his example. He hasn't succeeded yet. I'm leaning towards my own recommendation, in this thread:

In part: 'I had suggested rolling back support for Treal, which I still think might be soberly considered--what would be the way to accomplish a controlled upgrade?' But I suppose that we can and probably will go on like this, with nobody being able to install Plover on Linux, indefinitely, especially if the big picture is not documented clearly. --Plover doesn't work on Linux. Another iteration of the installation instructions, would be better accomplished offline? There are tradeoffs to each alternative. Point is, for me, what is easiest, in like of all the info. 

Daniel Langlois

unread,
Jul 4, 2013, 6:07:30 AM7/4/13
to plove...@googlegroups.com
Also, what about 'undefined symbol: libusb_open'

I'm not sure you're on i386 architecture? Especially, when I note this (above): 
'error: command 'x86_64-linux-gnu-gcc' failed with exit status 1'

If you're using x86-64, then I'm thinking wrong architecture, when I look at this:

--
line 6: os.environ['LDFLAGS'] = "-L/usr/lib/i386-linux-gnu -lusb-1.0 -ludev -lrt"
--

On the other hand, I'm just fishing, and while we are looking at this setup.py, I notice this:
--
line 5: os.environ['CFLAGS'] = "-I/usr/include/libusb-1.0"
--

I'd be surprised if this matches the library paths for your arch. Setup links explicitly with usb-1.0 and therefore, is written poorly. Everybody is a critic, but I wonder, anyways, what version of libusb is installed on your box, and where its so lies. These lines may need to be corrected. Or, you could try setting the runtime library search path, there are multiple ways to do that, and I'm not sure we're even on the right track (of course I'm sure--yes, I'm always right, but still..).

Do we know the Cython world, quite well (not me)?

I see the setup function in this setup.py:
line 8: setup(
line 9:    cmdclass = {'build_ext': build_ext},
line 10:    ext_modules = [Extension("hid", ["hid.pyx", "hid-libusb.c"])]
line 11:)

No linker flags, here. Which, we might start by having you determine what they should be. But I'm inclined to summarize. This is a linker problem. Actually, another point is that if we're using gcc, then the linker is sensitive to the order in which libraries are specified..


Alex Gajewski

unread,
Jul 4, 2013, 9:15:09 AM7/4/13
to plove...@googlegroups.com
Wat, first of all, hid installed properly this time. It's plover, that can't find libusb. And also, I've been running 64-bit this entire time.

Hesky Fisher

unread,
Jul 4, 2013, 9:50:33 AM7/4/13
to plove...@googlegroups.com
Hi Alex,

Daniel is saying that the setup.py for cython-hidapi is set up for i386 machines and so compiled the wrong library for your machine. That's why plover couldn't find the function 'libusb_open'. It's there but for the wrong architecture.

Please try this. FIrst make sure you have /usr/lib/x86_64-linux-gnu. If you do, go into the cython-hidapi directory and edit setup.py. Replace /usr/lib/i386-linux-gnu with /usr/lib/x86_64-linux-gnu. The line should now read: 
os.environ['LDFLAGS'] = "-L/usr/lib/x86_64-linux-gnu -lusb-1.0 -ludev -lrt"

Then, from inside that directory run again:
python setup.py build
sudo python setup.py install

Then try running plover and let us know how it goes.

Hesky


On Thu, Jul 4, 2013 at 9:15 AM, Alex Gajewski <aga...@gmail.com> wrote:
Wat, first of all, hid installed properly this time. It's plover, that can't find libusb. And also, I've been running 64-bit this entire time.

Jeremy Kahn

unread,
Jul 4, 2013, 12:46:16 PM7/4/13
to plove...@googlegroups.com

Hesky,

I think Daniel's right, though he shares my bad habit of too many words:
Treal support should be rolled back on master.

Bringing in the hid requirement by default breaks Linux installation badly (and likely other architectures too). It should be removed from master to a development branch until the supporting library installation concerns are resolved.

Daniel and Thomas are both working on Debian/Ubuntu packaging, and this puts a real blocker in their way.

One alternative would be to use setuptools' "extras" functionality so that default installs don't require the hid packages.

Jeremy

Hesky Fisher

unread,
Jul 4, 2013, 1:56:53 PM7/4/13
to plove...@googlegroups.com
Thanks to everyone for the feedback. I've submitted a change that makes treal support optional. 

Alex: Please download the latest version of plover and try again. If you still have the plover directory then:
cd ~/plover
git pull origin master
sudo python setup.py install

Alex Gajewski

unread,
Jul 4, 2013, 2:31:03 PM7/4/13
to plove...@googlegroups.com
Thanks for all the support, but now there's a different error: "ImportError: No module named json_dict

Hesky Fisher

unread,
Jul 4, 2013, 2:50:56 PM7/4/13
to plove...@googlegroups.com
Sorry about that. I've fixed it. Please try again:
cd ~/plover
git pull origin master
sudo python setup.py install

Alex Gajewski

unread,
Jul 4, 2013, 5:18:28 PM7/4/13
to plove...@googlegroups.com
It works!!! Thanks for all the help! Now if I may ask one more question, which nkroll keyboard would you suggest? A sidewinder?

Mirabai Knight

unread,
Jul 4, 2013, 6:18:21 PM7/4/13
to ploversteno

Finally a question I can answer! A Sidewinder X4 is the cheapest compatible Plover keyboard (and works via USB), but it also works with a Filco Majestouch via USB, and a Das Keyboard via PS/2. Other n-key rollover keyboards might well work, though there are no guarantees. Many will work only via PS/2 and not USB.

Alex Gajewski

unread,
Jul 4, 2013, 8:14:05 PM7/4/13
to plove...@googlegroups.com
Great! I'll get myself a sidewinder then. Thanks a lot.
Reply all
Reply to author
Forward
0 new messages