Ask Your Question

ImportError: No module named XYZ. What to do?

asked 2010-04-18 14:24:29 -0600

Evgeny's avatar

updated 2010-04-18 14:28:36 -0600

I've started testing askbot under Python 2.4. There are errors like the one in the title.

While dependencies are in the process of being accounted for and these errors are being eliminated, hopefuly answers to this question will help users solve these issues on their own or maybe you guys could add modules with Python 2.4 here in the comments.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2010-04-18 14:33:17 -0600

Evgeny's avatar

updated 2010-04-18 15:12:15 -0600

Installing from source code with Distutils

(including the case of non-root user)

Ok here was one missing import: hashlib.

Well you can google python 2.4 hashlib and find a resource for that library.

If you find source code distribution like this one.

Download the source (this one comes in the zip file)


with Unix wget or just get the file through your browser.

Then unzip the file, and jump into the directory

cd unzip hashlib-20081119

There will be file (all python modules distributed with distutils have it).

Assuming that you have setuptools installed and that you have root access (for non-root there is a small modification to the command) you can finalize installation this way:

python install


sudo python install

An important part: python executable called by this command must be the same as the one used by the webserver process. Most likely - this is the case automatically, but sometimes it is not true.

To find out where the python is coming from type which python and you'll get something like


Your system administrator must know which python executable is called by the webserver.

How to install modules without root access?

There will be only two small modifications to the command:

python --prefix /path/to/your/python/packages

You'll use --prefix parameter and sudo will not be needed because you have access to the directory /path/to/your/python/packages

Here is the full documentation for the python distutils.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-04-18 14:24:29 -0600

Seen: 1,954 times

Last updated: Apr 18 '10