2

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?

gvkv
  • 529

4 Answers4

2

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.

durin42
  • 206
1

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).

mernst
  • 131
0

if you are running under windows you will find a folder "pure" inside of "\site-packages\mercurial\". Inside of it, there are a bunch of .py (osutil.py is one of them)

Just copy all files inside "pure" to the "mercurial" folder and DONE! It just starts working.

Hope this helps!

0

Just for the sake of helping others, I just solved the missing osutil.py in Ubuntu 13.04, without which mercurial won't run.

I had to install python-sphinx (and related). This looks like a dependency check failure in the mercurial package.

Jason Aller
  • 2,360