diff --git a/cmake/multipython/PyDependences.cmake b/cmake/multipython/PyDependences.cmake
index e73f15e587f4a618057c36eab548701d683bc0e4..c65920c3f434312b49d8b2b65b87a1fbafe7038d 100644
--- a/cmake/multipython/PyDependences.cmake
+++ b/cmake/multipython/PyDependences.cmake
@@ -21,12 +21,15 @@ message(STATUS "Python package destination directory: ${destination_pypackage}")
 
 # check presence of some Python modules
 message(STATUS "Searching required Python packages...")
-set(py_packages "pip;numpy;matplotlib")
+set(py_packages "pip;numpy")
+if (BA_TESTS)
+    # Python packages needed for tests
+    list(APPEND py_packages "matplotlib")
+endif()
 if(LINUX AND BA_PY_PACKAGE)
     # on Linux, `auditwheel` is needed to produce 'manylinux' wheels repair (PEP 599)
     list(APPEND py_packages "auditwheel")
 endif()
-
 foreach(pkg ${py_packages})
     message(STATUS "Python package ${pkg}")
     execute_process(