diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index fe22ffd2f70b..d5433fbc1e3a 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -47,7 +47,7 @@ pycamera_sources += custom_target('py_gen_formats',
 
 pycamera_deps = [
     libcamera_private,
-    py3_dep,
+    py3.dependency(),
     pybind11_dep,
 ]
 
@@ -62,7 +62,7 @@ if meson.is_cross_build()
     # module. There's work in progress to fix this, based on PEP 739
     # (https://github.com/mesonbuild/meson/pull/14657). While waiting for this
     # to become available, work around the issue by using shared_module().
-    destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'
+    destdir = get_option('libdir') / ('python' + py3.language_version()) / 'site-packages' / 'libcamera'
 
     pycamera = shared_module('_libcamera',
                              pycamera_sources,
diff --git a/src/py/meson.build b/src/py/meson.build
index 24102f83d2e1..88ad8b7ec26e 100644
--- a/src/py/meson.build
+++ b/src/py/meson.build
@@ -1,20 +1,10 @@
 # SPDX-License-Identifier: CC0-1.0
 
-if meson.is_cross_build()
-    py3_dep = dependency('python3', required : get_option('pycamera'))
-else
-    py3 = import('python').find_installation('python3', required : get_option('pycamera'))
-    if not py3.found()
-        pycamera_enabled = false
-        subdir_done()
-    endif
-
-    py3_dep = py3.dependency(required : get_option('pycamera'))
-endif
-
+py_mod = import('python')
+py3 = py_mod.find_installation('python3', required : get_option('pycamera'))
 pybind11_dep = dependency('pybind11', required : get_option('pycamera'))
 
-pycamera_enabled = py3_dep.found() and pybind11_dep.found()
+pycamera_enabled = py3.found() and pybind11_dep.found()
 if not pycamera_enabled
     subdir_done()
 endif
