user2785588
user2785588

Reputation: 71

python.h missing on Ubuntu 18 with python-dev installed

Trying to get fHDHR working Ubuntu 18. During the install I get this error:

include/python3.8 -c src/gevent/libev/corecext.c -o build/temp.linux-x86_64-3.8/src/gevent/libev/corecext.o
  src/gevent/libev/corecext.c:95:10: fatal error: Python.h: No such file or directory
   #include "Python.h"
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for gevent

Most answers I find tell me I need python-dev installed but it already is (and updated). In this post it was recommended to sudo pip install mmh3 which I tried but it also failed as unable to find python.h

Any idea what I am missing on my system?

Upvotes: 7

Views: 11785

Answers (4)

biology.info
biology.info

Reputation: 3569

Look at your current python version, i.e, python --version, perhaps you're on python 2.x, if True :

You have to switch on Python 3

update-alternatives --install /usr/bin/python python /usr/bin/python3.x 2

Upvotes: 0

Syed Ibtehaj Ali
Syed Ibtehaj Ali

Reputation: 26

When you are facing this error just do these install before installation package.

For python 2.x use:

sudo apt-get install python-dev

For python 2.7 use:

sudo apt-get install libffi-dev

For python 3.x use:

sudo apt-get install python3-dev

or for a specific version of Python 3, replace x with the minor version in

sudo apt-get install python3.x-dev

Upvotes: 0

Saad_Khan
Saad_Khan

Reputation: 108

You need to install python3.x-dev as explained here. For me this resolved the issue.

Since from the error line we can see that you are running python3.8, so for your case you would need to do:

sudo apt-get install python3.8-dev

Upvotes: 5

Arseniy
Arseniy

Reputation: 690

You can try to install python3-dev.

apt install python3-dev 

since you are using python3

Upvotes: 0

Related Questions