1 2 Previous Next 17 Replies Latest reply on Sep 22, 2015 1:16 PM by Intel_Alvarado

    Pygame on Edison


      So I have been asking around on a few different related threads but have decided to pull all the information I have so far into a single thread.


      I am trying to get Pygame installed on an Edison.


      My first attempt was just by seeing if Python-pygame was available in the standard repo and installing using opkg. The standard repo does not include that module so that was a dead end.


      Then I tried using PIP which I got working by following this thread:




      Once PIP was installed:

      # pip install Pygame
      Downloading/unpacking Pygame
        Could not find any downloads that satisfy the requirement Pygame
        Some externally hosted files were ignored (use --allow-external Pygame to allow).
      Cleaning up...
      No distributions at all found for Pygame
      Storing debug log for failure in /home/root/.pip/pip.log


      I then tried again with --allow-external and again with --allow-unverified


      root@VaneScope2:~# pip install Pygame --allow-unverified Pygame
      Downloading/unpacking Pygame
        Pygame is potentially insecure and unverifiable.
        HTTP error 400 while getting http://www.pygame.org/../../ftp/pygame-1.6.2.tar.bz2 (from http://www.pygame.org/download.shtml)
      Cleaning up...
      Traceback (most recent call last):
        File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
          status = self.run(options, args)
        File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 278, in run
          requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
        File "/usr/lib/python2.7/site-packages/pip/req.py", line 1197, in prepare_files
        File "/usr/lib/python2.7/site-packages/pip/req.py", line 1375, in unpack_url
        File "/usr/lib/python2.7/site-packages/pip/download.py", line 547, in unpack_http_url
        File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/models.py", line 795, in raise_for_status
          raise HTTPError(http_error_msg, response=self)
      HTTPError: 400 Client Error: Bad Request


      So it seems the installing Pygame via PIP is also broken. Anyone have any other advice?

        • 1. Re: Pygame on Edison

          Hi Banq,

          AlexT_Intel has made a package repository for Edison. I suggest you to check it to see if the pygame is available http://repo.opkg.net/edison/repo/ .



          • 2. Re: Pygame on Edison

            Not yet, but I already requested it on his thread.

            • 3. Re: Pygame on Edison

              I haven't yet had a chance to check it out in full, have you tried the method they describe in the source tarball?

              Installing From Source

              Compiling and installing pygame is handled by Python's distutils. Pygame also comes with some scripts to automatically configure the flags needed to build pygame. Use the "setup.py" script to start the installation.

              The first time you run the setup script, it will call the "config.py" script. This will build a "Setup" file which stores all the information needed to compile. The "config.py" will do a good job of detecting what dependencies are available and where they are located. If it isn't perfect, it is easy to build your own, or edit the created "Setup" text file. This "Setup" file is a simple Makefile-like text file. It defines variables needed to use each dependency, and then enables all the pygame modules with found dependencies. If you have trouble compiling, you should be able to easily fix any problems inside the "Setup" file. Running the "setup.py" script will call distutils to build and install the pygame package. Distutils actually supports a wide variety of compile and install options. running "python setup.py help" will start to show you the different options available. You can change many things like install locations, compiler to use, and more. Calling the "setup.py" script with no arguments and it will just ask you if you want the default flags needed to compile and install.

              • 4. Re: Pygame on Edison
                WARNING, No "Setup" File Exists, Running "config.py"
                Using UNIX configuration...
                Hunting dependencies...
                sh: sdl-config: not found
                WARNING: "sdl-config" failed!
                sh: smpeg-config: not found
                WARNING: "smpeg-config" failed!
                Unable to run "sdl-config". Please make sure a development version of SDL is installed.

                Just tried that. This is the error I got. Digging into it now.

                • 5. Re: Pygame on Edison

                  Okay, SDL library is there, but smpeg may be a problem due to dependencies.


                  By the way, AFAICS Pygame is sort of intended to be used on devices with graphics cards (though I've seen a couple of headless mentions) - you are going to use it in that headless mode, aren't you?

                  • 6. Re: Pygame on Edison

                    I will be using it in headless mode.


                    I am using it to capture a bunch of images using a webcam. I've also been looking into OpenCV as well but haven't gotten around to really testing it out.

                    • 7. Re: Pygame on Edison

                      Banq, let's see, the below will build the minimal version without some of the dependencies, is that good enough for you?


                      1) prepare dependencies

                      opkg install libsdl-1.2-dev libv4l-dev

                      ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h

                      2) download and unpack the pygame tarball

                      3) go to the unpacked directory

                      4) configure, build and install pygame (it will show you which dependencies it found and enabled and which not):

                      python setup.py

                      • 8. Re: Pygame on Edison

                        I am using it to capture a bunch of images using a webcam.

                        Well, then I'd strongly recommend using something like OpenCV or v4lgrab as the simplest form. Or fswebcam.


                        Using a gaming framework for that seems like quite an overkill

                        • 9. Re: Pygame on Edison

                          I've just added fswebcam (sanslogic - fswebcam) into the package repo, give it a try, it may be easier to use than pygame

                          • 10. Re: Pygame on Edison

                            Thanks again for all your help. I'll try it all out on Monday.


                            EDIT: Everything is up and running. All thanks to your repo, AlexT_Intel. Now I just need to get the image that includes UVC drivers installed. Thanks!

                            • 11. Re: Pygame on Edison

                              Oh, that's cool, glad you have it running

                              I do have such an image and will try to publish it next weekend time permits.


                              In general, you might be able to convert your installation of the officially released image into the one with uvcvideo, because the package repo is built based on configuration of cush an image and it has a kernel package with necessary options enabled + uvcvideo module package and a couple fo others (ftdi_sio, gspca_pac207).


                              But you should know what you're doing and be ready to reflash the board from scratch or get down to messing up with the kernel files and symlinks as it's a bit non-trivial process which may easily break on you in the middle. So if you're brave (and prepared) enough, you can try it, if not, like I said I'll try to publish a normal OTA-flashable image next weekend.

                              • 12. Re: Pygame on Edison

                                After I finish the first command "opkg install libsdl-1.2-dev libv4l-dev", I cannot find the file /usr/include/libv4l1-videodev.h. Did you meet the problem before? Could you help out here if you know how to solve this problem?

                                • 13. Re: Pygame on Edison

                                  haha199342,looks like in Rel 2.1 sources this header file is in v4l-utils-dev package, so just install that one in addtion and you should be good.

                                  • 14. Re: Pygame on Edison

                                    after running the command "opkg install libsdl-1.2-dev libv4l-dev" it says:


                                    Unknown package 'libsdl-1.2-dev'.

                                    Package libv4l-dev (1.0.1-r0) installed in root is up to date.

                                    Collected errors:

                                    * opkg_install_cmd: Cannot install package libsdl-1.2-dev."

                                    Checked my spelling, am I getting something wrong?


                                    1 2 Previous Next