Skip to content

editable install cannot find pybind built .so #971

Closed
@HernandoR

Description

@HernandoR

error

after pip install -e .
import odometry_py gives
ModuleNotFoundError: No module named 'odometry_py'

expected behaviour

import odometry_py as opy

details

I have such a project that uses pybind11 build cpp codes into a .so file then been called from a python script as follows:

try:
    sys.path.append(os.path.split(Path(__file__).resolve())[0] + "/../build")
    import odometry_py as opy

i'm recently migrating the project to vcpkg and uv managed environment. therefore with following pyproject.toml

[build-system]
requires = ["scikit-build-core>=0.10", "pybind11", "jinja2"]
build-backend = "scikit_build_core.build"

[project]
name = "odometry_py"
version = "0.0.1"
description = "A minimal example package (with pybind11)"
readme = "README.md"
requires-python = ">=3.9, <3.11"
classifiers = [
    "Development Status :: 4 - Beta",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
]
dependencies = [
    "scikit-learn>=1.6.1",
    "scipy>=1.13.1",
]

[tool.scikit-build]
wheel.expand-macos-universal-tags = true
minimum-version = "build-system.requires"
build-dir = "build/{wheel_tag}"
[tool.scikit-build.cmake]
build-type = "Release"
args = ["-GNinja"]
[tool.scikit-build.cmake.define]
CMAKE_CXX_STANDARD = "17"
CMAKE_CXX_FLAGS = "-Wno-deprecated-declarations"
CMAKE_EXPORT_COMPILE_COMMANDS = "ON"
CMAKE_TOOLCHAIN_FILE = "/home/lz/vcpkg/scripts/buildsystems/vcpkg.cmake"
# VCPKG_HOST_TRIPLET = "x64-linux"
# VCPKG_TARGET_TRIPLET = "x64-linux-static"

both uv build and cmake build can build the lib:

build/cp310-cp310-linux_x86_64/odometry_py.cpython-310-x86_64-linux-gnu.so
build/odometry_py.cpython-310-x86_64-linux-gnu.so

uv pip install -e . also build the file and crate corresponding dir in venv

.venv/lib/python3.10/site-packages/_odometry_py_editable.pth
.venv/lib/python3.10/site-packages/_odometry_py_editable.py
.venv/lib/python3.10/site-packages/odometry_py-0.0.1.dist-info/

but in python, import odometry_py as opy throws ModuleNotFoundError: No module named 'odometry_py'

request

if anyone can have a look on what did i missed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions