1

When I try to clone a repository in hg, I get the following error:

$ hg clone http://server/repo
abort: No module named _md5!

I run this on Solaris 10, and the strange thing is that the same setup on another system (also Solaris 10 and same version of Mercurial and Python) works without any problems.

I checked all the Python modules and installed files, and it seems to match with the files that are installed on the other system.

My version of Mercurial is 2.3 Python is 2.6 in /usr/local/lib and 2.4 in /usr/lib. I don't know which of these two Mercurial is using but I tried setting $PYTHONPATH to 2.6 without success.

What could be the problem here?

Subbeh
  • 768
  • 1
  • 5
  • 13
  • 2
    `PYTHONPATH` is not used to point to a python version; it changes where the running python interpreter looks for modules to import. – Martijn Pieters Nov 14 '12 at 12:10
  • Use `head \`which hg\`` to determine what `#!` line is used, it'll point to a python version, *or* it'll use `/bin/env python` to use the first `python` command found on the `PATH`. – Martijn Pieters Nov 14 '12 at 12:11
  • head `which hg` returns "#!/usr/local/bin/python" on both systems, so this can't be the problem – Subbeh Nov 14 '12 at 12:17
  • 2
    The `_md5` module is imported by the `hashlib` module, but only if there is no openssl-based variant available. I suspect one of your machines is missing the OpenSSL headers, thus Python was not compiled with the OpenSSL support needed here. – Martijn Pieters Nov 14 '12 at 13:00
  • 1
    See [_sha import in python hashlib](http://stackoverflow.com/q/4590242) for more detail. – Martijn Pieters Nov 14 '12 at 13:10
  • 1
    possible duplicate of [Python: ImportError: No module named \_md5](http://stackoverflow.com/questions/10306531/python-importerror-no-module-named-md5) – Martijn Pieters Nov 14 '12 at 13:11
  • If Python needs to be recompiled with openssl, wouldn't that mean that the python binary (/usr/local/bin/python) needs to be different from the environment where it's working? I checked both files using cksum and they are exactly the same – Subbeh Nov 14 '12 at 14:12
  • 1
    No, Python compiles additional modules to be imported by the interpreter; the `_md5` module is a C extension (filename `_md5.so`) that can be compiled or omitted. – Martijn Pieters Nov 14 '12 at 14:33
  • Ok thanks for your help so far, I will need to ask one of the sysadmins very nicely to have a look at this. Hope it works. – Subbeh Nov 14 '12 at 14:58
  • 1
    Note: this isn't properly a duplicate of [Python: ImportError: No module named _md5](http://stackoverflow.com/questions/10306531/python-importerror-no-module-named-md5) because it is encountered by the user in a completely different way, even if the problem from Hg is the problem from Python of the other question. Keep open, makes it easier for the world to solve this problem. – Charles Stewart Nov 14 '12 at 19:35

0 Answers0