Skip to content
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

Fix python install setup.py #154

Merged
merged 2 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@ We envision KISS-ICP as a comunity-driven project, we love to see how the projec
<a href="https://github.com/PRBonn/kiss-icp/graphs/contributors">
<img src="https://contrib.rocks/image?repo=PRBonn/kiss-icp" />
</a>

[![Star History Chart](https://api.star-history.com/svg?repos=PRBonn/kiss-icp&type=Date)](https://star-history.com/#PRBonn/kiss-icp&Date)
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = [
"cmake",
"ninja",
"scikit-build",
"scikit-build>=0.17.4",
"setuptools<66.0.0", # https://github.com/pypa/setuptools/issues/3772
]
build-backend = "setuptools.build_meta"
Expand Down
88 changes: 27 additions & 61 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,68 +20,34 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import contextlib
import os
import shutil

from setuptools import find_packages
from skbuild import setup


@contextlib.contextmanager
def skbuild_isolated_context():
"""This hack should be removed soon: https://github.com/scikit-build/scikit-build/issues/755.

For whatever reason, when building the package in isolated mode (PEP 517) the cmake and ninja
dependencies (that are indeed installed by the build system)do not expose the binary paths.
Internally scikit-build uses $PATH/cmake and $PATH/ninja to analyze if those tools are installed
on the system or not. Since this is not working, the workaround for those machines that do not
have a local installation of the tools is to update the path with the given binary dirs from the
isolation-installed packages.
"""

def cmd_exists(cmd):
return shutil.which(cmd) is not None

if not cmd_exists("cmake"):
import cmake # pylint: disable=import-outside-toplevel

os.environ["PATH"] += os.pathsep + cmake.CMAKE_BIN_DIR

if not cmd_exists("ninja"):
import ninja # pylint: disable=import-outside-toplevel

os.environ["PATH"] += os.pathsep + ninja.BIN_DIR

yield


with skbuild_isolated_context():
setup(
packages=find_packages(),
cmake_install_dir="kiss_icp/pybind/",
cmake_install_target="install_python_bindings",
entry_points={"console_scripts": ["kiss_icp_pipeline=kiss_icp.tools.cmd:run"]},
install_requires=[
"natsort",
"numpy",
"plyfile",
"pydantic",
"pyquaternion",
"rich",
"tqdm",
"typer[all]>=0.6.0",
setup(
packages=find_packages(),
cmake_install_dir="kiss_icp/pybind/",
cmake_install_target="install_python_bindings",
entry_points={"console_scripts": ["kiss_icp_pipeline=kiss_icp.tools.cmd:run"]},
install_requires=[
"natsort",
"numpy",
"plyfile",
"pydantic",
"pyquaternion",
"rich",
"tqdm",
"typer[all]>=0.6.0",
],
extras_require={
"visualizer": [
"open3d>=0.13",
],
"all": [
"PyYAML",
"open3d>=0.13",
"ouster-sdk>=0.7.1",
"pyntcloud",
"trimesh",
],
extras_require={
"visualizer": [
"open3d>=0.13",
],
"all": [
"PyYAML",
"open3d>=0.13",
"ouster-sdk>=0.7.1",
"pyntcloud",
"trimesh",
],
},
)
},
)