0

specs : kali with python 3.8.1

I developed a game which requires pygame. so as usual for downloading and installing I used '''$pip install pygame''' and it returned an error message

Collecting pygame
  Using cached pygame-1.9.6.tar.gz (3.2 MB)
    ERROR: Command errored out with exit status 1:
     command: /home/mohit/Projects/python/games/env/tetris_env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uorpw1u9/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uorpw1u9/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-install-uorpw1u9/pygame/pip-egg-info
         cwd: /tmp/pip-install-uorpw1u9/pygame/
    Complete output (18 lines):


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


    Hunting dependencies...
    SDL     : found 1.2.15
    FONT    : not found
    IMAGE   : not found
    MIXER   : not found
    PNG     : found
    JPEG    : not found
    SCRAP   : found
    PORTMIDI: not found
    PORTTIME: not found
    FREETYPE: found 23.1.17
    Missing dependencies
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
'''
now I have some questions:
i) How can I install pygame using libsdl. 
ii) installing pySDL2 would using ```pip install pySDL2``` will help ? 
iii) if I want to install SDL from source then how can I ?
iv) is installing SDL to global and virtualenv are different ?

2 Answers2

2
$ sudo apt-get install 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
0

Apparently you are missing some system dependencies. Try installing:

sudo apt-get install libfreetype6-dev

https://installlion.com/kali/kali/main/l/libfreetype6-dev/install/index.html

johann2357
  • 41
  • 2
  • Ok, you can either try installing it globally with your package manager ```sudo apt-get install python-pygame``` or try again installing ```sudo apt-get install libsdl1.2-dev fonts-freefont-ttf libsdl-image1.2 libsdl1.2debian libsdl-mixer1.2 libsdl-ttf2.0-0``` then try with pip again. – johann2357 Apr 24 '20 at 10:43
  • actually `apt-get install python-pygame` worked but wasn't importing in python3.8 version, So after some more googling I found the installation is for python2.x and for py3 it,s just `apt-get install python3-pygame` and it worked. thank you – Mohit Meshram Apr 29 '20 at 09:40