# Pip install packages that need compilation

**URL:** <https://discourse.slicer.org/t/pip-install-packages-that-need-compilation/12859>\
**Category:** Development\
**Tags:** python, pip\
**Created:** [August 4, 2020, 10:32pm UTC](https://discourse.slicer.org/t/pip-install-packages-that-need-compilation/12859 "2020-08-04T22:32:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezgimercan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezgimercan/32/4584_2.png) [@ezgimercan](https://discourse.slicer.org/u/ezgimercan)\
**Post date:** [August 4, 2020, 10:32pm UTC](https://discourse.slicer.org/t/pip-install-packages-that-need-compilation/12859/1 "2020-08-04T22:32:46Z")

</div>

Continuing the discussion from [Slicer-Python Packages Use and Install](https://discourse.slicer.org/t/slicer-python-packages-use-and-install/984/14):

> [@Slicer-Python Packages Use and Install](https://discourse.slicer.org/t/slicer-python-packages-use-and-install/984/14):
>
> Slicer’s pip does not yet support packages that need compilation. To get access to all Python packages, you have to build Slicer with your Python distribution. See some information here: [https://www.slicer.org/wiki/Documentation/Labs/SlicerCondaIntegration](https://www.slicer.org/wiki/Documentation/Labs/SlicerCondaIntegration)

Hi Andras,  
Just checking to see if this is still the case. I am trying to integrate an old C++ code into a scripted module, I converted all to Python and it is using dlib library ([dlib · PyPI](https://pypi.org/project/dlib/)). I am getting CMake errors from Python Interactor, which I assume related to the above post.

```
RuntimeError:
*******************************************************************
 CMake must be installed to build the following extensions: dlib
*******************************************************************

```

Thanks!

---

<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:** [August 4, 2020, 11:20pm UTC](https://discourse.slicer.org/t/pip-install-packages-that-need-compilation/12859/2 "2020-08-04T23:20:42Z")

</div>

Yes, for ones that need to be compiled I would suggest to do the method described in this post so that it is compiled and packaged at time of building the extension. The build machine of the extension would then be the one that would need the build requirements.

> [@Install python library with extension](https://discourse.slicer.org/t/install-python-library-with-extension/10110/8):
>
> Ciao @PaoloZaffino, if your extension is in the extension manager, you can actually do it directly in the cmake (so they will be packed at compilation time on the kitware factory machines): add python requirements in the superbuild: [https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild.cmake#L28](https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild.cmake#L28)[https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild/slicerastro-requirements.txt](https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild/slicerastro-requirements.txt)[https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild/External\_python-slicerastro-requirements.…](https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild/External_python-slicerastro-requirements.cmake)

---

<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:** [August 4, 2020, 11:30pm UTC](https://discourse.slicer.org/t/pip-install-packages-that-need-compilation/12859/3 "2020-08-04T23:30:17Z")

</div>

If you’re curious about if dlib would make prebuilt binaries, you can see the developer’s response at [https://github.com/davisking/dlib/issues/2121#issuecomment-653662699](https://github.com/davisking/dlib/issues/2121#issuecomment-653662699).

Of course finding a different python package that can do what you want and has wheels could be another option to avoid a superbuild project.

---

<div class="post-metadata">

**Author:** ![ezgimercan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezgimercan/32/4584_2.png) [@ezgimercan](https://discourse.slicer.org/u/ezgimercan)\
**Post date:** [August 4, 2020, 11:32pm UTC](https://discourse.slicer.org/t/pip-install-packages-that-need-compilation/12859/4 "2020-08-04T23:32:28Z")

</div>

Thanks, this helps a lot! I think I can find similar functions in opencv.
