0

I am trying to install kivy on WSL-1 (ubuntu 18.04) using:

python3 -m pip install kivy

However, I run into the following error:

mp/pip-build-wzqslc5f/kivy/kivy/include -I/usr/include/python3.6m -c /tmp/pip-build-wzqslc5f/kivy/kivy/graphics/context.c -o build/temp.linux-x86_64-3.6/tmp/pip-build-wzqslc5f/kivy/kivy/graphics/context.o
    In file included from /tmp/pip-build-wzqslc5f/kivy/kivy/graphics/context.c:599:0:
    /tmp/pip-build-wzqslc5f/kivy/kivy/include/gl_redirect.h:72:13: fatal error: GL/gl.h: No such file or directory
     #   include <GL/gl.h>
                 ^~~~~~~~~
    compilation terminated.
     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wzqslc5f/kivy/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-23856ukx-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-wzqslc5f/kivy/

What should be done differently on WSL?

fireball.1
  • 1,413
  • 2
  • 17
  • 42
  • https://stackoverflow.com/search?q=fatal+error%3A+GL%2Fgl.h%3A+No+such+file+or+directory – phd Nov 23 '20 at 10:47

1 Answers1

-1

Not specific to WSL, but Ubuntu in general has python3 pre-installed. If that is the case, then installing pip on your system resulted in two package managers on your system, viz. apt & pip which tends to mess with each other.

I also run Ubuntu on WSL, and as a general rule of thumb whenever I need to install a python package, I try to find it using apt first, and then use pip only if I can't find it in apt repo (or whatever it is called).

Many of the python packages are published to apt repo with name as python(v)-(pkg), e.g. python3-pip, python3-numpy, etc. So, if working on a fresh install of Ubuntu on WSL, the following sequence of commands should get the job done:

sudo apt update -y && sudo apt upgrade -y
sudo apt install -y python3-pip
sudo apt install -y python3-kivy
kumarchandresh
  • 559
  • 2
  • 16