You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As some others have pointed out in a previous post, this repo isn't really being maintained. Your best bet is to use g2o-python and follow the instructions listed in: miquelmassot/g2o-python#40.
There is something wrong with the pypi pip installation of g2o-python (it's missing a lot of functions) so make sure to build from source.
I was able to build from source on Ubuntu 20.04. Afterward, I just had to set my LD_LIBRARY_PATH to where the g2o.so's are installed and then I was able to run my script with import g2o.
I tried with numerous versions in ubuntu 24.04, outside conda, in conda env, python 3.12, python 3.8, eigen 3.4.0, eigen 3.3.9 non works and I also modified
.def("x", (double (Eigen::Quaterniond::) () const) &Eigen::Quaterniond::x)
.def("y", (double (Eigen::Quaterniond::) () const) &Eigen::Quaterniond::y)
.def("z", (double (Eigen::Quaterniond::) () const) &Eigen::Quaterniond::z)
.def("w", (double (Eigen::Quaterniond::) () const) &Eigen::Quaterniond::w)
to
.def("x", (const double &(Eigen::Quaterniond::)() const) &Eigen::Quaterniond::x)
.def("y", (const double &(Eigen::Quaterniond::)() const) &Eigen::Quaterniond::y)
.def("z", (const double &(Eigen::Quaterniond::)() const) &Eigen::Quaterniond::z)
.def("w", (const double &(Eigen::Quaterniond::)() const) &Eigen::Quaterniond::w)
and right before finish, at the same stop it fails
/home/pouya/Desktop/g2opy/EXTERNAL/pybind11/include/pybind11/pybind11.h:65:9: required from ‘pybind11::cpp_function::cpp_function(Func&&, const Extra& ...) [with Func = g2o::declareEigenTypes(pybind11::module&)::<lambda(Eigen::Matrix<double, 3, 1>&, Eigen::Matrix<double, 3, 1>&)>; Extra = {pybind11::name, pybind11::scope, pybind11::sibling}; = void]’
/home/pouya/Desktop/g2opy/EXTERNAL/pybind11/include/pybind11/pybind11.h:1097:22: required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def_static(const char*, Func&&, const Extra& ...) [with Func = g2o::declareEigenTypes(pybind11::module&)::<lambda(Eigen::Matrix<double, 3, 1>&, Eigen::Matrix<double, 3, 1>&)>; Extra = {}; type_ = Eigen::Quaternion; options = {}]’
/home/pouya/Desktop/g2opy/python/core/eigen_types.h:185:14: required from here
/home/pouya/Desktop/g2opy/EXTERNAL/pybind11/include/pybind11/eigen.h:83:20: warning: implicitly-declared ‘Eigen::Stride<-1, -1>& Eigen::Stride<-1, -1>::operator=(const Eigen::Stride<-1, -1>&)’ is deprecated [-Wdeprecated-copy]
83 | stride = {EigenRowMajor ? rstride : cstride /* outer stride /,
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84 | EigenRowMajor ? cstride : rstride / inner stride */ };
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pouya/anaconda3/envs/g2opy-env/include/eigen3/Eigen/Core:473,
from /home/pouya/Desktop/g2opy/g2o/core/eigen_types.h:30,
from /home/pouya/Desktop/g2opy/build/g2o/config.h:26,
from /home/pouya/Desktop/g2opy/g2o/core/g2o_core_api.h:13,
from /home/pouya/Desktop/g2opy/g2o/core/hyper_graph.h:40,
from /home/pouya/Desktop/g2opy/python/core/hyper_graph.h:5,
from /home/pouya/Desktop/g2opy/python/g2o.cpp:3:
/home/pouya/anaconda3/envs/g2opy-env/include/eigen3/Eigen/src/Core/Stride.h:71:5: note: because ‘Eigen::Stride<-1, -1>’ has user-provided ‘Eigen::Stride<InnerStrideAtCompileTime, OuterStrideAtCompileTime>::Stride(const Eigen::Stride<InnerStrideAtCompileTime, OuterStrideAtCompileTime>&) [with int _OuterStrideAtCompileTime = -1; int _InnerStrideAtCompileTime = -1]’
71 | Stride(const Stride& other)
| ^~~~~~
make[2]: *** [python/CMakeFiles/g2o.dir/build.make:79: python/CMakeFiles/g2o.dir/g2o.cpp.o] Error 1
make[2]: Leaving directory '/home/pouya/Desktop/g2opy/build'
make[1]: *** [CMakeFiles/Makefile2:1506: python/CMakeFiles/g2o.dir/all] Error 2
make[1]: Leaving directory '/home/pouya/Desktop/g2opy/build'
make: *** [Makefile:136: all] Error 2
(g2opy-env) pouya@mir:~/Desktop/g2opy/build$
The text was updated successfully, but these errors were encountered: