Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to install a python UML tool called blockdiag via this command:

sudo easy_install blockdiag

I get the following error and am unable to figure out how to fix it. I have received this kind error for the first time and I would appreciate if you would be kind enough to let me also know how to troubleshoot such errors.

Reading http://effbot.org/zone/pil-changes-115.htm
Download error: [Errno -2] Name or service not known -- Some packages may not be found!
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
Best match: PIL 1.1.7
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-tx4P54/PIL-1.1.7/egg-dist-tmp-F4vgBr
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
_imaging.c:75:20: error: Python.h: No such file or directory
In file included from libImaging/Imaging.h:14,
                 from _imaging.c:77:

Link to full install log and error

share|improve this question
    
Do you have package python-dev installed? That's where Python.h comes from –  daniel kullmann Apr 8 '12 at 6:59
    
It is not installed. I am installing it to see if it resolves the problem. Did you know that python.h exists in python-dev because you work on Python or is there a way to identify? –  Nanda Apr 8 '12 at 7:06
1  
First, I ran locate Python.h which told me that this file resides in /usr/include/python2.7/Python.h. Then, I did dpkg -S /usr/include/python2.7/Python.h, which told me the package is python2.7-dev. This package is version-specific though, so I checked package python-dev with apt-cache show python-dev to see whether this will automatically install python2.7-dev. Which it does; it's in the Depends: ... line. –  daniel kullmann Apr 8 '12 at 7:15
    
I have installed python-dev and I have been able to install blockdiag now. Thank you for such a clear explanation. This has been very helpful to me. I am on a learning curve with a Debian based system called CrunchBang and little things like this mean a great deal to me. Please post your comments as an answer and I would be glad to accept it as the answer. –  Nanda Apr 8 '12 at 7:18

1 Answer 1

up vote 4 down vote accepted

Do you have package python-dev installed? That's where Python.h comes from.

These are the steps to find this information out for yourself:

Run apt-file search Python.h to find all packages that provide files that have Python.h in their name (You might have to install apt-file first). This lists a lot of packages, but most provide files like Symbol-Tables-In-Python.html. The only packages that provide a Python.h file are pythonX.X-dbg and pythonX.X-dev packages. Now, -dbg packages contain debug version of programs, while -dev contain development files such as C header files, and Python.h is such a file.

This narrows the list of packages down to python2.6-dev, python2.7-dev, and python3.2-dev. One way to check which of these version is the canonical one is to simple remove the version number from the package name, and check if this exists: apt-cache show python-dev:

Package: python-dev
Priority: optional
Section: python
Installed-Size: 32
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
Architecture: all
Source: python-defaults
Version: 2.7.2-7ubuntu2
Depends: python (= 2.7.2-7ubuntu2), python2.7-dev (>= 2.7.2-3~)
Filename: pool/main/p/python-defaults/python-dev_2.7.2-7ubuntu2_all.deb
Size: 1008
MD5sum: d8ef295ca23c3f46298daaa0ccb25403
SHA1: 057d3802fb2afb2a4f85906d65fcb2589568a377
SHA256: 1f5340056e70d6ff573e43f42365b1fd96cee7870ec6ed42c3be4eba6216a092
Description-en: header files and a static library for Python (default)
 Header files, a static library and development tools for building
 Python modules, extending the Python interpreter or embedding Python
 in applications.
 .
 This package is a dependency package, which depends on Debian's default
 Python version (currently v2.7).
Homepage: http://www.python.org/
Description-md5: 93a1917c3f17606b40377d0b737c6c92
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 18m

The Depends: line shows that it will install python2.7-dev, so you can just install python-dev.

Since I already had the correct packages installed, I could use locate Python.h and then dpkg -S /usr/include/python2.7/Python.h to find the package that contains Python.h.

share|improve this answer
    
You are awesome. Thank you for the help. –  Nanda Apr 8 '12 at 7:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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