4

This is a simple SudokuSolver App.

Project on GitHub

It's working perfectly. But when I try to run it in gitpod it's unable to import pygame.

Error:
gitpod /workspace/SudokuVizualizationBacktracking $ /home/gitpod/.pyenv/versions/3.8.2/bin/python /workspace/SudokuVizualizationBacktracking/GUI.py
Traceback (most recent call last):
  File "/workspace/SudokuVizualizationBacktracking/GUI.py", line 1, in <module>
    import pygame
ModuleNotFoundError: No module named 'pygame'

Can you please help me out? Thanks You.

youri
  • 3,685
  • 5
  • 23
  • 43
deepak dash
  • 245
  • 2
  • 11
  • 1
    Online IDE's most likely doesn't support locally generated OpenGL contexts. Just a hunch. – Torxed Jun 05 '20 at 14:01

1 Answers1

4

In your .gitpod.yml you have configured the following init task:

$ pip3 install -r requirements.txt

Start your workspace by opening https://gitpod.io/#https://github.com/Deepak-dash007/SudokuVizualizationBacktracking and run this command in the terminal. You'll get the following output:

$ pip3 install -r requirements.txt
Collecting pygame
  Downloading pygame-1.9.6.tar.gz (3.2 MB)
     |████████████████████████████████| 3.2 MB 6.8 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/gitpod/.pyenv/versions/3.8.2/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fgexue3e/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fgexue3e/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-9lyba20o
         cwd: /tmp/pip-install-fgexue3e/pygame/
    Complete output (12 lines):


    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using UNIX configuration...

    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found

    Hunting dependencies...
    WARNING: "sdl-config" failed!
    Unable to run "sdl-config". Please make sure a development version of SDL is installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Here you can see that sdl-config is missing. Google found this Stack Overflow answer that lists dependencies needed for pygame: https://stackoverflow.com/a/60990677/1364435

Change your image config in your .gitpod.yml to:

image:
  file: .gitpod.Dockerfile

and added a new file .gitpod.Dockerfile that installs the dependencies linked in the other Stack Overflow post:

FROM gitpod/workspace-full-vnc

RUN sudo apt-get update && sudo apt-get install -y \
    python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

Push everything and create a new Gitpod workspace. That's it.

You'll find a running repo here https://github.com/corneliusludmann/SudokuVizualizationBacktracking

I also created a Pull Request for you: https://github.com/Deepak-dash007/SudokuVizualizationBacktracking/pull/1

Cornelius
  • 400
  • 3
  • 12