-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
[Bug] Recent changes to homebrew cmake and python defaults break dev environment #23073
Comments
Thanks @saosebastiao, would you be able to open a pull request fixing this in |
@dagar I'd love to take a stab at it. I'll let you know up front that I don't know anything about the codebase, dev practices, MR guidelines, etc. Is there a guide for submitting a first MR to the project? Any example MRs from a project fork (assuming that's how it is done here)? Also, I don't know a lot about CMake and my own tinkering that led to this bug report leads me to believe we won't be able to do anything with python virtual environments unless we change the CMake build to get rid of the deprecated I can of course try to do that, but I might be in over my head with CMake, especially on a project that I'm unfamiliar with.
|
This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
In order to transition to a virtualenv environment, we do need to transition to the newer cmake FindPython3 system. I have a partially working branch in progress here: This seems to work for
There is a lot of noise that happens after this error, then it reports the same thing for several other nuttx files.
|
I noticed via this issue that nuttx is an older version and is using a custom px4 build system fork to use cmake which nuttx didn't have at the time. Could an upgrade here possibly help? |
Interesting. I just freshly installed the toolchain from homebrew on my Macbook Air M1 and successfully built SITL and NuttX targets. For the python modules I used the Let's follow up on your #23138 to get the virtual environment rolling. I didn't look into details yet and wasn't aware that it needs a different CMake plugin. But I expected there to be some work since the build environment needs to somehow load the virtual environment. |
Hi @MaEtUgR thanks for the followup. Unless I'm understanding incorrectly, the arch script doesn't use virtual environments. The --break-system-packages flag bypasses the virtual environment and installs packages in the system environment, which is essentially doing the the same thing as the previous user-level environment installation of packages. If it is using virtual environments I would expect to see the creation of a virtual environment with one of the following:
and then a subsequent call of In my merge request, I modified the scripts to create the virtual environment and activate it, install the packages, and then I deactivate it within the script. I chose to deactivate within the script because there are weird issues with activating a virtual environment within a script that make it hard to deactivate outside of that script. The new FindPython3 CMake module has the capability of detecting a python virtual environment, but it must already be activated for it to be identified. From my understanding, the activation of the virtual environment can be emulated by setting the VIRTUAL_ENV environment variable, so I put in some code to do that so there isn't a need for manual activation step before running. I'm also gonna look into whether there is more logic behind the activation script which might need to be replicated. |
Describe the bug
Homebrew now defaults to installing Python 3.12, which breaks the PX4 MacOS dev environment.
Homebrew now follows PEP-668 regarding virtual environments. This means that it is expected to use virtual environments like
venv
orpipx
in order to manage dependencies. PX4 should adopt these standards regardless, as there are many reasons why using global or user level dependencies instead of project level dependencies is a bad idea.And to clarify, this means that the steps to manually install dependencies in the official documentation are broken, as well as the
Tools/setup/macos.sh
script.To Reproduce
using homebrew:
Expected behavior
Build should succeed
Screenshot / Media
On
python3 -m pip install --user pyserial empty toml numpy pandas jinja2 pyyaml pyros-genmsg packaging kconfiglib future
the following error message is give:Flight Log
N/A
Software Version
main
Flight controller
sitl
Vehicle type
None
How are the different components wired up (including port information)
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: