Giter Site home page Giter Site logo

Comments (2)

lacava avatar lacava commented on June 30, 2024 1

thanks for the help! the least intrusive option turned out to be building with -DPython3_FIND_VIRTUALENV=ONLY

SOURCE_DATE_EPOCH=`date +%s` cmake .. -DCMAKE_BUILD_TYPE=Release  -DBUILD_PYBIND=ON -DUSE_OPENLIBM=ON -DUSE_SINGLE_PRECISION=ON -DCERES_TINY_SOLVER=ON -DPython3_FIND_VIRTUALENV=ONLY

from operon.

foolnotion avatar foolnotion commented on June 30, 2024

Hmm, maybe we can use pkg-config as a workaround. Could you try this patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5af4c8..80f2c3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,9 +20,9 @@ find_package(Eigen3)
 find_package(Ceres)
 find_package(Threads)
 find_package(TBB)
-find_package(Python3 COMPONENTS Development Interpreter)
 find_package(pybind11)
 find_package(doctest)
+find_package(PkgConfig REQUIRED)
 
 # operon library
 set_package_properties(Git     PROPERTIES TYPE REQUIRED)
@@ -36,7 +36,7 @@ set_package_properties(doctest PROPERTIES TYPE OPTIONAL) # unit tests
 set_package_properties(cxxopts PROPERTIES TYPE OPTIONAL) # command-line parser
 
 # python binding
-set_package_properties(Python3 PROPERTIES TYPE OPTIONAL)
+pkg_check_modules(Python3 python-3.7 REQUIRED)
 set_package_properties(pybind11 PROPERTIES TYPE OPTIONAL)
 
 # get revision information from git

My hope is that pkg-config inside the conda environment will find the correct python version.

EDIT: I tested this by forcing python-3.7 inside the conda env, it works, but CMake is no longer able to autodetec the install path, so it should be specified explicitly:

CC=gcc-9 CXX=g++-9 cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SINGLE_PRECISION=ON -DBUILD_PYBIND=ON -DUSE_OPENLIBM=ON -DCERES_TINY_SOLVER=ON -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX/lib/python3.7/site-packages/

This works for now, however I am a bit reluctant to commit this fix since it still seems more like a workaround.

EDIT2:
Another couple options that might work:

  • Use find_package(Python3 3.x.x EXACT REQUIRED) to match an exact version.
  • Use -DPython3_ROOT_DIR to tell CMake where to find the Python3 installation

from operon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.