MAVSDK icon indicating copy to clipboard operation
MAVSDK copied to clipboard

Build with Cmake: Doesn't build with python3.12 or higher: ModuleNotFoundError: No module named 'imp'

Open pawsaw opened this issue 1 year ago • 5 comments

Problem description

In my projects CMakeLists.txt:

include(FetchContent)
FetchContent_Declare(
  mavsdk
  GIT_REPOSITORY https://github.com/mavlink/MAVSDK.git
  GIT_TAG        v2.2.0
  GIT_SUBMODULES_RECURSE TRUE
)
FetchContent_MakeAvailable(mavsdk)

If cmake picks Python 3.12 (or higher) the build fails: [cmake] ModuleNotFoundError: No module named 'imp'

imp has been removed in Python 3.12

Expected behavior

Works with Python >= 3.12

Side note:

I tried with

unset(Python3_EXECUTABLE)
find_package (Python 3.10 EXACT REQUIRED COMPONENTS Interpreter Development)

in cmake. However, this seems not to apply to dependencies as fetched by FetchContent_*

Idea

  1. Maybe adding
unset(Python3_EXECUTABLE)
find_package (Python 3.10 EXACT REQUIRED COMPONENTS Interpreter Development)

to the MavSDK CMakeLists.txt fixes the issue?

  1. Get rid of imp

pawsaw avatar Feb 17 '24 11:02 pawsaw

We should probably do 2. Do you know where it's required?

julianoes avatar Feb 19 '24 22:02 julianoes

This was happening in future egg but was corrected in 0.18.4 release: https://github.com/PythonCharmers/python-future/pull/632 (well 1.0.0 release because there is no 0.18.4 version on PyPI).

leoplo avatar Mar 27 '24 12:03 leoplo

Ok, so potentially with latest future it should be ok again?

julianoes avatar Mar 27 '24 18:03 julianoes

On my side at least it solved the problem.

leoplo avatar Mar 28 '24 09:03 leoplo

Nice, ok!

julianoes avatar Mar 28 '24 20:03 julianoes