10

I have tried this and this and this and this

None of those install python-dev, I got my amd64 system, 14.04 up and running, as I try to install wagtail, a django cms, I get the error:

     pysass.c:4:20: 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

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

How can I fix this and install the package?

It's because of the missing Python.hc header which is included in the python-dev package.

When I tried the above links, it says:

apt-get install python-dev

Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python

E: Package 'python-dev' has no installation candidate

for apt-get install python2.7-dev

Package python2.7-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python2.7-dev' has no installation candidate

I have researched on the debian archives and found a package for python 2.7.8-1 but that couldn't be installed.

Tried this on launchpad too but doesn't work.

19

Are you sure you are doing it right?

This is my output for # apt-get install python2.7-dev

root@olympus:/home/zeus# apt-get install python2.7-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libexpat1-dev libpython2.7-dev
The following NEW packages will be installed:
  libexpat1-dev libpython2.7-dev python2.7-dev
0 upgraded, 3 newly installed, 0 to remove and 7 not upgraded.
Need to get 22.4 MB of archives.
After this operation, 35.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Try doing this as root (su)

Also, try running # apt update and make sure Multiverse and universe are enabled (See How do I enable the "Universe" repository?). I also got backports enabled in my system, not sure whether that makes a difference in this case.

  • imgur.com/dI6n3Pq this is my screenshot. how to enable multiverse and universe? – x0x Sep 14 '14 at 20:23
  • 4
    @John: Type the following command: sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse" – Sylvain Pineau Sep 14 '14 at 20:55
  • 2
    +1.. I was getting similar error when trying to install using python3.5. After Installing python3.5-dev the error was gone – Saurav Kumar Jun 1 '16 at 13:47
  • I had the same #include <Python.h> error and running sudo apt-get install python-dev fixed it. This is with python2.7. – Nick Crawford Jul 8 '16 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.