pip3 install fails, version of 2018-06-08

Create issue
Issue #336 closed
Former user created an issue

Running $ pip3 install regex breaks at:

regex_3/_regex.c:48:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.

I get the same error when I try to run setup.py.

Comments (3)

  1. Matthew Barnett repo owner

    From what I can tell from a Google search, you need to install the development package of Python which contains header files and the library of Python, so something like:

    sudo apt-get install python3-dev

    I don't know the details because I haven't come across this problem myself, and I don't know the details of your OS (looks like a Linux distribution) or your version of Python.

  2. Mark Amery

    Yeah, there are loads of modules that generate this error on Ubuntu (and probably other Linuxes) if you try to install them with Pip without first installing python-dev or python3-dev. You won’t get far at all trying to use Pip without first installing the development package because any Python package you try to install that contains any C code will fail to install. The fix @Matthew Barnett proposes above is indeed the correct one if you’re on Ubuntu or any Linux that uses Apt. This isn’t a bug in the regex module; this issue can be closed.

  3. Log in to comment