How to fix a pip3 failed installation

In my case, I was trying to install bluepy from pip3 with the following command:

pip3 install bluepy

But an error appears:

fatal error: glib.h: No such file or directory\n #include <glib.h>\n                  ^\ncompilation terminated.\nMakefile:28: recipe for target 'bluepy-helper' failed\nmake: *** [bluepy-helper] Error 1\nmake: Leaving directory '/tmp/pip-build-djwz1adc/bluepy/bluepy'\n"

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-djwz1adc/bluepy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p2v5kjik-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-djwz1adc/bluepy
Storing debug log for failure in /root/.pip/pip.log

Usually, we see the outpu after Cleaning up..., but it's very important see before it. As you can see, it says glib.h is not found. To solve it, we need to install it.

apt-get install libglib2.0-dev

If you don't see an specific fatal error like this case, install python developer:

apt-get install python3-dev

Enjoy it!

Comments

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

How to install a WhatsApp bot based on Python