Skip to content

Conversation

elgiano
Copy link

@elgiano elgiano commented Sep 14, 2024

When auto-detecting python for building docs, prefer a version from a virtual environment if present.
I come to this problem when building flucoma-sc. As I don't want to install flucoma-docs dependencies system-wise, I create a virtual environment in my build folder, and pip install just there. With this PR, the build system detects the virtual env automatically.

@tremblap
Copy link
Member

tremblap commented Oct 9, 2024

I don't know what @weefuzzy think of this, but personally I use virtual environments by declaring:

set(Python_EXECUTABLE "/Users/pa/flucoma-env/bin/python" CACHE PATH "")

when I cmake the sc repo and boom, it works.

@weefuzzy
Copy link
Member

weefuzzy commented Oct 9, 2024

I don't see a compelling reason to bake this preference into the cmake code. Things like Python3_FIND_VIRTUALENV are meant as hints passed by users.

To make it less annoying to set every time you could make a CMakeUserPresets.json and declare a preset that sets this variable for you (along with any other repeatedly needed settings). (At some point we're going to move to using presets widely, and quite a lot of cruft can come out of the cmake code (I hope)).

@weefuzzy
Copy link
Member

Hi @elgiano

I hadn't forgotten about this :-) I'm starting to tidy things up for our CI. What I'm minded to do now is just have CMake take care of the whole python mess itself by making its own venv in the build folder and calling pip to install the python requirements. Would obviate the need for this PR for you?

@elgiano
Copy link
Author

elgiano commented Mar 31, 2025 via email

@tremblap
Copy link
Member

tremblap commented Apr 1, 2025

@weefuzzy would there be a bypass methods like the other dependencies, to use local env for people who are download-averse ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants