[ACCEPTED]-Mercurial error *** failed to import extension hggit: No module named hggit-hg-git

Accepted answer
Score: 46

Note for ubuntu users who install the "mercurial-git" package 4 to get the hggit module on 12.04 some bright 3 spark randomly renamed the module to just 2 "git" so you need to change your ~/.hgrc 1 to look something like

hgext.bookmarks =
git =
Score: 21

After installing hg-git with the following 6 command:

easy_install hg-git

Does the following work?

python -c "import hggit"

What does 5 this say for you:

head -n1 `which hg`

The point of the latter 4 command is to verify that the Python hg 3 runs under has hggit installed. In my case 2 it says '#!/usr/bin/python', which is my 1 standard python command.

What does this say:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.a­pp/Contents/MacOS/Python -c "import hggit"
Score: 5

I installed Python and TortoiseHg by:

brew cask install python
brew cask install tortoisehg

After 6 following installation

sudo easy_install hg-git

I experienced similar 5 problems (TortoiseHg: failed to import extension hggit: No module named hggit and so on...) and finally found a solution 4 for my TortoiseHg on mac (first uninstall last hg-git by sudo pip uninstall hg-git):

sudo pip install mercurial
sudo pip install hg-git

After installation 3 with pip and adding bookmarks to all important 2 branches, e. g. ...

hg bookmark -r default master
hg bookmark -r branchename bookmarkname

... I could push HG repository 1 to Git:

hg push git+ssh://git@gitlab.URL/reponame.git --traceback

Note: use ssh! - causes fewer problems with large repositories

Note 2: --traceback tells you about problems

Score: 5

I got this error as well even after downloading 20 the latest Tortoisehg and making sure the 19 hggit plugin was installed as well as my 18 .ini & hgrc files had the right entry 17 to enable hggit.

Turns out my problem was 16 that I had both mercurial and tortoisehg 15 in my path. So when I ran any hg commands, it 14 was using the hg.exe in mercurial folder 13 as opposed to the hg.exe in the torsoisehg 12 directory.

This makes sense but my mercurial 11 installation did not have the plug ins. My 10 fix was to remove mercurial from my path 9 so hg commands go through the tortoisehg 8 directory since it has hg completely bundled. Note 7 however, the recommended option might be 6 to upgrade mercurual to a version that has 5 the plugins that one needs but this is what 4 worked for me. I tried replacing the library.zip 3 in mercurial with the one in tortoisehg 2 and this worked but it led to other errors 1 as one would imagine.

Score: 2

I had the same problem as I saw via brew install mercurial some 4 packages are missing.

Do a test if any package 3 missed like: python -c "import hggit"

My fix: Uninstall all packages:

brew uninstall mercurial

install 2 with pip like:

  • sudo easy_install pip ( if you don't have pip )

  • sudo pip install mercurial and 1

  • sudo pip install hg-git


hg bookmark -r default master

Score: 1

I had the same problem, and found that installing 6 hg-git and dulwich via easy_install worked 5 if I used the --user option. This installed the 4 package into ~/Library/Python/2.7/lib/python/site-packages.

To see where this option will 3 install a package on your machine, run easy_install --help. By 2 the documentation for the --user option, it shows 1 the install directory that will be used.

Score: 0
  1. clone hggit from http://bitbucket.org/durin42/hg-git
  2. get hg-git path from your local computer. in my local computer /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
  3. add path to ~.hgrc file using your text editor
  4. add the following lines of code

    hggit = /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
  5. try to hg clone/push/pull form 1 github

More Related questions