How to install Python modules needed by plugins?
Eli Zaretskii
eliz at gnu.org
Tue Mar 8 06:12:45 UTC 2011
> From: Jelmer Vernooij <jelmer at samba.org>
> Cc: bazaar at lists.canonical.com
> Date: Mon, 07 Mar 2011 22:53:49 +0100
>
> > . 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.
I'm not the admin of this particular system, so I wanted to install
the dependencies in my home directory for my own use. (I'm also not
really familiar with the Ubuntu package manager, which is another
reason I didn't want to mess with it.)
In any case, I suggest to augment the Plugin Installation guide with
this information.
> 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.
That'd be a pity. Why is that? the stand-alone installer does install
something that provides Python interpreter services (python26.dll,
AFAIU), doesn't it? And I see a bunch of *.pyd files where Bazaar is
installed on my Windows machine -- could the extra modules be copied
there?
Alternatively, would it perhaps work to add the extra modules to
library.zip?
Anyway, it is not a good situation, IMHO, for such an important plugin
to be dependent on external Python modules that are a pain to install,
and without any clear documentation on how to do that, let alone doubt
that it can be installed at all on some platforms. Can something be
done to remedy this?
> > . 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.
That is a bit unexpected. Does that mean that Bazaar Python modules
need to coordinate with Python development in order to avoid name
clashes?
Also, how do I display the value of sys.path if I have no Python
interpreter (in the Windows stand-alone installation)?
> > . 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 ?
Yes, like I said:
> There's no module bzrlib in lib/python2.6/site-packages/, but there
> is a _directory_ bzrlib there.
Evidently, that directory was created by "python setup.py install"
with the setup.py module that came with bzr-fastimport. I did that as
part of my attempts to make fastimport work, before I realized (by
googling) that python-fastimport was simply not included and had to be
downloaded and installed separately.
More information about the bazaar
mailing list