Skip to content
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

Fix macos homebrew python env #23138

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

saosebastiao
Copy link

@saosebastiao saosebastiao commented May 15, 2024

This is a work in progress, intending to solve a problem with newer python requirements which don't allow user or system level dependencies.

I'm having multiple issues with nuttx that I'm not sure how to solve yet.

#23073

Solved Problem

This correctly implements a Python Virtual Environment which allows for local installation of all python dependencies. It updates CMakeLists.txt references to use the FindPython3 cmake module, which can correctly identify a virtual environment if it is sourced. In the root level CMakeLists.txt, it will mimic activation of the virtual environment via setting the $VIRTUAL_ENV environment variable.

Unsolved Problems

Something in this merge request seems to be conflicting with the customized CMakeFiles.txt for our NuttX fork, and will result in build errors for any target built on nuttx. It seems as though certain libraries are not being built, and it's not clear to me what about the python virtual environment is causing this.

Additionally, the libuavcan submodule is using the old FindPythonInterp module which will not recognize virtual environments. When I looked at the git repo for libuavcan, it says that it is deprecated and should be replaced with https://github.com/dronecan/libcanard, so it probably means they won't be accepting any pull requests to fix that. I'm not sure what problems might arise from this, as I don't think I can even get to the point in the build process where that might be tested.

Some miscellaneous notes

I chose to use a hidden directory (.venv/) for the virtual environment, as this directory is often just extra noise in filesystem explorer apps. If necessary, we can use the more conventional and unhidden venv/.

If testing out locally, please use the Tools/setup/ubuntu.sh or Tools/setup/macos.sh scripts, as that is what creates the virtual environment.

@saosebastiao saosebastiao force-pushed the fix_macos_homebrew_python_env branch from b32e912 to fbf0fe9 Compare May 22, 2024 19:26
@saosebastiao saosebastiao marked this pull request as draft May 22, 2024 20:50
@saosebastiao
Copy link
Author

saosebastiao commented May 28, 2024

@dagar @bkueng any chance either of you could help me out with this one (see Unsolved Problems above). This is my first PR to PX4 and I'm really not sure what to do about the above issues.

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.

None yet

1 participant