Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pawsaw opened this issue Feb 17, 2024 · 5 comments

Comments

@pawsaw
Copy link

pawsaw commented Feb 17, 2024

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 pawsaw changed the title Installation with Cmake: Doesn't build with python3.12 or higher: ModuleNotFoundError: No module named 'imp' Build with Cmake: Doesn't build with python3.12 or higher: ModuleNotFoundError: No module named 'imp' Feb 17, 2024
@julianoes
Copy link
Collaborator

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

@leoplo
Copy link

leoplo commented Mar 27, 2024

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

@julianoes
Copy link
Collaborator

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

@leoplo
Copy link

leoplo commented Mar 28, 2024

On my side at least it solved the problem.

@julianoes
Copy link
Collaborator

Nice, ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants