Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile C++ dependencies during pip install?

I want to make my python code pip-able. However, my code depends on another library which isn't pip-able. So, somehow I need to compile the source code when a user calls pip install.

How can I do that? I haven't been able to find a good reference via simple Google searches.

like image 755
Fabian Avatar asked Jun 05 '15 03:06

Fabian


People also ask

Does pip install install dependencies?

Pip is able to install packages configured with their dependencies, because most authors package their code as wheels by default before submitting to PyPI.

Does pip check for dependencies?

The pip install <package> command always looks for the latest version of the package and installs it. It also searches for dependencies listed in the package metadata and installs them to ensure that the package has all the requirements that it needs.

How do I get dependency of pip package?

Instead, package dependencies can be seen using one of the following commands in Python: pip show: List dependencies of Python packages that have already been installed. pipdeptree: List the dependencies in a tree form. Pip list: List installed packages with various conditions.


1 Answers

I would recommend taking a look at how llvmlite solves this problem. The idea is to use custom cmdclasss in setup.py that calls your other build system. In llvmlite, they call out to CMake, for example.

See: https://github.com/numba/llvmlite/blob/master/setup.py

like image 161
Robert T. McGibbon Avatar answered Oct 20 '22 18:10

Robert T. McGibbon