Error at Installation of PX4 development environment

Hello,
I was trying to setup the PX4 development environment by following this guide but when run the script ./ubuntu.sh i faced with a problem as you can see below.


Installing PX4 general dependencies
[sudo] password for burak: 
Hit:1 http://tr.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://tr.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:3 http://tr.archive.ubuntu.com/ubuntu noble-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu noble-security InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
astyle is already the newest version (3.1-3build1).
build-essential is already the newest version (12.10ubuntu1).
cmake is already the newest version (3.28.3-1build7).
cppcheck is already the newest version (2.13.0-2ubuntu3).
file is already the newest version (1:5.45-3build1).
g++ is already the newest version (4:13.2.0-7ubuntu1).
gcc is already the newest version (4:13.2.0-7ubuntu1).
gdb is already the newest version (15.0.50.20240403-0ubuntu1).
git is already the newest version (1:2.43.0-1ubuntu7.1).
lcov is already the newest version (2.0-4ubuntu2).
libfuse2t64 is already the newest version (2.9.9-8.1build1).
libxml2-dev is already the newest version (2.9.14+dfsg-1.3ubuntu3).
libxml2-utils is already the newest version (2.9.14+dfsg-1.3ubuntu3).
make is already the newest version (4.3-4.1build2).
ninja-build is already the newest version (1.11.1-2).
python3 is already the newest version (3.12.3-0ubuntu2).
python3-dev is already the newest version (3.12.3-0ubuntu2).
python3-pip is already the newest version (24.0+dfsg-1ubuntu1).
python3-setuptools is already the newest version (68.1.2-2ubuntu1.1).
python3-wheel is already the newest version (0.42.0-2).
rsync is already the newest version (3.2.7-1ubuntu1).
shellcheck is already the newest version (0.9.0-1).
unzip is already the newest version (6.0-28ubuntu4.1).
zip is already the newest version (3.0-13build1).
The following packages were automatically installed and are no longer required:
  acpi-support acpid aisleriot apturl apturl-common attr branding-ubuntu cheese cheese-common endeavour endeavour-common fonts-kacst fonts-kacst-one fonts-khmeros-core fonts-lao
  fonts-liberation2 fonts-lklug-sinhala fonts-sil-abyssinica fonts-sil-padauk fonts-thai-tlwg fonts-tibetan-machine fonts-tlwg-garuda fonts-tlwg-garuda-ttf fonts-tlwg-kinnari
  fonts-tlwg-kinnari-ttf fonts-tlwg-laksaman fonts-tlwg-laksaman-ttf fonts-tlwg-loma fonts-tlwg-loma-ttf fonts-tlwg-mono fonts-tlwg-mono-ttf fonts-tlwg-norasi fonts-tlwg-norasi-ttf
  fonts-tlwg-purisa fonts-tlwg-purisa-ttf fonts-tlwg-sawasdee fonts-tlwg-sawasdee-ttf fonts-tlwg-typewriter fonts-tlwg-typewriter-ttf fonts-tlwg-typist fonts-tlwg-typist-ttf
  fonts-tlwg-typo fonts-tlwg-typo-ttf fonts-tlwg-umpush fonts-tlwg-umpush-ttf fonts-tlwg-waree fonts-tlwg-waree-ttf g++-11 gcc-12-base gcc-12-base:i386 gedit gedit-common genisoimage
  gir1.2-amtk-5 gir1.2-gck-1 gir1.2-gcr-3 gir1.2-goa-1.0 gir1.2-gtksource-300 gir1.2-gtksource-4 gir1.2-gweather-3.0 gir1.2-javascriptcoregtk-4.0 gir1.2-json-1.0 gir1.2-nma-1.0
  gir1.2-snapd-1 gir1.2-soup-2.4 gir1.2-tepl-6 gir1.2-webkit2-4.0 gnome-bluetooth gnome-bluetooth-common gnome-mahjongg gnome-mines gnome-sudoku gnome-todo gnome-video-effects
  gstreamer1.0-clutter-3.0 guile-2.2-libs guile-3.0-libs irqbalance libabsl20210324 libappstream4 libatk1.0-data libatkmm-1.6-1v5 libblockdev-crypto2 libblockdev-fs2 libblockdev-loop2
  libblockdev-part-err2 libblockdev-part2 libblockdev-swap2 libblockdev-utils2 libblockdev2 libboost-filesystem1.74.0 libboost-iostreams1.74.0 libboost-locale1.74.0 libboost-regex1.74.0
  libboost-thread1.74.0 libbpf0 libbsd0:i386 libcairomm-1.0-1v5 libcamel-1.2-63 libcbor0.8 libcephfs2 libcheese-gtk25 libcheese8 libclutter-1.0-0 libclutter-1.0-common libclutter-gst-3.0-0
  libclutter-gtk-1.0-0 libcogl-common libcogl-pango20 libcogl-path20 libcogl20 libcolamd2 libcolord-gtk1t64 libcupsfilters1 libdazzle-1.0-0 libdazzle-common libdmapsharing-3.0-2
  libdns-export1110 libdrm2:i386 libebackend-1.2-10 libebook-1.2-20 libebook-contacts-1.2-3 libecal-2.0-1 libedata-book-1.2-26 libedata-cal-2.0-1 libedataserver-1.2-26
  libedataserverui-1.2-3 libffi8:i386 libflac8 libfontembed1 libfreerdp-client2-2t64 libfreerdp-server2-2t64 libfreerdp2-2t64 libgc1 libgcab-1.0-0 libgedit-amtk-5-0 libgedit-amtk-5-common
  libgedit-gtksourceview-300-0 libgedit-gtksourceview-300-common libgeocode-glib0 libglibmm-2.4-1t64 libgnome-bluetooth13t64 libgnome-games-support-1-3 libgnome-games-support-common
  libgnome-todo libgoa-backend-1.0-1 libgssdp-1.2-0 libgtkmm-3.0-1t64 libgtksourceview-4-0 libgtksourceview-4-common libgupnp-1.2-1 libgweather-3-16 libgweather-common libicu70
  libisc-export1105 libjavascriptcoregtk-4.0-18 libjs-highlight.js libjs-psl libldap-2.5-0 libllvm15t64 liblua5.3-0 libmessaging-menu0 libmozjs-91-0 libmpdec3 libnautilus-extension1a
  libnetplan0 libnfs13 libnsl-dev libnsl2 libnvidia-cfg1-550 libnvidia-common-550 libnvidia-compute-550:i386 libnvidia-decode-550 libnvidia-decode-550:i386 libnvidia-egl-wayland1
  libnvidia-egl-wayland1:i386 libnvidia-encode-550 libnvidia-encode-550:i386 libnvidia-extra-550 libnvidia-fbc1-550 libnvidia-fbc1-550:i386 libnvidia-gl-550 libnvidia-gl-550:i386
  liborcus-0.17-0 liborcus-parser-0.17-0 libpangomm-1.4-1v5 libparted-fs-resize0t64 libpcre3 libperl5.34 libplist3 libpoppler118 libprotobuf23 libpython3.10 libpython3.10-minimal
  libpython3.10-stdlib libqpdf28 libqqwing2v5 librados2 libraw20 librdmacm1t64 libreoffice-pdfimport librest-0.7-0 librygel-core-2.6-2 librygel-db-2.6-2 librygel-renderer-2.6-2
  librygel-server-2.6-2 libsigc++-2.0-0v5 libsmbios-c2 libsnapd-glib1 libsoup-gnome-2.4-1 libstdc++-11-dev libsuitesparseconfig5 libtepl-6-4 libtepl-common libtiff5 libtirpc-dev
  libunistring2 libunistring2:i386 liburing2 libvncserver1 libvpx7 libwayland-client0:i386 libwayland-server0:i386 libwebkit2gtk-4.0-37 libwinpr2-2t64 libwpe-1.0-1 libwpebackend-fdo-1.0-1
  libx11-6:i386 libxau6:i386 libxcb1:i386 libxdmcp6:i386 libxext6:i386 libxnvctrl0 linux-hwe-6.8-headers-6.8.0-45 linux-hwe-6.8-tools-6.8.0-45 nautilus-share node-abab node-ansistyles
  node-asap node-asynckit node-clean-yaml-object node-combined-stream node-cssom node-cssstyle node-delayed-stream node-domelementtype node-domhandler node-entities node-form-data
  node-jsdom node-parse5 node-psl node-querystringify node-requires-port node-stealthy-require node-tmatch node-tough-cookie node-universalify node-url-parse node-webidl-conversions
  node-whatwg-fetch nvidia-compute-utils-550 nvidia-kernel-source-550 nvidia-prime nvidia-settings nvidia-utils-550 perl-modules-5.34 python3-future python3-gi-cairo python3-lockfile
  python3-macaroonbakery python3-protobuf python3-pyatspi python3-pymacaroons python3-rfc3339 python3.10 python3.10-minimal samba samba-ad-provision samba-vfs-modules
  screen-resolution-extra tdb-tools ubuntu-advantage-tools xserver-xorg-video-nvidia-550
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.

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.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

(I’ve tried creating a virtual environment, still no progress)
It seems like i am missing a crucial step but i cant find it. Can you guide me ?
Thank you

I have solved the issue by following this commands
creating new virtual environments and updating pip everytime

sudo apt update
sudo apt upgrade
sudo apt install python3-pip
python3 -m venv myenv
source myenv/bin/activate
pip install --upgrade pip
pip install -U -r requirements.txt
1 Like

Had similar issue on MacOS install - solved same way. Think the installation instructions need updating.