mercurialeasy-installubuntu-9.10

I easy_install'ed Mercurial, and now I get "No script named 'hg'"


I installed Mercurial on (32-bit) Ubuntu 9.10, using:

sudo easy_install mercurial

It installed Mercurial 1.7.5.

I have since learned that using this way of installing is denounced by the Mercurial Team, although the reasons why it shouldn't work are not clear.

When I ran the command hg it responded:

Traceback (most recent call last):
  File "/usr/local/bin/hg", line 5, in <module>
    pkg_resources.run_script('mercurial==1.7.5', 'hg')
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 448, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1160, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'hg'

How do I fix this? How do I easy_uninstall it?

Note: I have noticed sudo hg works.


Solution

  • Go to /usr/local/lib/python2.6/dist-packages (or the appropriate directory for your Python install).

    Type ls -l and you will find an entry something like so.

    drwx--S--- 5 root staff 4096 Feb 14 11:13 mercurial-1.7.5-py2.6-linux-i686.egg
    

    You don't have access to that if you are not logged in as root. Try:

    sudo chmod -R o+rX mercurial-1.7.5-py2.6-linux-i686.egg/
    

    That gives you access and was enough to get things going again for me.

    I still don't know how to uninstall the original mess that was made.