ncvis icon indicating copy to clipboard operation
ncvis copied to clipboard

Pip Install not working (both on Mac and Windows)

Open SeanPedersen opened this issue 10 months ago • 5 comments

As the title says pip install ncvis is not working.

I am using a Python 3.11 env with following packages installed:

numpy==1.26.1
Cython==3.0.2
pybind11==2.13.6

Still getting this error: (ncvis) LeMacMini@Mac-mini-von-The ncvis % pixi add --pypi ncvis

Error:   × failed to solve the pypi requirements of 'default' 'osx-arm64'
  ├─▶ failed to resolve pypi dependencies
  ├─▶ Failed to download and build `ncvis==1.5.13`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stdout]
      numpy/cython/pybind11 are not installed:
      >> pip install numpy cython pybind11

      hint: This usually indicates a problem with the package or the build environment.

Manually importing the packages in Python is working, so no clue what is going on. Any idea?

SeanPedersen avatar Mar 10 '25 22:03 SeanPedersen

I come from here

You need to add these dependencies in the build-system.requires section instead of installing them using pip install.

WSH032 avatar Mar 12 '25 09:03 WSH032

Ok thx, I did like so:

./src-tauri/pyproject.toml

[project]
name = "digger-solo"  
version = "0.1.0"
description = "Digger Solo - Search and Explore"
requires-python = ">=3.11"
dependencies = [
     ....
    "ncvis"
]

[project.entry-points.pytauri]
ext_mod = "digger_solo.ext_mod"

[build-system]
requires = ["numpy==1.26.1", "Cython==3.0.2", "pybind11==2.13.6", "setuptools>=61", "setuptools-rust==1.*", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages]
find = { where = ["python"] }

But still no luck:

LeMacMini@Mac-mini-von-The digger-solo % uv pip install \
    --exact \
    --python="./src-tauri/pyembed/python/bin/python3" \
    --reinstall-package=digger-solo \
    ./src-tauri
Using Python 3.11.11 environment at: src-tauri/pyembed/python
  × Failed to build `ncvis==1.5.13`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stdout]
      numpy/cython/pybind11 are not installed:
      >> pip install numpy cython pybind11

      hint: This usually indicates a problem with the package or the build environment.
  help: `ncvis` (v1.5.13) was included because `digger-solo` (v0.1.0) depends on `ncvis`

SeanPedersen avatar Mar 12 '25 09:03 SeanPedersen

Ah, sorry, I made a mistake. This is an issue that only the author can fix.

These dependencies (numpy etc.) should be added to ncvis's build-system.requires, not downstream.


Here is the solution:

uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    "numpy==1.26.1", "Cython==3.0.2", "pybind11==2.13.6" \
    ./src-tauri

# NOTE: no `--exact`
uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    --reinstall-package=digger-solo \
    --no-build-isolation-package=ncvis \
    ./src-tauri

WSH032 avatar Mar 12 '25 10:03 WSH032

I did not include ncvis as dependency in pyproject.toml... if I do:

LeMacMini@Mac-mini-von-The digger-solo % uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    "numpy==1.26.1" "Cython==3.0.2" "pybind11==2.13.6" \
    ./src-tauri
Using Python 3.11.11 environment at: src-tauri/pyembed/python
  × Failed to build `ncvis==1.5.13`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stdout]
      numpy/cython/pybind11 are not installed:
      >> pip install numpy cython pybind11

      hint: This usually indicates a problem with the package or the build environment.
  help: `ncvis` (v1.5.13) was included because `digger-solo` (v0.1.0) depends on `ncvis`

So I removed ncvis from pyproject.toml.

I ran:

LeMacMini@Mac-mini-von-The digger-solo % uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    "numpy==1.26.1" "Cython==3.0.2" "pybind11==2.13.6" \
    ./src-tauri

and:

LeMacMini@Mac-mini-von-The digger-solo % uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    --reinstall-package=digger-solo \
    --no-build-isolation-package=ncvis \
    ./src-tauri

all worked fine, then I built the package: ... tauri build --config="src-tauri/tauri.bundle.json" -- --profile bundle-release But when I start the binary: ModuleNotFoundError: No module named 'ncvis'

SeanPedersen avatar Mar 12 '25 10:03 SeanPedersen

Ah, another mistake i made. 😅

uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    "numpy==1.26.1", "Cython==3.0.2", "pybind11==2.13.6"

uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    --no-build-isolation-package=ncvis \
    ncvis

uv pip install \
    --python="./src-tauri/pyembed/python/bin/python3" \
    --exact \
    --reinstall-package=digger-solo \
    ./src-tauri

So I removed ncvis from pyproject.toml.

You don't need to do that.

WSH032 avatar Mar 12 '25 11:03 WSH032