Can't install pygame_SDL2

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Message
Author
Glazed Donuts
Regular
Posts: 121
Joined: Thu Aug 12, 2010 11:47 am
Contact:

Can't install pygame_SDL2

#1 Post by Glazed Donuts »

I've followed the directions on GitHub (https://github.com/renpy/pygame_sdl2#building).
When I try to run this command:

Code: Select all

python setup.py install
I get this error:

Code: Select all

sh: sdl2-config: command not found
Traceback (most recent call last):
  File "setup.py", line 29, in <module>
    parse_cflags([ "sh", "-c", "sdl2-config --cflags" ])
  File "/Users/Glazed/Desktop/pygame_sdl2/setuplib.py", line 79, in parse_cflags
    output = subprocess.check_output(command, universal_newlines=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['sh', '-c', 'sdl2-config --cflags']' returned non-zero exit status 127
I Googled this error and found a discussion on Reddit where someone had the same error as me (http://www.reddit.com/r/pygame/comments ... l2/cq3pt3d) However, the reply was 'you need to install pygame_SDL2'. Well, that was very unhelpful, seeing as that I'm trying to do that >_<

Any help with getting this to work would be appreciated. I'm unable to run RenPy for development purposes because of it.

I am using a Macbook Pro Retina 13', Yosemite.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#2 Post by PyTom »

This is because you're missing SDL2. (Or at least, SDL2 isn't in your path.)

What platform are you building on?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Glazed Donuts
Regular
Posts: 121
Joined: Thu Aug 12, 2010 11:47 am
Contact:

Re: Can't install pygame_SDL2

#3 Post by Glazed Donuts »

Ah, so SDL2 != pygame_SDL2? I seemed to be going into a loop with the documentation, thinking one was the other, but was coming up with the same error.
I am attempting to build via the terminal/bash.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#4 Post by PyTom »

Yes, SDL2 is a graphics library, and pygame_sdl2 is a python interface to it. SDL2_image et al are still other libraries.

Are you building on Linux? If so, which distro?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Glazed Donuts
Regular
Posts: 121
Joined: Thu Aug 12, 2010 11:47 am
Contact:

Re: Can't install pygame_SDL2

#5 Post by Glazed Donuts »

Thanks for clarifying! :)
I'm building on Mac. I'm using the latest nightly build of RenPy (I made sure I selected the one at the bottom of the list) and downloaded the latest version of pygame_sdl2 from renpy/pygame_sdl2 on github.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#6 Post by PyTom »

I'd suggest trying to use something like brew to install the various dependencies (if you can keep track of them as you do, I can update the docs). I think you should probably use the brew-provided python, rather than the apple on.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Glazed Donuts
Regular
Posts: 121
Joined: Thu Aug 12, 2010 11:47 am
Contact:

Re: Can't install pygame_SDL2

#7 Post by Glazed Donuts »

I did try using homebrew initially, but that didn't work. Following the instructions on Github I tried:

Code: Select all

brew install build-essential python-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev virtualenvwrapper
but kept getting this error:

Code: Select all

Error: No available formula for build-essential 
Searching formulae...
Searching taps...
So I tried using pip and did:

Code: Select all

pip install build-essential python-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev virtualenvwrapper
And got this error:

Code: Select all

Collecting build-essential
/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Could not find a version that satisfies the requirement build-essential (from versions: )
  No matching distribution found for build-essential
Last edited by Glazed Donuts on Fri Apr 17, 2015 10:16 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#8 Post by PyTom »

Those instructions won't work. You'll need to find the equivalent brew packages, which may have very different names.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Glazed Donuts
Regular
Posts: 121
Joined: Thu Aug 12, 2010 11:47 am
Contact:

Re: Can't install pygame_SDL2

#9 Post by Glazed Donuts »

My Google searches keep coming up with the build-install equivalent pointing to me having to download the XCode app, which I already have. But I'm not exactly well-versed in the program, so I'll play around with it and see what I can come up with and hopefully find a way to finally be able to develop something @_@

GastroMan
Newbie
Posts: 8
Joined: Tue Sep 29, 2015 1:39 am
Github: GastroMan
Contact:

Re: Can't install pygame_SDL2

#10 Post by GastroMan »

Hi, I'm new here..

Is there any further info on the method to install on windows?

I have been trying to set up pygame_sdl2 purely for the purpose of converting a previously developed pygame to android.
I'm not developing in Ren'Py.

I basically get stuck at the same point user Glazed Donuts was, where the command for setup.py install fails for pygame_sdl2.

So I'm trying to figure out if I have the prereqs, and what other setup items I may be missing.

I have manually downloaded SDL2 libraries (in win binary form).
Also SDL mixer, ttf, gfx. so I now have the dlls for those.
Not exactly sure where they should go... I have many copies of SDL2.dll around, plus added it to the path, and created ENV variable
set PYSDL2_DLL_PATH=F:\rapt\_SDL2_DLLs

I have also used pip to install:
sdl2-lib
sdl2-cython
PySDL2
Haven't gotten "pysdl2-harness", or "pysdl2-cffi". no idea what those are, but showed up in pip search.

I'm still not sure I've got all the dependencies in place.

I have never used virtualenv before, so I may be messing up something there.
I run "activate.bat", and it adds a prompt so I *think* I'm "changing into a clone".

I can run python and "import sdl2" and that returns ok.
It also seems to import: sdl2.ext, sdl2.sdlmixer

But, when I try to install, I still get this:
File "setup.py", line 29, in <module>
parse_cflags([ "sh", "-c", "sdl2-config --cflags" ])
File "F:\rapt\pygame_sdl2-master\setuplib.py", line 83, in parse_cflags
output = subprocess.check_output(command, universal_newlines=True)
File "c:\python27\Lib\subprocess.py", line 537, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "c:\python27\Lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "c:\python27\Lib\subprocess.py", line 896, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Any suggestions?
Thanks!

G

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#11 Post by PyTom »

At least at the moment, the easy method is to download Ren'Py, and grab the copy of pygame_sdl2 out of the Ren'Py distro.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

GastroMan
Newbie
Posts: 8
Joined: Tue Sep 29, 2015 1:39 am
Github: GastroMan
Contact:

Re: Can't install pygame_SDL2

#12 Post by GastroMan »

PyTom wrote:At least at the moment, the easy method is to download Ren'Py, and grab the copy of pygame_sdl2 out of the Ren'Py distro.
Ok, I hope I'm interpreting right..

- From Renpy nightlies at http://nightly.renpy.org/current/
- download the latest version (and you don't mean the github renpy master?)
- assuming I need the *SDK.zip flavor of the nightlies
- from that download, I locate the folder pygame_sdl2
In my case, that is: renpy-nightly-2015-09-19-14c7a7d-sdk\lib\windows-i686\Lib\pygame_sdl2


And then... I manually install this into my python2.7 installation or virtualenv somehow?

I see also a pygame_sdl.pxd file under \module\include which I suspect I may need to do something with.

Am I in the right ballpark here?

thanks for the help,
G

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#13 Post by PyTom »

Yeah, pretty much. You would copy the pygame_sdl2 files into side_packages, and put the various SDL files in the same directory as python.exe.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

GastroMan
Newbie
Posts: 8
Joined: Tue Sep 29, 2015 1:39 am
Github: GastroMan
Contact:

Re: Can't install pygame_SDL2

#14 Post by GastroMan »

Still fumbling with this.. I cannot get it to even recognize pygame_sdl2 directory as a module.

I haven't gotten the "copy into site-packages" to work yet, so I was just trying to take baby steps, and directy do an import.
I'm trying to run python and just issue "import pygame_sdl2" with that pre-compiled folder.

The directory has a __init__.pyo file in there, so it seems like I should just be able to plop that folder in any current working directory, (e.g. "c:\spam\"),
then run python from that cwd and be able to import it.

But it says "No module named pygame_sdl2"

If I add an __init__.py file to the directory then it imports, and then I move on to import errors...
but my point is just that it I can't get it to treat it as a module.

Should I expect to be able to import it like this?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Can't install pygame_SDL2

#15 Post by PyTom »

Oh, shoot - the .pyo won't work unless you run python with the -O option. You can try that, or maybe I'll try to make a wheel this weekend.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: No registered users