Problems installing PyUSB and running CF PC Client

Post here to get support
Post Reply
alex
Expert
Posts: 137
Joined: Mon Feb 18, 2013 11:36 am
Location: Germany

Problems installing PyUSB and running CF PC Client

Post by alex »

Hello dear community,

I installed Python 3.3.0, PyGame, PyQt, LibUSB successfully, but I haven't managed to install PyUSB 1.0, yet. Everytime I am trying to start the Crazyflie PC Client, the following message pops up:

Code: Select all

C:\Program Files (x86)\Crazyflie PC Client\cfclient>python cfclient.py
  File "cfclient.py", line 43
    print "No pyusb installation found, exiting!"
                                                ^
SyntaxError: invalid syntax
I used this to install PyUSB, but obviously that doesn't work:

Code: Select all

C:\Users\Alex\Downloads\Crazyflie\pyusb-1.0.0a2>python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
Removing C:\Program Files (x86)\Python 3.3.0\Lib\site-packages\pyusb-1.0.0a2-py3.3.egg-info
Writing C:\Program Files (x86)\Python 3.3.0\Lib\site-packages\pyusb-1.0.0a2-py3.3.egg-info
What's wrong? Can someone post a step-by-step guide for installing PyUSB? I guess some other users might have the same problem. Thank you very much!

-alex
Last edited by alex on Sun Feb 24, 2013 7:54 pm, edited 1 time in total.
TheFrog4u
Expert
Posts: 113
Joined: Fri Feb 08, 2013 6:59 pm
Location: Bremen, Germany

Re: Problems installing PyUSB and running CF PC Client

Post by TheFrog4u »

You have to install Phyton 2.7, see http://wiki.bitcraze.se/projects:crazyf ... ls:install
Phyton 2.x and 3.x are not compatible to each other.

Btw: This topic should be moved to the support board.
alex
Expert
Posts: 137
Joined: Mon Feb 18, 2013 11:36 am
Location: Germany

Re: Problems installing PyUSB and running CF PC Client

Post by alex »

Yeah, got it!

Thanks for your advice, that made me think about the versions: I only downloaded the newest version for Win7 32 bit for each of them before, that messed things up. You have to download Python v2.7.3 and the corresponding versions of PyQT, PyGame, PyUSB 1.0 and LibUSB that have been explicitly developed for this version of Python.

First install Python. If the installation program didn't already, add Python's installation folder to the PATH variable. This enables you to start Python from the command line, regardless of the folder you are in at the moment.

Now copy the libusb0.dll from the LibUSB zip (bin\x86 folder) to your C:\Windows\system32 folder. Afterwards, start the command line with administrative rights, switch to the PyUSB folder and install it by typing

Code: Select all

python setup.py install
After the installation process is finished, you are ready to start the Crazyflie PC Client by navigating to its cfclient folder and typing

Code: Select all

python cfclient.py
at the command prompt.

After a moment, the GUI should pop up. That's all. If someone wants to add or correct something, please let me know. Hope that's a little help for other Windows 7 users, too.


And of course, could an administrator move this topic to the support board? Thank you.
TheFrog4u
Expert
Posts: 113
Joined: Fri Feb 08, 2013 6:59 pm
Location: Bremen, Germany

Re: Problems installing PyUSB and running CF PC Client

Post by TheFrog4u »

yeah I also had a long time to go until I had it running :)

To edit your path variable:

1.Hold Win and press Pause.
2.Click Advanced System Settings.
3.Click Environment Variables.
4.Append ;C:\python27 to the Path variable

To open a terminal in a folder:

1. Hold shift and click the right mouse button on some emty space,
2. Select "open comand prompt here" in the popup menu

:)
alex
Expert
Posts: 137
Joined: Mon Feb 18, 2013 11:36 am
Location: Germany

Re: Problems installing PyUSB and running CF PC Client

Post by alex »

Thanks for completing, TheFrog4u.
Grazzhoppa
Beginner
Posts: 2
Joined: Sun Mar 31, 2013 12:59 am

Re: Problems installing PyUSB and running CF PC Client

Post by Grazzhoppa »

Okay i got through the steps above except for the very last step. I don't understand how to actually launch the pc client. I don't have a cfclient folder anywhere. I feel like I missed an entire download or something. Which download actually contains the pc client? I got python installed, pyusb as above, pyqt4 , and pygame. And I copied the dll as stated above. I'm sure its obvious but im not a programmer. Can someone guess what the hell im missing? An installer would be great! I'm sure when crazyflies actually start arriving , this place will be overrun with dummies like me.
alex
Expert
Posts: 137
Joined: Mon Feb 18, 2013 11:36 am
Location: Germany

Re: Problems installing PyUSB and running CF PC Client

Post by alex »

You have to download the Crazyflie PC Client from the Crazyflie code repository at

https://bitbucket.org/bitcraze/

Then unpack it to a folder of your choice. The folder "cfclient" mentioned is included in that archive. Navigate to that folder with the Windows command prompt and launch the PC Client by entering

Code: Select all

python cfclient.py
This should do the job and after some seconds, the control GUI of the Crazyflie should pop up.
For the command to work you have to add Python to your system's path variable according to TheFrog4U's instructions.

I highly recommend the pre-configured virtual machine available on the forum. All utilities and dependencies are pre-installed and ready to start developing. It's a charm to work with it. Give it a try!
Grazzhoppa
Beginner
Posts: 2
Joined: Sun Mar 31, 2013 12:59 am

Re: Problems installing PyUSB and running CF PC Client

Post by Grazzhoppa »

Got it , thanks. Havn't had a chance to check out the vm but I will. If its easier, maybe it should be included in the wiki? My apologies if its already in there but i didn't see
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Problems installing PyUSB and running CF PC Client

Post by tobias »

Great that you guys are helping each other out!
We are planning to update the wiki with the VM as well as a lot of other documentation but currently supporting the manufacturing is taking most of our time.
mbravo
Beginner
Posts: 4
Joined: Fri Sep 26, 2014 3:23 pm

Re: Problems installing PyUSB and running CF PC Client

Post by mbravo »

Sorry for necroposting; this thread seemed to be the most relevant.

I'm trying to figure out how to test dev-leapmotion with my crazyflie. Having had no luck with my main Mac laptop, I switched to an old windows one I had lying about.

Since I don't have an environment to compile binary distribution set up, I just installed python 2.7.8, all the necessary libs (including libusb/pyusb), and then cloned the pc-client repo and switched to the dev-leapmotion branch. After patching the empty/is_empty issue as mentioned elsewhere on the forum, I got leapmotion input working in the cliengt! However, it is not useful, as the client can't connect to crazyradio :( here's what happens:

Code: Select all

INFO:cfclient.utils.logconfigreader:Parsing [stabilizer.json]
INFO:cfclient.ui.tabs.FlightTab:Changed flightmode to Normal
INFO:cfclient.utils.leapreader:Connected
INFO:cflib.crtp.radiodriver:v0.5 dongle with serial N/A found
Traceback (most recent call last):
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cfclient\ui\dialogs\conn
ectiondialogue.py", line 120, in scan
    self.interfaceFoundSignal.emit(cflib.crtp.scan_interfaces())
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cflib\crtp\__init__.py",
 line 64, in scan_interfaces
    found = instance.scan_interface()
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cflib\crtp\radiodriver.p
y", line 222, in scan_interface
    self._scan_radio_channels())
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cflib\crtp\radiodriver.p
y", line 199, in _scan_radio_channels
    return list(self.cradio.scan_channels(start, stop, (0xff,)))
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cflib\drivers\crazyradio
.py", line 225, in scan_channels
    status = self.send_packet(packet)
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cflib\drivers\crazyradio
.py", line 242, in send_packet
    self.handle.write(1, dataOut, 0, 1000)
TypeError: write() takes at most 4 arguments (5 given)
at this point, the Connect dialog window just sits there, saying Scanning and all buttons grayed out. If I close the window and exit the client, that is what I get:

Code: Select all

INFO:cflib.crazyflie:Closing link
INFO:cflib.crazyflie:Callback->Disconnected from []
INFO:cfclient.utils.config:Config file saved to [C:\Users\mbravo\Dropbox\crazyfl
ie-pc-client\lib\..\conf/config.json]
Traceback (most recent call last):
  File "C:\Users\mbravo\Dropbox\crazyflie-pc-client\lib\cfclient\ui\main.py", li
ne 494, in closeAppRequest
    app.exit(0)
NameError: global name 'app' is not defined
Exception AttributeError: "'NoneType' object has no attribute 'usb_close'" in <bound method Device.__del__ of <DEVICE ID 1915:7777 on Bus 000 Address 001>> ignored
at the same time, cfclient from the 2014.01 binary distribution works just fine on the same laptop.

I suspect it is related somehow to pyusb/libusb, but I'm not sure and don't have deep enough knowledge to troubleshoot effectively.

Any pointers would be much appreciated!
Post Reply