Edinburgh-Genome-Foundry / blabel

:label: Python label/sticker PDF generation. HTML templates, built-in barcodes, qr codes, and other goodies
https://edinburgh-genome-foundry.github.io/blabel
MIT License
179 stars 38 forks source link

Can you add a section of how to install it. #1

Closed priya-gitTest closed 4 years ago

priya-gitTest commented 5 years ago

I tried to install the same in Anaconda prompt, the installation went fine but than I ran into the following error when I ran a sample code via Jupyter Notebook.

in ----> 1 from blabel import LabelWriter 2 3 label_writer = LabelWriter("item_template.html", items_per_page=3, 4 default_stylesheets=("style.css",)) 5 records= [ C:\ProgramData\Anaconda3\lib\site-packages\blabel\__init__.py in 3 # __all__ = [] 4 ----> 5 from .blabel import LabelWriter 6 from .tools import JupyterPDF C:\ProgramData\Anaconda3\lib\site-packages\blabel\blabel.py in 4 5 import jinja2 ----> 6 from weasyprint import HTML 7 from . import label_tools 8 from . import tools C:\ProgramData\Anaconda3\lib\site-packages\weasyprint\__init__.py in 438 439 # Work around circular imports. --> 440 from .css import preprocess_stylesheet # noqa isort:skip 441 from .html import ( # noqa isort:skip 442 HTML5_UA_STYLESHEET, HTML5_PH_STYLESHEET, find_base_url, get_html_metadata) C:\ProgramData\Anaconda3\lib\site-packages\weasyprint\css\__init__.py in 28 from ..logger import LOGGER, PROGRESS_LOGGER 29 from ..urls import URLFetchingError, get_url_attribute, url_join ---> 30 from . import computed_values, media_queries 31 from .properties import INHERITED, INITIAL_NOT_COMPUTED, INITIAL_VALUES 32 from .utils import remove_whitespace C:\ProgramData\Anaconda3\lib\site-packages\weasyprint\css\computed_values.py in 15 from tinycss2.color3 import parse_color 16 ---> 17 from .. import text 18 from ..logger import LOGGER 19 from ..urls import get_link_attribute C:\ProgramData\Anaconda3\lib\site-packages\weasyprint\text.py in 12 import re 13 ---> 14 import cairocffi as cairo 15 import cffi 16 import pyphen C:\ProgramData\Anaconda3\lib\site-packages\cairocffi\__init__.py in 48 cairo = dlopen( 49 ffi, ('cairo', 'libcairo-2'), ---> 50 ('libcairo.so', 'libcairo.2.dylib', 'libcairo-2.dll')) 51 52 C:\ProgramData\Anaconda3\lib\site-packages\cairocffi\__init__.py in dlopen(ffi, library_names, filenames) 43 error_message = '\n'.join( # pragma: no cover 44 str(exception) for exception in exceptions) ---> 45 raise OSError(error_message) # pragma: no cover 46 47 OSError: no library called "cairo" was found no library called "libcairo-2" was found cannot load library 'libcairo.so': error 0x7e cannot load library 'libcairo.2.dylib': error 0x7e cannot load library 'libcairo-2.dll': error 0x7e
Zulko commented 5 years ago

Thanks for reporting this problem, I'll look into that in a few days but in the meantime it seems that you need cairo and cairocffi installed so you should google that. I would point you to this installation help but I am not sure it helps for windows.

Let me know if/how you solve the problem so I can include it when I update the docs.

hlovdal commented 4 years ago

The following is an incomplete (I think) list of dependencies I had to install (running in a git for windows bash session)

pip3 install jinja2
pip3 install weasyprint
pip3 install cairo
pip3 install qrcode
pip3 install python-Levenshtein
pip3 install barcode
pip3 install pystrich

Notice that weasyprint requires additional GTK+ runtime installation, could it be something that Jupytr is not picking up?

Zulko commented 4 years ago

Thanks for bumping this one up, totally forgot. I have now added an installation section in the README and docs.

@hlovdal normally, installing with pip3 install blabel should automatically install all the required dependencies. Didn't it work for you?