Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

Download error: [Errno -2] Name or service not known -- Some packages may not be found!
Best match: PIL 1.1.7
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/ -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
_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
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
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 <>
Original-Maintainer: Matthias Klose <>
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).
Description-md5: 93a1917c3f17606b40377d0b737c6c92
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


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.