[reportlab-users] Reportlab compiling in Linux

Andy Robinson andy at reportlab.com
Thu May 3 04:22:16 EDT 2007

Great news so far - it all compiled fine so you just have some path problems.

> 5. After the build, found the location of _renderPM.so and added its

> location into the Python path, by using the following command,

> PATH=$PATH\:/home/davidfrank/reportlab_2_0/reportlab/rl_addons/build/lib.linux-x86_64-2.3

> ; export PATH

That amends the path seen by the shell for executing operating system
commands - not the Python path for importing modules.

> 6. CD into the home directory, /home/davidfrank/, opened my python test

> program, newbars.py, and added the lines


> import sys

> sys.path.append('/home/davidfrank/reportlab_2_0/reportlab/build/lib')

that adds the above directory (which doesn't actually exist - you have
'lib.linux-blablablh) to the Python path but only for this particular
module's execution. Anyway it's a temporary directory and the wrong
way to do it).

OK, here's the problem. "setup.py install" normally moves the built
extensions to a place on the Python path for the whole system
(e.g./usr/local/lib/python2.3/site-packages), so that both 'reportlab'
and '_renderPM' would both be there, and importable by all scripts.
'build' just builds them and it is up to you to move the built
extension to somewhere on YOUR path, then delete the build directory
which you don't need again.

Decide on a location for Python libraries under your home user
account. Let's say it's "/home/davidfrank/pylibs'. Put the
'reportlab' directory, the '_renderPM' and any other Python libraries
in there.

Then, in your shell, execute something to add this to the Python path.
I think it's something like this (but I am not a Linux person and
get confused about different shells. Some need SET in front ).

PYTHONPATH = /home/davidfrank/pylibs

Once this is done, you should be able to cd to anywhere else (e.g.
/home/davidfrank), start Python, and execute 'import reportlab', and
rerun rl_check.py

You can also delete the build directories and even the rl_addons
directory (whwich is just source code) once all extensions are tested
and installed.


> 7. Typed in the command, $python newbars.py, and I once again get the

> message,


Hopefully this will now work. The final step would be to put the
PYTHONPATH commands in your shell startup script, and to get rid of
any surplus copies of reportlab lying around.

Keep all your libraries under one directory on the python path, and
then your top-level scripts can live anywhere.

Hope this helps further. You're 90% there.

- Andy

More information about the reportlab-users mailing list