How to install Python modules needed by plugins?
Jelmer Vernooij
jelmer at samba.org
Mon Mar 7 21:53:49 UTC 2011
On Mon, 2011-03-07 at 09:14 -0500, Eli Zaretskii wrote:
> 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?
It depends on the way you have installed Bazaar. If you're using a
OS-provided package or a PPA Bazaar will look in the same places as any
other Python application. You're probably also best off installing
dependencies using your system's package manager.
As far as I know it's not possible to install extra dependencies for the
standard Bazaar Windows installer, only for the Python-based installer.
But perhaps people with more experience using Bazaar on Windows can
clarify that.
> . Where does bzr look for Python modules?
It just uses whatever the Python it uses happens to have as sys.path, it
doesn't add any additional locations.
> . 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
You're right, PYTHONPATH should prepend the existing sys.path, it should
not override it. Does one of the directories in your PYTHONPATH perhaps
also have a directory or file named bzrlib or bzrlib.py ?
Cheers,
Jelmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110307/b0df96c7/attachment.pgp>
More information about the bazaar
mailing list