-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setup: use scikit-build for building cmatrices and cshape C extensions #311
base: master
Are you sure you want to change the base?
Conversation
1663e1d
to
86b3c36
Compare
@jcfr I tried I have pip installed with pyenv. |
@fedorov Not sure what's happening. Look like the May you could try to run:
Otherwise, here is what I tried to reproduce the problem ...
I can also confirm shims are used:
|
86b3c36
to
776e6f4
Compare
@JoostJM In order to nicely support packaging and distributing pyradiomics, I just rebased this topic. |
@fedorov I will also ensure it can be installed and packaged in the SlicerRadiomics extension |
@jcfr, It appears to be working now on Windows and Mac, but not on Linux (appears to be missing a file, I'll try to follow-up on this). However, even though it works on the Appveyor, I'm still getting the unresolved externals on my own windows machine. Could this be due to the fact that I use Visual Studio 2015 compiler? Do you have an idea why this doesn't work with skbuild, but does work with native python setuptools? |
This should not be a problem
What are the steps you follow and command line you type ? |
This is my setup output
|
In which environment do you run the command to get this output ? Anaconda, windows terminal, Visual studio terminal ...
|
regular windows terminal with compiler environment variables set This also fails when I try it in anaconda prompt |
@jcfr, I debugged the Linux build. By default on my home Linux machine, it sort of performs a "develop" build, where the extensions are built and placed in the source directory, and in the python site-packages it just updates the However, on CircleCI, it installs it in the site-packages, and then I discovered that skbuild ignores the EDIT: I also checked the Windows and Travis CI builds. They appear to have this same error (package_data is not included in the installation). The reason the tests here are not failing is because they run a |
@jcfr, I think I found the error on Windows. On one machine it didn't work, but it did on the other and the issue (as it is so often) is the architecture of the builds. Apparently on the machine where it didn't work, the generator defaulted to Visual Studio 14.0 2015, but not Visual Studio 14.0 2015 Win64. And because my python build is 64 bits, it failed. Is there some way to check if a generator is for 64- or 32-bits compiling? And can that be cross-checked with the target architecture? |
@jcfr, I tried to reinstall using the current master of scikit-build, and it works now for python 2.7 on my Windows machine. However, for python3.5, there is an issue where CMake appears to find some non-existend libs and subsequently fails the build because it cannot link to those libraries. I attached the output from my commandline. The 'libraries' in question are "optimized" and "debug" (sound more like a designator, as there both an optimized and debug library are also found. If I go to the generated CMake files and update the project (by removing those 2 references), the project builds without error. I run this in a general windows terminal with command: |
Thanks for the report. We will soon release a new version of scikit-build that should allow to successfully build pyradiomics. If I recall, this commit scikit-build/scikit-build@c3a19ba ensure datafiles are packaged as expected. |
This should be addressed by https://github.com/scikit-build/scikit-build/pull/306/files |
Yes, that's why I first built scikit-build from source (current master), which already incorporates this change. |
See #283 This commit introduces new dependencies: "scikit-built" and "cmake". scikit-build is a drop-in replacement to setuptools.setup function allowing to easily compile and package extensions (C/C++/Cython) by bridging CMake and setuptools. See http://scikit-build.org CMake is is an open-source, cross-platform family of tools designed to build, test and package software. See https://cmake.org Currently, scikit-build and cmake have to be explicitly (see [1]) installed on the system. This could be done by simply doing: pip install -U scikit-build cmake How does it work ? ------------------ In addition to simplifying setup.py, two new file have been added: <root> | |---- CMakeLists.txt (1) . . . |--- ...src | |--- CMakeLists.txt (2) . . The first CMakeLists.txt specifies requirements for * Python interpreter, * the associated python libraries * and a "PythonExtension" modules containing convenience CMake functions allowing to easily build extension by encapsulating system introspection and platform specific logic. and include the subdirectory associated with the other CMakeLists.txt. The second CMakeLists.txt is specific to "cmatrices" and "cshape" extensions and it specifies: * requirement for NumPy Then, it declares: * libraries for each extension, associate python extension specific properties * and finally add an install rule specifying where in the package hierarchy the extension should be installed. Et voila, [1] Note that improvement to python packaging will be available shortly and it will be possible to include scikit-build and cmake directly in pyproject.toml See here for more details: https://www.python.org/dev/peps/pep-0518/
2ca9bf1
to
8d29d41
Compare
See #283
This commit introduces new dependencies: "scikit-built" and "cmake".
scikit-build is a drop-in replacement to setuptools.setup function
allowing to easily compile and package extensions (C/C++/Cython) by
bridging CMake and setuptools. See http://scikit-build.org
CMake is is an open-source, cross-platform family of tools designed
to build, test and package software. See https://cmake.org
Currently, scikit-build and cmake have to be explicitly (see [1]) installed
on the system. This could be done by simply doing:
pip install -U scikit-build cmake
How does it work ?
In addition to simplifying setup.py, two new file have been added:
The first CMakeLists.txt specifies requirements for
Python interpreter,
the associated python libraries
and a "PythonExtension" modules containing convenience CMake
functions allowing to easily build extension by encapsulating
system introspection and platform specific logic.
and include the subdirectory associated with the other CMakeLists.txt.
The second CMakeLists.txt is specific to "cmatrices" and "cshape"
extensions and it specifies:
Then, it declares:
libraries for each extension, associate python extension specific properties
and finally add an install rule specifying where in the package
hierarchy the extension should be installed.
Et voila,
[1] Note that improvement to python packaging will be available shortly and
it will be possible to include scikit-build and cmake directly in pyproject.toml
See here for more details: https://www.python.org/dev/peps/pep-0518/