-
Notifications
You must be signed in to change notification settings - Fork 341
[CMake] Allow Python discovery from virtual environment #8520
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this PR at all.
First, I compile CIRCT in a venv all the time and it picks up the Python executable just fine. (Unless I'm doing something wrong and just not noticing.)
Secondly, there is no CMakeUserPresets.json file in this PR.
Third, I don't understand how the changes to CMakeLists.txt would make any difference. You're setting a variable after find_package is called, so (if my understanding of CMake is correct) makes no difference to finding Python.
Weird, it picks the system environment for me:
the system env is fine, just would not want to clutter it with packages. If it worked for you maybe the failure wouldn't be noticed if
yeah I use preset files instead of typing commands, it's pretty standard practice even in llvm: https://github.com/llvm/llvm-project/blob/main/.gitignore#L27. That's why I'm proposing to gitignore it in the circt repo as well.
Tried that before, for some reason the hint isn't taken into consideration when the variable is set before the I get the right environment discovered with this variable added after the
|
RE CMakeUserPresets.json: in my haste to review this, I didn't notice that it was in .gitignore. This change is perfectly fine and desirable. |
What's your PATH variable look like? Everything I'm reading about Python3_FIND_VIRTUALENV says it needs to be set before |
I share the same view, I will dig deeper into it and circle back. Thanks ! |
Currently the
find_package(Python3)
call binds with the system Python interpreter which does not necessarily havepsutil
needed to run integration tests (using LLVM LIT)Installing
psutil
in the system Python environment is one workaround but absolutely not recommended. The hint added to CMake in this PR allows (the possibility of) discovery of Python when the virtual environment (viavirtualenv
orconda
) is activated.