I've got python 3.7.0 installed on ubuntu 18.04 using pyenv and I'm trying to install pygame using pip. My procedure is:-
sudo apt-get build-dep python-pygame
pip install pygame
The last step keeps giving me:-
peter@Brian:~$ pip install pygame
Collecting pygame
Using cached https://files.pythonhosted.org/packages/61/06/3c25051549c252cc6fde01c8aeae90b96831370884504fe428a623316def/pygame-1.9.3.tar.gz
Installing collected packages: pygame
Running setup.py install for pygame ... error
...
...
running build_ext
building 'pygame.imageext' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/home/peter/.pyenv/versions/3.7.0/include/python3.7m -c src/imageext.c -o build/temp.linux-x86_64-3.7/src/imageext.o
src/imageext.c: In function ‘write_jpeg’:
src/imageext.c:487:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (num_lines_to_write > (cinfo.image_height - cinfo.next_scanline) -1) {
^
In file included from src/pygame.h:32:0,
from src/imageext.c:49:
src/imageext.c: In function ‘opengltosdl’:
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/imageext.c:632:9: note: in expansion of macro ‘RAISE’
RAISE (PyExc_RuntimeError, "Cannot get video surface.");
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/imageext.c:636:9: note: in expansion of macro ‘RAISE’
RAISE (PyExc_RuntimeError, "Cannot find glReadPixels function.");
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/imageext.c:643:9: note: in expansion of macro ‘RAISE’
RAISE (PyExc_MemoryError, "Cannot allocate enough memory for pixels.");
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/imageext.c:663:9: note: in expansion of macro ‘RAISE’
RAISE (PyExc_SDLError, SDL_GetError ());
^~~~~
gcc -pthread -shared -L/home/peter/.pyenv/versions/3.7.0/lib -L/home/peter/.pyenv/versions/3.7.0/lib build/temp.linux-x86_64-3.7/src/imageext.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lSDL -lSDL_image -lpng -ljpeg -o build/lib.linux-x86_64-3.7/pygame/imageext.cpython-37m-x86_64-linux-gnu.so
building 'pygame.font' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/home/peter/.pyenv/versions/3.7.0/include/python3.7m -c src/font.c -o build/temp.linux-x86_64-3.7/src/font.o
src/font.c: In function ‘font_render’:
src/font.c:390:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (strlen(astring) != Bytes_GET_SIZE(bytes)) {
^~
src/font.c:417:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (strlen(astring) != Bytes_GET_SIZE(text)) {
^~
In file included from src/pygame.h:32:0,
from src/font.c:31:
src/font.c: In function ‘font_init’:
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/font.c:619:9: note: in expansion of macro ‘RAISE’
RAISE(PyExc_SDLError, "font not initialized");
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/font.c:724:9: note: in expansion of macro ‘RAISE’
RAISE(PyExc_RuntimeError, SDL_GetError());
^~~~~
gcc -pthread -shared -L/home/peter/.pyenv/versions/3.7.0/lib -L/home/peter/.pyenv/versions/3.7.0/lib build/temp.linux-x86_64-3.7/src/font.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lSDL -lSDL_ttf -o build/lib.linux-x86_64-3.7/pygame/font.cpython-37m-x86_64-linux-gnu.so
building 'pygame.mixer' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/home/peter/.pyenv/versions/3.7.0/include/python3.7m -c src/mixer.c -o build/temp.linux-x86_64-3.7/src/mixer.o
In file included from src/pygame.h:32:0,
from src/mixer.c:27:
src/mixer.c: In function ‘_format_view_to_audio’:
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:136:9: note: in expansion of macro ‘RAISE’
RAISE(PyExc_ValueError, "Array has unsupported item format");
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:165:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_ValueError, "Array has unsupported item format");
^~~~~
src/mixer.c: In function ‘_chunk_from_array’:
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1363:9: note: in expansion of macro ‘RAISE’
RAISE(PyExc_SDLError, "Mixer not initialized");
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1371:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_ValueError,
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1378:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_ValueError,
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1383:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_ValueError,
^~~~~
src/mixer.c: In function ‘sound_init’:
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1516:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_TypeError, arg_cnt_err_msg);
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1532:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_TypeError, arg_cnt_err_msg);
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1555:13: note: in expansion of macro ‘RAISE’
RAISE(PyExc_TypeError,
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1561:9: note: in expansion of macro ‘RAISE’
RAISE(PyExc_TypeError, arg_cnt_err_msg);
^~~~~
src/_pygame.h:206:46: warning: right-hand operand of comma expression has no effect [-Wunused-value]
#define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/mixer.c:1585:21: note: in expansion of macro ‘RAISE’
RAISE(PyExc_SDLError, SDL_GetError());
^~~~~
gcc -pthread -shared -L/home/peter/.pyenv/versions/3.7.0/lib -L/home/peter/.pyenv/versions/3.7.0/lib build/temp.linux-x86_64-3.7/src/mixer.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lSDL -lSDL_mixer -o build/lib.linux-x86_64-3.7/pygame/mixer.cpython-37m-x86_64-linux-gnu.so
building 'pygame.mixer_music' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/home/peter/.pyenv/versions/3.7.0/include/python3.7m -c src/music.c -o build/temp.linux-x86_64-3.7/src/music.o
gcc -pthread -shared -L/home/peter/.pyenv/versions/3.7.0/lib -L/home/peter/.pyenv/versions/3.7.0/lib build/temp.linux-x86_64-3.7/src/music.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lSDL -lSDL_mixer -o build/lib.linux-x86_64-3.7/pygame/mixer_music.cpython-37m-x86_64-linux-gnu.so
building 'pygame.scrap' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/home/peter/.pyenv/versions/3.7.0/include/python3.7m -c src/scrap.c -o build/temp.linux-x86_64-3.7/src/scrap.o
In file included from src/scrap.c:60:0:
src/scrap_x11.c: In function ‘pygame_scrap_get_types’:
src/scrap_x11.c:842:35: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type [-Wincompatible-pointer-types]
while (PyDict_Next (dict, &pos, &key, NULL))
^
In file included from /home/peter/.pyenv/versions/3.7.0/include/python3.7m/Python.h:90:0,
from src/scrap.h:27,
from src/scrap.c:30:
/home/peter/.pyenv/versions/3.7.0/include/python3.7m/dictobject.h:95:17: note: expected ‘Py_ssize_t * {aka long int *}’ but argument is of type ‘int *’
PyAPI_FUNC(int) PyDict_Next(
^~~~~~~~~~~
gcc -pthread -shared -L/home/peter/.pyenv/versions/3.7.0/lib -L/home/peter/.pyenv/versions/3.7.0/lib build/temp.linux-x86_64-3.7/src/scrap.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lSDL -lX11 -o build/lib.linux-x86_64-3.7/pygame/scrap.cpython-37m-x86_64-linux-gnu.so
building 'pygame.pypm' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include -I/usr/include -I/home/peter/.pyenv/versions/3.7.0/include/python3.7m -c src/pypm.c -o build/temp.linux-x86_64-3.7/src/pypm.o
src/pypm.c: In function ‘__Pyx_ErrRestore’:
src/pypm.c:4976:18: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
^~~~~~~~
curexc_type
src/pypm.c:4976:47: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
^~~~~~~~
curexc_type
src/pypm.c:4977:28: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
src/pypm.c:4978:29: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
src/pypm.c:4979:26: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
src/pypm.c:4982:17: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = 0;
^~~~~~~~
curexc_type
src/pypm.c:4983:17: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = 0;
^~~~~~~~~
curexc_value
src/pypm.c:4984:17: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = 0;
^~~~~~~~~~~~~
curexc_traceback
At top level:
src/pypm.c:2845:13: warning: ‘__pyx_doc_4pypm_5Input___dealloc__’ defined but not used [-Wunused-variable]
static char __pyx_doc_4pypm_5Input___dealloc__[] = "Close midi device if still open when the instance is destroyed.";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pypm.c:2673:13: warning: ‘__pyx_doc_4pypm_5Input___init__’ defined but not used [-Wunused-variable]
static char __pyx_doc_4pypm_5Input___init__[] = "Instantiate MIDI input stream object.";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pypm.c:1359:13: warning: ‘__pyx_doc_4pypm_6Output___dealloc__’ defined but not used [-Wunused-variable]
static char __pyx_doc_4pypm_6Output___dealloc__[] = "Close midi device if still open when the instance is destroyed.";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pypm.c:1091:13: warning: ‘__pyx_doc_4pypm_6Output___init__’ defined but not used [-Wunused-variable]
static char __pyx_doc_4pypm_6Output___init__[] = "Instantiate MIDI output stream object.";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/peter/.pyenv/versions/3.7.0/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-l6kc_seb/pygame/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-nmz05uhl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-l6kc_seb/pygame/