-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Package request: Open3D #115218
Comments
The entire day I have attempted to package it. I'm stuck on trying to resolve an include for ``. Open3D depends on filament which depends on google test which depends on libcxxabi which apparently depends on libcxx. But that last dependency link goes wrong and I don't know how to fix it. I have cloned the open3D repo added the nix files and patched some things. It's located here: https://github.com/rowanG077/Open3D/tree/v0.12.0-nix Any help would be greatly appreciated! |
I have isolated the
|
I marked this as stale due to inactivity. → More info |
I hope this will get support in the future. it looks like a pretty exciting new project: http://www.open3d.org/ |
@rowanG077 this expression works for me. Would you be willing to clean it up so it can be packaged? (borrows some code from https://github.com/mipmip/nixos/blob/45dea7930eafa18b31424be0e2d850e7a3c7504a/pkgs/open3d/default.nix)
|
@lapp0 Fun fact that linked expression was written by me a while back :), see here: https://gist.github.com/rowanG077/7f46a0807c108fe4b582067f237ae867. Just didn't care to upstream it. The reason for it is because it uses the precompiled wheels. Which I don't really like. |
@rowanG077 Are you still working on packaging May I ask what is your current solution to this? I am willing to join the effort if you are still on it. Thanks! |
Not stale. |
@breakds I'm still interested. But going to "correct" path will take a lot of time I don't have right now. My current solution is that I have packaged the wheel locally. |
@rowanG077 Thank you! Do you have an updated wheel solution, or is the 0.12 gist the most up to date? Meanwhile I'll make an attempt to package it from the source, but since I am less experienced, I might put problems / questioins here. |
@breakds yes 0.12 is the most uptodate. |
I am trying to get Open3D to work with python3.10 and I have gotten this far. I seem to have trouble with the libraries that I mention under Which ever way I keep tying things something always does not seem to work properly. Did anyone manage to get it to work or has any suggestions.
|
It's an ubuntu-ism. Adding Regarding |
@rowanG077 Thanks, yah that brings me down to Those in turn seem to be dependencies of Could it be that there are some libGL libraries that also simply just need to be remapped? Is there a way to explore what is inside a package e.g. start a nix-shell and then explore the directories it adds? |
Yeah, honestly opengl/opencl/nvidia/cuda etc are all a mess in nix. I don't know how it all fits together. You can use this command to get the nix store path of a package (mesa used here an example):
You can look around in that folder to see what certain package bring into scope. |
Hi, did any of you make any progress packaging the latest version? |
Tagging @pfmephisto, you are probably interested :). Yes. I have something working. I have found no way to get pytorch to output the split cuda libraries. I tried various things but building it takes ages so I stopped trying since I didn't really need t anyway. See the { stdenv, lib, buildPythonPackage, fetchPypi, addict
, numpy, matplotlib, ipywidgets, pandas, pyyaml, tqdm
, autoPatchelfHook, llvm_10, xorg, libtorch-bin, libtensorflow, libusb
, cudaPackages, libGL, nbformat, dash, configargparse, pyquaternion, scikit-learn
, expat, pytorchWithCuda }:
let
nbformat-570 = nbformat.overridePythonAttrs (old: rec {
version = "5.7.0";
JUPYTER_PLATFORM_DIRS=1;
src = fetchPypi {
inherit version;
pname = old.pname;
hash = "sha256-HUdgwVwaBCae9crzdb6LmN0vaW5eueYD7Cvwkfmw0/M=";
};
});
pytorchSplitCuda = pytorchWithCuda.overridePythonAttrs (old: rec {
preConfigure = old.preConfigure + ''
export BUILD_SPLIT_CUDA=1
'';
});
in buildPythonPackage rec {
pname = "open3d";
version = "0.17.0";
format = "wheel";
src = fetchPypi {
inherit pname version format;
sha256 = "sha256-PcMAaXMgu2iCRsXQn2gQRYFcMyIlaFc/GWSy11ZDFlc=";
dist = "cp310";
python = "cp310";
abi = "cp310";
platform = "manylinux_2_27_x86_64";
};
nativeBuildInputs = [
autoPatchelfHook
];
autoPatchelfIgnoreMissingDeps = [
"libtorch_cuda_cpp.so"
"libtorch_cuda_cu.so"
];
# Fix llvm library name to match Ubuntu name
# Remove libraries that actually should be provided by environment
postInstall = ''
ln -s "${llvm_10.lib}/lib/libLLVM-10.so" "$out/lib/libLLVM-10.so.1"
rm $out/lib/python3.10/site-packages/open3d/libGL.so.1
rm $out/lib/python3.10/site-packages/open3d/swrast_dri.so
rm $out/lib/python3.10/site-packages/open3d/libgallium_dri.so
rm $out/lib/python3.10/site-packages/open3d/kms_swrast_dri.so
rm $out/lib/python3.10/site-packages/open3d/libEGL.so.1
'';
buildInputs = [
stdenv.cc.cc.lib
libusb.out
libGL
cudaPackages.cudatoolkit
libtorch-bin
libtensorflow
expat
xorg.libXfixes
nbformat
];
propagatedBuildInputs = [
# py deps
numpy
dash
configargparse
scikit-learn
ipywidgets
addict
matplotlib
pandas
pyyaml
tqdm
pyquaternion
pytorchWithCuda
];
} |
I ended up switching to Ubuntu (I know 😅), but I need something that worked and did not have more time to debug the derivation. |
@rowanG077 is this package available in a git repo on your profile? Could you also help with pointers to convert your code to a flake version? |
@OladapoAjala This is what I have based on @rowanG077's original packaging: https://github.com/nixvital/ml-pkgs/blob/main/pkgs/open3d/default.nix |
Right, sorry that I left it broken. It should be fixed now in the main branch. However, like @rowanG077 has mentioned there are still some dependencies for patchelf not being found. I tested it just by loading a |
Hello I have a similar problem now. On nixos Here is my
If I update the
I am a nixos newbie and would gladly accept any suggestions how to make it work. Thanks in advance :) |
Finally made it work :) 🥳 🥳 on nixos {
description = "Opend3d developmen environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
fetchPypi = pkgs.python311Packages.fetchPypi;
customPython = pkgs.python311.override {
packageOverrides = self: super: {
opencv4 = super.opencv4.override {
enableGtk2 = true;
gtk2 = pkgs.gtk2;
enableFfmpeg = true;
};
};
};
open3d = pkgs.python311Packages.buildPythonPackage rec {
pname = "open3d";
version = "0.18.0";
format = "wheel";
src = pkgs.python311Packages.fetchPypi {
pname = "open3d";
version = "0.18.0";
format = "wheel";
sha256 = "sha256-jj0dGQCo9NlW9oGcJGx4CBclubCIj4VJ0qeknI2qEwM=";
dist = "cp311";
python = "cp311";
abi = "cp311";
platform = "manylinux_2_27_x86_64";
};
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
autoPatchelfIgnoreMissingDeps = [
"libtorch_cuda_cpp.so"
"libtorch_cuda_cu.so"
"libtorch_cuda.so"
"libc10_cuda.so"
];
buildInputs = with pkgs; [
cudaPackages.cudatoolkit
stdenv.cc.cc.lib
libusb.out
libGL
cudaPackages.cudatoolkit
libtorch-bin
libtensorflow
expat
xorg.libXfixes
mesa
xorg.libX11
xorg.libXfixes
];
propagatedBuildInputs = with pkgs.python311Packages; [
nbformat
numpy
dash
configargparse
scikit-learn
ipywidgets
addict
matplotlib
pandas
pyyaml
tqdm
pyquaternion
];
postInstall = ''
ln -s "${pkgs.llvm_10.lib}/lib/libLLVM-10.so" "$out/lib/libLLVM-10.so.1"
rm $out/lib/python3.11/site-packages/open3d/libGL.so.1
rm $out/lib/python3.11/site-packages/open3d/swrast_dri.so
rm $out/lib/python3.11/site-packages/open3d/libgallium_dri.so
rm $out/lib/python3.11/site-packages/open3d/kms_swrast_dri.so
rm $out/lib/python3.11/site-packages/open3d/libEGL.so.1
'';
};
pythonEnv = customPython.withPackages (ps:
with ps; [
matplotlib
numpy
scipy
requests
opencv4
flake8
black
open3d
]);
in {
devShell = pkgs.mkShell {
buildInputs =
[ pythonEnv pkgs.python311Packages.pip pkgs.gtk2 pkgs.ffmpeg ];
shellHook = ''
echo "Welcome to the Python development environment."
'';
};
});
} |
This currently doesn't work on unstable due to #283954 removing it. |
Have anyone tried to get the C++ version of open3d to work? It is virtually impossible to build it from source, as open3d loves to download different third party dependencies over the internet through cmake, so I have this messy derivation: { stdenv
, cmake
, ninja
, autoPatchelfHook
, xorg
, assimp
, curl
, curlpp
, eigen
, embree
, fmt
, glew
, glfw
, gtest
, imgui
, libjpeg
, jsoncpp
, msgpack
, nanoflann
, openssl
, boringssl
, libpng
, qhull
, tbb
, tinyobjloader
, vtk
, zeromq
, libcxx
, libGL
, mesa
, libusb
, libtensorflow
, binutils
, libudev-zero
, libudev0-shim
, udev
, systemd
# , pytorchWithCuda
# , libtensorflow-bin
# , cudaPackages
, lib
}:
stdenv.mkDerivation rec {
pname = "Open3D";
version = "0.18.0";
src = builtins.fetchTarball {
url = "https://github.com/isl-org/Open3D/releases/download/v${version}/open3d-devel-linux-x86_64-cxx11-abi-${version}.tar.xz";
sha256 = "sha256:0da7xw7gvc458s6jgsflkdkh54fj4gq5qxy1s0b8ls37hi80g5fy";
# sha256 = lib.fakeHash;
};
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r $src/* $out
runHook postInstall
'';
preFixup = let
# we prepare our library path in the let clause to avoid it become part of the input of mkDerivation
libPath = lib.makeLibraryPath [
stdenv.cc.cc.lib # libstdc++.so.6
libudev-zero
libudev0-shim
udev
systemd
xorg.libX11
libcxx
libGL
];
# --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
in ''
patchelf \
--set-rpath "${libPath}" \
--add-needed libudev.so \
--add-needed libudev.so.1 \
$out/lib/libOpen3D.so
'';
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
xorg.libX11
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
assimp
curl
curlpp
eigen
embree
fmt
glew
glfw
gtest
imgui
libjpeg
jsoncpp
msgpack
nanoflann
openssl
boringssl
libpng
qhull
tbb
tinyobjloader
vtk
zeromq
libcxx
libGL
mesa
stdenv.cc.cc.lib
libusb.out
libtensorflow
binutils
libudev-zero
libudev0-shim
udev
systemd
# pytorchWithCuda
# libtensorflow-bin
# cudaPackages.cudatoolkit_10_1.lib
];
} This builds fine, but I get "undefined reference" errors regarding a bunch of |
I have a wip from source. As you mention, this is a nightmare, so clearly not finished yet :( But I can be very stubborn on this topic, and I need this package by the end of the month, so I might open a PR next week :) |
@nim65s it would be amazing if you got this working! Could you share your current wip, perhaps I could try to help out? |
Yeah I once tried to build it from source and spend a day chasing dependencies and gave up... There is an upstream PR for a nix setup: isl-org/Open3D#6854 |
my wip is clearly too early to be useful: https://github.com/nim65s/nixpkgs/tree/open3d |
@rowanG077 Oooh, I saw that PR some time ago, but didn't follow to his nix derivation. I've slightly modified his derivation to build a C++ library instead, and that seems actually to work! |
Project description
Open3D is a modern fully featured 3D processing(Pointclouds, meshes etc) environment. I tried to package it myself but quickly ran into my limited nix knowledge. :(
Metadata
The text was updated successfully, but these errors were encountered: