Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download PDF generates Import Error: Reportlab Version 2.1+ is needed! #174

Closed
mcchan1 opened this issue Feb 19, 2014 · 6 comments
Closed

Comments

@mcchan1
Copy link

mcchan1 commented Feb 19, 2014

Hi,

I'm a Django noob, and I'm generally out of my league when it comes to dependency issues. Thanks in advance for your help!

When I try to generate a PDF of the invoice, I receive this error:

"Reportlab Version 2.1+ is needed!"

I have Reportlab 3.0 installed.

I'm working in a clean virtualenv. This is my pip freeze:

Cartridge==0.9.2
Django==1.6.2
Drum==0.1.2
Mezzanine==3.0.9
PIL==1.1.7
Pillow==2.3.0
bleach==1.4
feedparser==5.1.3
filebrowser-safe==0.3.2
future==0.9.0
grappelli-safe==0.3.6
html5lib==1.0b3
oauthlib==0.6.1
pisa==3.0.33
pyPdf==1.13
pytz==2013.9
reportlab==3.0
requests==2.2.1
requests-oauthlib==0.4.0
six==1.5.2
sphinx-me==0.2.1
tzlocal==1.0
wsgiref==0.1.2
xhtml2pdf==0.0.5

@stephenmcd
Copy link
Owner

That error doesn't come from cartridge. My best guess is the pisa lib that uses it for generating pdfs, suggest chasing it up with that project:

https://pypi.python.org/pypi/pisa/3.0.33

@mcchan1
Copy link
Author

mcchan1 commented Feb 21, 2014

Thanks. As suggested, I was able to find the help I needed on the "xhtml2pdf" googlegroup mailing list.

FYI: I went into ./lib/python2.7/site-packages/sx/pisa3/pisa_util.py to implement this solution:

"The problem is with the installation.
The init checks for a variable REPORTLAB22. This is imported from util.py.
The code in util.py is using the following logic

if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
raise ImportError("Reportlab Version 2.1+ is needed!")
REPORTLAB22 = (reportlab.Version[0] == "2" and reportlab.Version[2] >= "2")

This will fail as the reportlab version is now 3.0.

Just replace this code segment with the following:

if not (reportlab.Version[:3]>="2.1"):

raise ImportError("Reportlab Version 2.1+ is needed!")

REPORTLAB22 = (reportlab.Version[:3]>="2.1")

@ghost
Copy link

ghost commented Jul 30, 2016

Option 1 :

Remove below in your requirements.txt file
pisa==x.x.xx

and add:

-e git+https://github.com/rajanmandanka/pisa.git#egg=pisa

Option 2:

  1. uninstall pisa
    pip uninstall pisa
  2. install pisa using pip
    pip install git+https://github.com/rajanmandanka/pisa.git

@jerivas
Copy link
Collaborator

jerivas commented Jul 30, 2016

Could you elaborate a bit? Which versions of Python / Django / Mezzanine
/ Cartridge are you using? Can you provide a reproducible test case?

@ghost
Copy link

ghost commented Aug 1, 2016

I am using python 2.7

app-version==0.2.1
Django==1.8
django-bootstrap-breadcrumbs==0.7.3
django-ckeditor==5.0.1
django-countries==3.3
django-crispy-forms==1.4.0
django-extensions==1.5.3
django-eztables==0.3.2
django-grappelli==2.6.4
django-mathfilters==0.4.0
django-model-utils==2.2
django-notifications-hq==0.7.0
django-password-reset==0.7
django-popup-forms==1.0.3
django.js==0.8.1
djangorestframework==3.3.3
html5lib==1.0b7
jsonfield==1.0.3
MySQL-python==1.2.5
oauthlib==1.0.3
Pillow==3.3.0
-e git+https://github.com/rajanmandanka/pisa.git#egg=pisa
pycrypto==2.6.1
pyPdf==1.13
PyPDF2==1.25
python-dateutil==2.4.2
reportlab==3.2.0
requests==2.10.0
requests-oauthlib==0.5.0
sh==1.11
simplejson==3.7.3
six==1.9.0
tinify==1.3.0
tolerance==0.1.2
validate-email==1.3
Wand==0.4.0
WTForms==2.0.2

@andreipradan
Copy link

git+https://github.com/rajanmandanka/pisa.git#egg=pisa not found anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants