Ask coding questions

← Back to all posts
Problems running replit-play in
glrudolph (11)

This week there was a feature in the newsletter on replit-play. It was able to run the cat example in the author's example repl, but when I tried to run the same code in my own repl, Some packages would install and compile, but other packages would install but not run. Here are the results:

Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
pygame 1.9.6
Hello from the pygame community.
Loading chipmunk for Linux (64bit) [/home/runner/.local/lib/python3.6/site-packages/pymunk/]
Traceback (most recent call last):
File "", line 1, in <module>
import play
File "/home/runner/.local/lib/python3.6/site-packages/play/", line 3, in <module>
from .play import *
File "/home/runner/.local/lib/python3.6/site-packages/play/", line 88, in <module>
_pygame_display = pygame.display.set_mode((screen.width, screen.height), pygame.DOUBLEBUF)
pygame.error: No available video device

I was running this from Chrome browser, but same results in Firefox and Edge browsers...
Some thing about my configuration--such as the author was running Python 3.6.7, my repls run 3.6.1--is different enoughto cause problems.

I am assuming anyone who looks at this post can find the newsletter and run the same example, so I'm not posting code here.

Answered by heyitsmarcus (334) [earned 5 cycles]
View Answer
heyitsmarcus (334)

Be sure that when you're trying to run a Pygame game, choose Pygame as the language, because it will load the additional modules needed for Pygame in addition to v3.6.7 of Python. I'm thinking that the generic Python (Python3) doesn't load the necessary video/audio modules.

Here's an example with your code:

If this solved your problem, please upvote and accept my answer as the correct answer to close this question. I'll continue to answer any questions you may have.

glrudolph (11)

@heyitsmarcus That worked. From the original documentation on replit-play, I wouldn't have known that pygame is a dependency, and I would have expected the package loading scripts and whatever else runs to correctly load and configure the video drivers.

In any case, this solved the problem, so now I know how to tell myself and my students what to do to use replit-play in assignments.

heyitsmarcus (334)

@glrudolph It is interesting that it didn't load pygame as a dependency. I'm just glad you and your students aren't stuck! Happy coding!

glrudolph (11)

@heyitsmarcus It looks like it loads pygame, but not configured properly.

glrudolph (11)

@heyitsmarcus my mistake. I meant to say that in a plain Python 3 repl, the script appears to install pygame as expected, but pygame doesn't load and run because of the video drivers. The latter is what I meant by "not configured properly".

heyitsmarcus (334)

@glrudolph You're right. The Python3 repl should be able to resolve dependencies and/or modules needed for Pygame. I think it's time for a feature request: