Install pisa on Ubuntu (django)

6.3k views Asked by At

I'm trying to install pisa, I have all the requirements installed.

I try import:

import ho.pisa as pisa

or:

import xhtml2pd.pisa as pisa

Error:

ImportError
Exception Value:    

No module named reportlab.lib.units

Last traceback:

from pisa_util import *

from reportlab.lib.units import inch, cm

I'm running in virtual environment. I believe i have all requirements installed.

I did:

sudo apt-get install python-pisa

created test.html, and in command-line:

xhtml2pdf test.html target.pdf

This generate pdf correctly

However:

pip install reportlab
Requirement already satisfied (use --upgrade to upgrade): reportlab in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Still throw error.

Any help is appreciated.

2

There are 2 answers

0
nhahtdh On BEST ANSWER

This is the solution by the question's author, moved to the appropriate section.
To question's author: if you want to gain reputation, feel free to write a new answer, then ping me to remove this answer.

Finally fixed the issue.

If you are in virtual environment, you must execute:

pip install reportlab

in the bin directory under project folder, i.e.:

~/.virtualenvs/project/bin
0
user2387567 On

pip install xhtml2pdf

pip install pisa