diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index eb8845388692..cf2e9395de38 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -1,8 +1,9 @@
 # SPDX-License-Identifier: CC0-1.0
 
-py3_dep = dependency('python3', required : get_option('pycamera'))
+pymod = import('python')
+py3 = pymod.find_installation('python3', required : get_option('pycamera'))
 
-if not py3_dep.found()
+if not py3.found()
     pycamera_enabled = false
     subdir_done()
 endif
@@ -60,7 +61,7 @@ pycamera_sources += custom_target('py_gen_formats',
 
 pycamera_deps = [
     libcamera_public,
-    py3_dep,
+    py3.dependency(),
     pybind11_dep,
 ]
 
@@ -71,7 +72,7 @@ pycamera_args = [
     '-DLIBCAMERA_BASE_PRIVATE',
 ]
 
-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,
