How to install Python modules needed by plugins?

Eli Zaretskii eliz at gnu.org
Mon Mar 7 14:14:34 UTC 2011


I found no information in the docs regarding the subject.  A natural
place to find this would be here:

  http://wiki.bazaar.canonical.com/BzrPlugins

or here:

  http://doc.bazaar.canonical.com/plugins/en/plugin-installation.html

But it isn't there, unless I'm blind.

The case in point is the bzr-fastimport plugin, which depends on
python-fastimport.  There's no information in python-fastimport itself
regarding its installation.  Googling found this recipe:

	bzr branch lp:python-fastimport python_fastimport 
	cd python-fastimport/ 
	python setup.py install

Running setup.py installed python-fastimport in
lib/python2.6/site-packages/ under my home directory, but "bzr
fast-import" still refused to run saying it couldn't find the
fastimport module:

  bzr: ERROR: Unable to import library "fastimport": bzr-fastimport
  requires the fasimport python module

I then tried to google in order to understand where bzr looks for
Python modules, but found nothing.  Next, I tried to find out which
value of PYTHONPATH is used or set by bzr (I have no such variable in
my environment), but couldn't find anything, either.  I finally got
that to work by setting PYTHONPATH to lib/python2.6/site-packages/,
but I still would like authoritative answers to the following
questions:

 . What is the recommended way of installing Python support modules?
 . Where does bzr look for Python modules?
 . If installing a Python module involves setting PYTHONPATH in the
   environment, then must the value of PYTHONPATH include the
   directory where bzrlib lives?  I thought that this variable only
   _adds_ directories to what bzr already searches by default, but
   when I pointed it to another directory, I got this error message:

    bzr: ERROR: Couldn't import bzrlib and dependencies.
    Please check the directory containing bzrlib is on your PYTHONPATH.

    Traceback (most recent call last):
      File "/usr/bin/bzr", line 107, in <module>
	import bzrlib
    ImportError: No module named bzrlib
    Command exited with non-zero status 1

   There's no module bzrlib in lib/python2.6/site-packages/, but there
   is a _directory_ bzrlib there.

Apologies if I missed something obvious.

TIA



More information about the bazaar mailing list