Django-Easy-PDF: XHTML2PDF Reporting ReportingLab 2.2+ è richiesto, ma 3.0 installato
Domanda
Sto cercando di dare un django-easy-pdf
A Go, ma sto avendo problemi a installare dipendenze.
Ottengo ImportError: No module named xhtml2pdf.default
quando esegui Django.
Per tentare di fissare, ho fatto un pip install xhtml2pdf
, ma che produce Could not find any downloads that satisfy the requirement pyPdf (from xhtml2pdf)
.
Quindi facciamo un pip install --allow-unverified pyPdf pyPdf
per aggirarlo.Questo completato senza problemi.Quando si ripete il pip install xhtml2pdf
, il software viene installato senza un problema.
Tuttavia, quando si avvia Django 1.6, ottengo: ImportError: Reportlab Version 2.1+ is needed!
.
Ho reportLab 2.2 o successivo installato, poiché un pip freeze
elenca 3.0.
Sembra che questo sia hardcoded in alcuni file (util.py
e __init__.py
):
if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
raise ImportError("Reportlab Version 2.1+ is needed!")
if not REPORTLAB22:
raise ImportError, "Reportlab Toolkit Version 2.2 or higher needed"
.
Come può essere risolto (tranne per rimuovere questi controlli dalla fonte)?
Soluzione
L'autore menziona su https://github.com/nigma/django-asy-pdf : .
django-easy-pdf depends on:
django>=1.5.1
git+https://github.com/chrisglass/xhtml2pdf.git
.
Quella versione specifica deve essere installata, e non quella disponibile in PYPI.Prima disinstallazione XHTML2PDF e PYPDF utilizzando pip uninstall
, quindi fai:
pip install git+https://github.com/chrisglass/xhtml2pdf.git