# Python package in installed version of slicer

**URL:** <https://discourse.slicer.org/t/python-package-in-installed-version-of-slicer/19937>\
**Category:** Development\
**Created:** [September 30, 2021, 3:44pm UTC](https://discourse.slicer.org/t/python-package-in-installed-version-of-slicer/19937 "2021-09-30T15:44:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [September 30, 2021, 3:44pm UTC](https://discourse.slicer.org/t/python-package-in-installed-version-of-slicer/19937/1 "2021-09-30T15:44:30Z")

</div>

Hi everyone,  
We are working on a slicelet on Slicer v4.11.20210226. We are installing a library call weasyprint during compilation time. Everything is working fine in development environment. However, when we generate the installer, the application crashes at

> import weasyprint

and generate an error when trying to do:

> from PIL import Image

Same thing on slicer stable version. However, on the preview version, everything is fine.  
Could anyone give me a hint to know what could have solved this issue at install?

Cheers,  
Pierre

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 30, 2021, 3:59pm UTC](https://discourse.slicer.org/t/python-package-in-installed-version-of-slicer/19937/2 "2021-09-30T15:59:32Z")

</div>

weasyprint has tons of dependencies - see [WeasyPrint/first\_steps.rst at master · Kozea/WeasyPrint · GitHub](https://github.com/Kozea/WeasyPrint/blob/master/docs/first_steps.rst). You need to make sure that all those dependencies are bundled with your application as it was recommended [here](https://discourse.slicer.org/t/python-package-installation/19496).

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [September 30, 2021, 4:02pm UTC](https://discourse.slicer.org/t/python-package-in-installed-version-of-slicer/19937/3 "2021-09-30T16:02:51Z")

</div>

Is your platform Linux?

You might be experiencing the issue discussed below which was tracked as [Importing the numpy C-extensions failed. [slicer 4.11.20200930, archlinux] · Issue #5474 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/issues/5474) and fixed in mid-March 2021 (after the Slicer 4.11.20210226 release).

> [@Slicer-4.11.20200930: Can't import pip-installed Pillow on Linux](https://discourse.slicer.org/t/slicer-4-11-20200930-cant-import-pip-installed-pillow-on-linux/14448):
>
> Hi all, I can’t run the line below in the current Linux stable (and preview) release, after running pip\_install('Pillow'): \>\>\> from PIL import Image Traceback (most recent call last): File "\<console\>", line 1, in \<module\> File "/home/fernando/opt/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/PIL/Image.py", line 94, in \<module\> from . import \_imaging as core ImportError: /home/fernando/opt/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/…

---

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [September 30, 2021, 4:30pm UTC](https://discourse.slicer.org/t/python-package-in-installed-version-of-slicer/19937/4 "2021-09-30T16:30:48Z")

</div>

Thank you both. Yes, we are on linux, I will check this, it looks interesting!! I let you know.  
Pierre
