felipec / git-remote-hg

Transparent bidirectional bridge between Git and Mercurial for Git
GNU General Public License v2.0
369 stars 87 forks source link

ImportError: No module named mercurial #38

Closed thomaslevesque closed 9 years ago

thomaslevesque commented 9 years ago

I get an error trying to clone a repo with git-remote-hg on Raspbian:

pi@raspberrypi ~/sources $ git clone hg::https://code.google.com/p/markdownsharpCloning into 'markdownsharp'...
Traceback (most recent call last):
  File "/home/pi/bin/git-remote-hg", line 15, in <module>
    from mercurial import hg, ui, bookmarks, context, encoding
ImportError: No module named mercurial

From what I understand, I need to install the mercurial Python module. I tried to install it with easy_install, but I got some errors:

pi@raspberrypi ~/sources $ sudo easy_install-pypy -U mercurial                  Searching for mercurial
Reading https://pypi.python.org/simple/mercurial/
Best match: mercurial 3.3.2
Downloading https://pypi.python.org/packages/source/M/Mercurial/mercurial-3.3.2.tar.gz#md5=731f33b7c8c76e99efe74ab2c9ceebc8
Processing mercurial-3.3.2.tar.gz
Writing /tmp/easy_install-gPVxcO/mercurial-3.3.2/setup.cfg
Running mercurial-3.3.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gPVxcO/mercurial-3.3.2/egg-dist-tmp-QwLz8d
mercurial/mpatch.c: In function 'fold':
mercurial/mpatch.c:294:3: warning: passing argument 2 of 'PyObject_AsCharBuffer' from incompatible pointer type [enabled by default]
/usr/lib/pypy-upstream/include/pypy_decl.h:280:17: note: expected 'char **' but argument is of type 'const char **'
mercurial/mpatch.c: In function 'patches':
mercurial/mpatch.c:324:2: warning: passing argument 2 of 'PyObject_AsCharBuffer' from incompatible pointer type [enabled by default]
/usr/lib/pypy-upstream/include/pypy_decl.h:280:17: note: expected 'char **' but argument is of type 'const char **'
mercurial/dirs.c: In function '_addpath':
mercurial/dirs.c:58:27: error: 'PyStringObject' has no member named 'ob_shash'
mercurial/dirs.c:66:26: error: lvalue required as left operand of assignment
mercurial/dirs.c:71:23: error: lvalue required as left operand of assignment
mercurial/dirs.c:81:22: error: lvalue required as left operand of assignment
mercurial/dirs.c: In function '_delpath':
mercurial/dirs.c:117:7: error: lvalue required as decrement operand
error: Setup script exited with error: command 'cc' failed with exit status 1

Sorry if it's a basic question, I don't know much about Python and Linux...

benoit-pierre commented 9 years ago

Mercurial uses Python version 2, not 3, so try again with easy_install-2.7 (or equivalent for you Python version).

thomaslevesque commented 9 years ago

Thanks!

I only had easy_install-pypy available, so I had to install easy_install-2.7. Then I also had to install python-dev to be able to install mercurial. Then I had to use this patched version of git-remote-hg to be able to clone, due to #27