3

UPDATE 1: I uninstalled, reinstalled, and followed the instructions on the Pygame website for installing dependencies/building Pygame. It turns out I'm missing dependencies, as Python indicates when I attempt to run the setup.py script:

SDL     : found 1.2.15
FONT    : not found
IMAGE   : not found
MIXER   : not found
SMPEG   : found 0.4.5
PNG     : not found
JPEG    : not found
SCRAP   : not found
PORTMIDI: found
PORTTIME: found

I have a list elsewhere of what corresponds the what missing package. My question is: what environment variable will I need to modify in order to get these packages detected? (and, when doing so, what will I need to provide? the shared object file for each of these?)

EDIT: System details - Linux Mint 17.2 Cinnamon 64-bit. Cinnamon version: 2.6.13. Graphics card: Intel Corporation Broadwell-U Integrated Graphics. 7.7 GiB Memory, i5 processor.

I am trying to get pygame up and running on my new device to make some games. I installed libSDL, and pygame more recently; after trying to run three different games others have made, I keep running into the same error:

>~/Downloads/bubble $ python run.py
Traceback (most recent call last):
File "run.py", line 2, in <module>
   from classes.game import *
File "/home/---/Downloads/bubble/classes/game.py", line 2, in <module>
   from .arrow import *
File "/home/---/Downloads/bubble/classes/arrow.py", line 1, in <module>
   from .constantes import *
File "/home/---/Downloads/bubble/classes/constantes.py", line 35, in <module>
scr = display.set_mode(screen.size)
pygame.error: No available video device

What I did to look into the issue/try to resolve it:

1) Double checked I have libSDL and the corresponding dev packages installed. [after researching that one cause of this error is not having libSDL installed]

>~aptitude search sdl | grep -F 'i '

i A libalien-sdl-perl               - helper to get, build and use SDL libraries
i A libsdl-console                  - Console that can be added to any SDL appli
i   libsdl-console-dev              - Console that can be added to any SDL appli
i A libsdl-gfx1.2-4                 - drawing and graphical effects extension fo
i   libsdl-gst                      - SDL bindings for GNU Smalltalk            
i   libsdl-image-gst                - SDL_image bindings for GNU Smalltalk      
i   libsdl-image1.2                 - Image loading library for Simple DirectMed
i   libsdl-image1.2:i386            - Image loading library for Simple DirectMed
i A libsdl-image1.2-dev             - Image loading library for Simple DirectMed
i   libsdl-mixer-gst                - SDL_mixer bindings for GNU Smalltalk      
i A libsdl-mixer1.2                 - Mixer library for Simple DirectMedia Layer
i   libsdl-mixer1.2:i386            - Mixer library for Simple DirectMedia Layer
i A libsdl-net1.2                   - Network library for Simple DirectMedia Lay
i   libsdl-net1.2:i386              - Network library for Simple DirectMedia Lay
i   libsdl-net1.2-dbg               - Network library for Simple DirectMedia Lay
i   libsdl-net1.2-dev               - Network library for Simple DirectMedia Lay
i A libsdl-pango1                   - text rendering with Pango in SDL applicati
i   libsdl-perl                     - SDL bindings for the Perl language        
i A libsdl-sge                      - extension of graphic functions for SDL mul
i   libsdl-sge-dev                  - extension of graphic functions for the SDL
i   libsdl-sound-gst                - SDL_sound bindings for GNU Smalltalk      
i A libsdl-sound1.2                 - Sound library for Simple DirectMedia Layer
i   libsdl-ttf-gst                  - SDL_ttf bindings for GNU Smalltalk        
i A libsdl-ttf2.0-0                 - TrueType Font library for Simple DirectMed
i   libsdl-ttf2.0-0:i386            - TrueType Font library for Simple DirectMed
i   libsdl-ttf2.0-dev               - TrueType Font library for Simple DirectMed
i A libsdl1.2-dev                   - Simple DirectMedia Layer development files
i   libsdl1.2debian                 - Simple DirectMedia Layer                  
i   libsdl1.2debian:i386            - Simple DirectMedia Layer                  
i A libsdl2-2.0-0                   - Simple DirectMedia Layer                  
i   libsdl2-dbg                     - Simple DirectMedia Layer debug files      
i   libsdl2-dev                     - Simple DirectMedia Layer development files
i   libsdl2-gfx-1.0-0               - drawing and graphical effects extension fo
i   libsdl2-gfx-dbg                 - debugging symbols for SDL2_gfx            
i   libsdl2-gfx-dev                 - development files for SDL2_gfx            
i   libsdl2-gfx-doc                 - documentation files for SDL2_gfx          
i   libsdl2-image-2.0-0             - Image loading library for Simple DirectMed
i   libsdl2-image-dbg               - Image loading library for Simple DirectMed
i   libsdl2-image-dev               - Image loading library for Simple DirectMed
i   libsdl2-mixer-2.0-0             - Mixer library for Simple DirectMedia Layer
i   libsdl2-mixer-dbg               - Mixer library for Simple DirectMedia Layer
i   libsdl2-mixer-dev               - Mixer library for Simple DirectMedia Layer
i   libsdl2-net-2.0-0               - Network library for Simple DirectMedia Lay
i   libsdl2-net-dbg                 - Network library for Simple DirectMedia Lay
i   libsdl2-net-dev                 - Network library for Simple DirectMedia Lay
i   libsdl2-ttf-2.0-0               - TrueType Font library for Simple DirectMed
i   libsdl2-ttf-dbg                 - TrueType Font library for Simple DirectMed
i   libsdl2-ttf-dev                 - TrueType Font library for Simple DirectMed

2) Ensured I had the appropriate envvar for SDL_VIDEODRIVER set. [after researching another post, indicating that this variable needs to be set or pygame will not work properly]

>~set | grep 'SDL'
SDL_VIDEODRIVER=x11

[To add to the former: I ran a simple compiled .c file demonstrating a window with image rendered on it in libSDL, and that works just fine!]

After double checking libSDL is installed/envvar for the driver is set, this particular error persists for three different games I downloaded from the pygame site. I'm pretty stumped at this point, and would appreciate any help on how resolve this and get pygame working. Many thanks for your time.

Makoto
  • 104,088
  • 27
  • 192
  • 230
JLP1990
  • 41
  • 1
  • 6
  • did you install pygame with apt-get? or pip? or by running a setup.py? I would think if you used apt-get it would "just work" ... and probably "pip" – Joran Beasley Sep 11 '15 at 23:42
  • I used `apt-get install python-pygame`. Didn't occur to me to use another installation method. Maybe I'll try those out. Seems to have installed properly though, as I'm able to run python then enter `import pygame; pygame.init()` and get back something rather than an error. Thanks! – JLP1990 Sep 11 '15 at 23:50
  • sorry I couldnt be more help :/ – Joran Beasley Sep 11 '15 at 23:53
  • 1
    If you have the time and inclination, you might consider dividing your question into an Answer post (how you solved it) and a Question post (the updated problem, as it was immediately before you solved it). If you do *not* have the time or inclination to do so, I'm glad you got this worked out! :D – Augusta Sep 14 '15 at 02:31

1 Answers1

1

This is from the question; it's been moved here to further expose the answer.


Alright. I got pygame to work on my Linux installation. I had to repartition for an unrelated reason, but I guess after doing so I followed these steps on a new install, and finally got it working: (link describing the header file issue below, libv4l-dev)

  1. Install all the dependencies by entering this on the command line: ~> apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
  2. Run the SDL configuration command: ~> sdl-config --cflags --libs
  3. Enter the folder for pygame-1.9.1release, and run: ~> python config.py to see what, if any, dependencies I was missing. At this point, I was missing: SMPEG, PORTMIDI and PORTTIME. I just looked these up and downloaded them using Synaptic Package Manager.
  4. Running python config.py again afterwards showed I had all required dependencies.
  5. I then ran sudo python setup.py install and got some errors about a header file not being found. Found another StackExchange post detailing how to resolve this particular issue: ~> sudo apt-get install libv4l-dev ~> cd /usr/include/linux ~> sudo ln -s ../libv4l1-videodev.h videodev.h
  6. Ran sudo python setup.py again, and it worked. Confirmed this by running python, then checking the version import pygame followed by pygame.version.ver()... and quickly running a game someone else made.
Makoto
  • 104,088
  • 27
  • 192
  • 230