GeneralCode
GeneralCode

Reputation: 964

How to pip install a package that needs cython code built?

I have Cython code that wraps C++ code, which needs compiled before running. To do this, I use the following line: python setup.py build_ext --inplace

However, a great thing about python is the setup.py file and the ability to install packages to pip. All previous version of my code were able to be installed to pip and then called without being moved to a local directory for whoever was using it. Just like numpy, scipy, etc.

Is there any way to pip install a package and have the Cython files compiled at the same time?

Upvotes: 6

Views: 5024

Answers (1)

GeneralCode
GeneralCode

Reputation: 964

If you have the ability to run python setup.py build_ext --inplace, and it works. A pip install is essentially a build not inplace. Therefore, if you run pip install path/to/folder.zip and everything is properly defined in setup.py, then the necessary files with be compiled and able to be called in the package.

Upvotes: 2

Related Questions