Error setting up UAV Toolbox support for PX4 Autopilots

7 次查看(过去 30 天)
Hi everyone. When setting up UAV Toolbox support for PX4 Autopilots, I created succesfully the wsl environment and cloned the git repository with 1.14.0 version of PX4 source code. The problem arises when trying to run the next part, which is the 'bash ./ubuntu.sh'. I reach to an error that says the following. Does anyone know what may be happening and how should I fix this.
Installing PX4 Python3 dependencies
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.

回答(1 个)

Umar
Umar 2025-6-22

Hi @Jon,

After going through your comments and documentation provided at the link below

Download PX4 Source Code in Ubuntu 20.04 and 22.04

, it seems that the error you are experiencing is due to the Python environment being managed externally, which restricts the installation of packages directly using pip. To resolve this issue, you have a couple of options:

Use a Virtual Environment: Create a virtual environment to manage your Python packages independently. You can do this by running the following commands in your terminal:

   python3 -m venv myenv
   source myenv/bin/activate

After activating the virtual environment, you can install the required packages using pip without encountering the external management error.

Install System-Wide Packages: If you prefer to install packages system-wide, you can use the apt package manager. For example, to install a specific Python package, you can run:

   sudo apt install python3-xyz

Replace xyz with the name of the package you need.

Using pipx: If you want to install non-Debian packaged applications, consider using pipx, which manages a virtual environment for you. First, ensure pipx is installed, then you can install your application like this:

   pipx install xyz

By following one of these methods, you should be able to proceed with the installation of the PX4 Autopilot Firmware successfully.

Hope this helps.

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by