Issue Installing `lap==0.4.0` on Python 3.11 — "Failed building wheel" Error

I am encountering an issue when trying to install the lap==0.4.0 package in a Python 3.11 virtual environment. The installation fails with the following error:

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for lap
Running setup.py clean for lap
Failed to build lap
ERROR: Failed to build installable wheels for some pyproject.toml based projects (lap)

What I’ve Tried:

  1. Installing Visual Studio C++ Build Tools:

    • I was suggested to install Visual Studio C++ which might resolve the issue. So, I installed the Visual Studio C++ Build Tools with all the required components for building C++ extensions (MSVC, Windows SDK, CMake tools, etc.). However, the error persists even after doing this.
  2. Using the Correct Command Prompt:

    • I used the “x86_x64 Cross Tools Command Prompt for VS 2022” to ensure the correct environment variables are set.
    • I activated my virtual environment and attempted to install the lap package again but still faced the same error.

Environment Details:

  • Python Version: 3.11 (installed in a virtual environment)
  • Package to Install: lap==0.4.0
  • Operating System: Windows 11
  • Visual Studio Version: Visual Studio 2022 with C++ Build Tools installed
  • Virtual Environment Path: D:\PyCharm\PyCharm_files\OBJECT DETECTION\venv

Question:

  • Could this issue be related to compatibility between the lap package and Python 3.11?
  • Are there any known solutions or workarounds to resolve this installation error?

If anyone has encountered a similar issue or knows of a specific method to successfully build the package from the source, I would greatly appreciate your guidance. Thank you.

This is probably caused by a missing requirement in the build environment for lap. You should check their website for Windows installation instructions.

The trouble with pip doing the build is that all the details of failure are hidden from you.
What I do is get the source code of the module and build it outside of pip.
Suggest you do the same then you can see the errors and have something to fix.