I am working on CS50's introduction to AI. For Project 0B (the tic-tact-toe problem) my code should be working fine (though I cannot test it), but when I run it, it gives me an error in runner.py, the code that CS50 gives me. What can I do to fix it?


pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "runner.py", line 14, in <module>
    screen = pygame.display.set_mode(size)
pygame.error: No available video device
  • CS50 IDE? It's "headless", ie no video device. It cannot be fixed. (Technically, you can get rid of the error by executing export SDL_VIDEODRIVER="dummy" before starting the game...but there is no interaction with user, so it's pointless). Also suggest joining "Ed Discussion for Q&A" from the course page. It is a community specifically for CS50AI. (FWIW: I logged in this am to warn you that ttt won't run in the IDE, but you beat me to it!) Apr 12, 2020 at 12:19
  • Hey DinoCoderSaurus, thanks for the answer! How can I join the Ed community, as I found no link to it on the homepage? Also, I need to test my code (I also have to make a video as per the requirements), so how can I run it while interacting with it? Thanks :)
    – AK2150
    Apr 12, 2020 at 13:14
  • The link to Ed. (the link is in the left sidebar on the homepage). The only way I know to run it is locally, ie with python installed on a local device. That's how I'm working, so I haven't researched/searched for any other options. Apr 12, 2020 at 14:40
  • Thanks DinoCoderSaurus!
    – AK2150
    Apr 13, 2020 at 7:49

1 Answer 1


try this: pip install pygame Then once in the directory for the project, run pip3 install -r requirements.txt This works for me. Hope it will work for you too.

  • Thanks! However, this did not work for me... anyway, I downloaded Python onto my PC and did it there!
    – AK2150
    Oct 17, 2020 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .