I'm using Ubuntu 10.04 and I just installed Mercurial 1.5.4 from source (see this question for some installation trouble that I had). Now, however, when I invoke:

hg

I get the following:

  File "/usr/local/bin/hg", line 27, in <module>
    mercurial.dispatch.run()
  ...
  File "/usr/lib/pymodules/python2.6/mercurial/demandimport.py", line 47, in _load
    mod = _origimport(head, globals, locals)
ImportError: No module named osutil

yet

find /usr/local/lib -name osutil* -print

returns

/usr/local/lib/python2.6/dist-packages/mercurial/osutil.so

which I assume can be loaded by Python scripts similar to Perl and XS. With the exception of adding python-dev (see answer at above link) my Python installation is exactly as it came with Ubuntu 10.04 after upgrading to 10.04 from 9.10.

What's going on?

link|improve this question

57% accept rate
from your earlier question, it seems the C modules are still not properly compiled. They should be with your manual install in /usr/lib/pymodules/python2.6/mercurial/. – tonfa Jun 26 '10 at 11:48
Ok, so what do I do about it? – gvkv Jun 26 '10 at 13:13
feedback

2 Answers

This usually means you need to uninstall the mercurial-common package from Ubuntu - it can be earlier in the Python search path and cause weird problems like this.

link|improve this answer
This did it for me. I had a manual compiled Mercurial and remove the Ubuntu version first but had that package still around. – Martin Scharrer Sep 30 '11 at 12:49
feedback

Per http://mercurial.808500.n3.nabble.com/Mercurial-1-5-2-released-td806821.html, you need the python-dev package. For example, on Debian or Ubuntu, you would install it with

sudo apt-get install python-dev

If that doesn't work right away, then re-do the Mercurial source installation, and that may solve the problem (it did for me).

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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