From 85aad3d7ee3ae0b3573f99bd9879ed7259fe0043 Mon Sep 17 00:00:00 2001 From: Demian Vladi Date: Mon, 16 Nov 2026 14:27:57 -0800 Subject: [PATCH 1/2] docs(installation): reduce the installation page to plain install instructions The installation page now holds only what a user needs: the pip, conda and CUDA install commands, the supported platforms in one short list, the Docker image, and the installation check. It no longer lists which older release pip falls back to on each platform, nor the Docker base image of each release, and its versions follow the current release. The source build (dependencies, prerequisite scripts, CMake options, running the tests) moves to its own page, building.rst, under the developer guide. Installation problems that users can still hit (no matching wheel, no conda build on Apple Silicon and Linux aarch64, the Debug-built conda-forge Windows package, missing CUDA libraries) move to a new Installing section of the troubleshooting page. supported_formats, troubleshooting and gpu no longer describe the Windows wheels without OME-Zarr or the missing Windows CUDA wheels: the current release ships both. --- docs/source/building.rst | 250 +++++++++++++++++ docs/source/developer_guide.rst | 1 + docs/source/gpu.rst | 11 +- docs/source/installation.rst | 436 ++++-------------------------- docs/source/supported_formats.rst | 7 +- docs/source/troubleshooting.rst | 37 ++- 6 files changed, 344 insertions(+), 398 deletions(-) create mode 100644 docs/source/building.rst diff --git a/docs/source/building.rst b/docs/source/building.rst new file mode 100644 index 000000000..ad031eba6 --- /dev/null +++ b/docs/source/building.rst @@ -0,0 +1,250 @@ +.. _building: + +Building from source +==================== + +This page builds the Python package and the command-line program from the repository. To install a +published package instead, see :doc:`installation`. + +Build from a git clone of the repository. The package version comes from the git tags, so a +GitHub source archive of the development head or a copy without the ``.git`` directory stops with +``setuptools-scm was unable to detect version``: + +.. code-block:: bash + + git clone https://github.com/PolusAI/nyxus.git + cd nyxus + +The ``ci-utils`` and ``tests`` paths on this page are relative to this directory. + +Requirements +------------ + +* CMake 3.20 or newer. +* A C++20 compiler. On Windows, use MSVC: the conda-forge Windows libraries are built with MSVC + and do not link with GCC. +* libtiff, which is always required. +* For each optional part, its libraries: + +.. list-table:: + :header-rows: 1 + :widths: 25 75 + + * - Part + - Libraries + * - OME-Zarr input + - z5 (headers), Blosc, zlib, nlohmann_json; zstd for Zstandard-compressed Zarr version 3 + arrays, used when both its library and header are found + * - DICOM input + - DCMTK and zlib; fmjpeg2k for JPEG 2000 pixel data + * - Arrow IPC and Parquet output + - Apache Arrow and Parquet + * - Python package + - pybind11 + * - GPU + - a CUDA toolkit whose ``nvcc`` supports your host compiler + +Getting the dependencies +------------------------ + +.. tab-set:: + + .. tab-item:: conda (recommended) + + The files in ``ci-utils/envs/`` list the conda-forge packages: + + * ``conda_cpp.txt``: the C++ libraries, CMake and pybind11; + * ``conda_cpp_mac.txt``: the same without DCMTK and fmjpeg2koj, for Apple Silicon Macs and + Linux aarch64; + * ``conda_py.txt``: numpy, pandas, pyarrow and pip; + * ``conda_linux_compiler.txt`` and ``conda_linux_gpu.txt``: a Linux compiler and the CUDA 12.6 + compiler and libraries. + + .. code-block:: bash + + conda create -n nyxus_build -c conda-forge python=3.12 \ + --file ci-utils/envs/conda_cpp.txt --file ci-utils/envs/conda_py.txt + conda activate nyxus_build + + On Apple Silicon Macs and on Linux aarch64, use ``conda_cpp_mac.txt`` in place of + ``conda_cpp.txt``: the other file does not solve there, and this one has no DICOM libraries. + On Linux, also add ``--file ci-utils/envs/conda_linux_compiler.txt`` so that the compiler + matches the conda libraries, as the CI builds do. + + Point CMake at the environment with the ``NYXUS_DEP_DIR`` environment variable: + ``$CONDA_PREFIX`` on Linux and macOS, ``%CONDA_PREFIX%\Library`` on Windows. When it is set, + CMake uses it as ``CMAKE_PREFIX_PATH`` and as a library directory. + + .. tab-item:: Linux and macOS scripts + + ``ci-utils/install_prereq_linux.sh`` downloads and builds the dependencies into + ``./local_install``: + + .. code-block:: bash + + bash ci-utils/install_prereq_linux.sh --build_arrow yes + export NYXUS_DEP_DIR=$PWD/local_install + + Its options are ``--min_build yes`` (only pybind11, libtiff and their codecs, no OME-Zarr, + DICOM or Boost), ``--build_arrow yes`` (also Arrow and Parquet; off by default) and + ``--install_dir ``, a path relative to the current directory (the script prefixes it + with ``../../`` for each dependency build). The script needs ``curl``, ``unzip``, ``bzip2``, + ``make``, CMake and a C++ compiler. It does not stop when a step fails, so check its output + for errors before building. On macOS, run it with bash 4 or newer (for example Homebrew's + ``bash``): the system ``/bin/bash`` 3.2 reports ``bad substitution`` at the ``--min_build`` + check, ignores the option and builds every dependency. + + .. tab-item:: Windows script + + ``ci-utils\install_prereq_win.bat`` downloads and builds the dependencies, including Arrow, + into ``.\local_install``. Run it from a Visual Studio developer command prompt: + + .. code-block:: bat + + set PATH=%PATH%;C:\Program Files\Git\usr\bin + ci-utils\install_prereq_win.bat + set NYXUS_DEP_DIR=%cd%\local_install + set PATH=%NYXUS_DEP_DIR%\bin;%PATH% + + ``--min_build yes`` skips OME-Zarr and DICOM. The first line adds Git for Windows' + ``usr\bin``, for the ``unzip`` the script needs, at the end of ``PATH``. Placed earlier, its + ``link.exe`` and ``tar.exe`` hide the MSVC linker and the Windows ``tar`` that the script + uses for ``.zip`` files. The script does not stop when a step fails, so check its output for + errors before building. + + The dependency DLLs in ``local_install\bin`` must be on ``PATH`` when you run the + command-line program. Python does not search ``PATH`` for an extension module's DLLs, so in + Python call ``os.add_dll_directory(r"\local_install\bin")`` before + ``import nyxus``. + +Building the Python package +--------------------------- + +``pip`` builds the package through ``setup.py``, which configures CMake with ``-DALLEXTRAS=ON`` +(see `CMake options`_). With ``NYXUS_DEP_DIR`` set as above, run from the source tree: + +.. code-block:: bash + + python -m pip install . -vv + +Pass more CMake options in the ``CMAKE_ARGS`` environment variable, separated by spaces. For +example, a GPU build, which needs a CUDA toolkit: ``CMAKE_ARGS="-DUSEGPU=ON" python -m pip install +. -vv`` in bash, or ``set CMAKE_ARGS=-DUSEGPU=ON`` before the ``pip`` command in a Windows command +prompt. + +The package then includes every optional part whose libraries CMake finds. A missing optional +dependency switches its part off and the build continues, except the GPU part: without a CUDA +toolkit, configuring stops. Not every such case prints a warning (a missing DCMTK drops DICOM with +only status lines), so check the dependency summary at the end of the configure output, which +lists which optional parts were requested and which were found: + +.. code-block:: text + + -- Nyxus Dependencies Summary + -- ================================ + -- Support | Requested | Found + -- ================================ + -- Z5 | ON | ON + -- Arrow | ON | ON + -- Dicom | ON | ON + -- CUDA | OFF | OFF + +libtiff and pybind11 are required: configuring stops without them. A build without OME-Zarr or +DICOM support refuses such files with ``This version of Nyxus was not build with OmeZarr support`` +or ``This version of Nyxus was not build with DICOM support``. + +Building the command-line program +--------------------------------- + +.. code-block:: bash + + cmake -S . -B build-cli -DBUILD_CLI=ON -DALLEXTRAS=ON -DCMAKE_PREFIX_PATH=$NYXUS_DEP_DIR + cmake --build build-cli --config Release --parallel 4 + +The executable is ``build-cli/nyxus`` (``build-cli\Release\nyxus.exe`` with a Visual Studio +generator). Use a directory other than ``build``, which ``pip`` uses for the Python package. + +CMake options +------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 12 68 + + * - Option + - Default + - Effect + * - ``BUILD_CLI`` + - not set (off) + - Builds the ``nyxus`` command-line executable. + * - ``BUILD_LIB`` + - not set (off) + - Builds the Python extension module ``backend``. ``setup.py`` turns it on. + * - ``NOEXTRAS`` + - ``ON`` + - Turns ``USE_Z5``, ``USE_DCMTK`` and ``USE_ARROW`` off: the build reads TIFF, OME-TIFF and + uncompressed NIfTI only. Because it is on by default, a ``USE_*`` option has no effect + unless you also pass ``-DNOEXTRAS=OFF``. + * - ``ALLEXTRAS`` + - ``OFF`` + - Turns ``USE_Z5``, ``USE_DCMTK`` and ``USE_ARROW`` on. It takes precedence over + ``NOEXTRAS``. ``setup.py`` always passes it. + * - ``REQUIRE_ALLEXTRAS`` + - ``OFF`` + - Stops the configure with an error when ``USE_Z5``, ``USE_DCMTK`` or ``USE_ARROW`` is off. + Without it, a part whose libraries are missing is dropped with a warning. The ``nyxus`` + wheels on PyPI are built with it; the ``nyxus-cuda11x`` and ``nyxus-cuda12x`` wheels are not. + * - ``USE_Z5`` + - ``OFF`` + - OME-Zarr input. Also enables compressed NIfTI (``.nii.gz``), which needs the zlib that this + option finds. Dropped with a warning when zlib, Blosc, nlohmann_json or the z5 headers + are missing. + * - ``USE_DCMTK`` + - ``OFF`` + - DICOM input. Dropped when DCMTK or zlib is missing. JPEG 2000 pixel data is read when + fmjpeg2k is also found. + * - ``USE_ARROW`` + - ``OFF`` + - Arrow IPC and Parquet output (``--outputType=arrowipc`` or ``parquet``). Dropped with a + warning when Arrow or Parquet is missing. + * - ``USE_STATIC_ARROW`` + - ``OFF`` + - macOS only. Links Arrow and Parquet statically into the Python module and exports only its + init symbol, so the module's Arrow stays private when pyarrow loads its own Arrow in the + same process. Configuring stops when the Arrow installation has no static libraries. The + macOS wheels are built with it on. Elsewhere it is ignored with a warning. + * - ``USEGPU`` + - ``OFF`` + - Builds the CUDA kernels and the ``--useGpu`` and ``--gpuDeviceID`` options. Configuring + stops with ``USEGPU flag was set to ON but no CUDA compiler was found`` when no CUDA + compiler or toolkit is found. The GPU architectures compiled for follow the CUDA major + version, from 10 to 13. + * - ``RUN_GTEST`` + - ``OFF`` + - Downloads GoogleTest and builds the C++ test executable ``runAllTests``. + * - ``RUN_BENCHMARKS`` + - ``OFF`` + - Builds the ``bench_convex_hull`` micro-benchmark (see ``benchmarks/README.md``). + * - ``CMAKE_BUILD_TYPE`` + - ``Release`` (``Debug`` with MSVC) + - Single-configuration generators build ``Release`` unless told otherwise. With MSVC, CMake + itself presets ``Debug``, so pass ``-DCMAKE_BUILD_TYPE=Release`` when you use Ninja or + NMake. This is a known defect (`#524 `__). + +The C++ standard is C++20 and is required (``CMAKE_CXX_STANDARD 20``). On MSVC the build adds +``/permissive- /EHsc /bigobj /Zc:__cplusplus``. + +Running the tests +----------------- + +After installing the Python package, run the Python test suite from the source tree. Use a +checkout of the same version as the installed package (``git checkout v0.12.1`` for 0.12.1): the +tests on the development head cover features that a released package may not have. + +.. code-block:: bash + + python -m pip install pytest bfio imagecodecs pyarrow + python -m pytest tests/python/ + +With ``-DRUN_GTEST=ON``, the build also produces ``runAllTests``, the C++ test executable. It +does not need ``BUILD_CLI`` or ``BUILD_LIB``. diff --git a/docs/source/developer_guide.rst b/docs/source/developer_guide.rst index 4a5f81f00..5ff6a3441 100644 --- a/docs/source/developer_guide.rst +++ b/docs/source/developer_guide.rst @@ -6,4 +6,5 @@ Working on the Nyxus code. .. toctree:: :maxdepth: 2 + building devguide diff --git a/docs/source/gpu.rst b/docs/source/gpu.rst index 3f627f935..07cd8e97e 100644 --- a/docs/source/gpu.rst +++ b/docs/source/gpu.rst @@ -57,15 +57,14 @@ Get a build with GPU support The ``nyxus`` package on PyPI is CPU-only. You need a GPU build: -* The CUDA wheels are published as separate packages, named ``nyxus-cuda12x`` for CUDA 12 and - ``nyxus-cuda11x`` for CUDA 11, for Linux x86_64 (the newest ``nyxus-cuda12x`` with Windows - wheels is 0.9.3, a known issue, `#526 `__). They - do not bundle cuFFT, and the Linux wheels do not bundle the CUDA runtime either, so install them - with the CUDA toolkit. +* The CUDA wheels are published as separate packages: ``nyxus-cuda12x`` for CUDA 12, for Linux + x86_64 and Windows x86_64, and ``nyxus-cuda11x`` for CUDA 11, for Linux x86_64. They do not + bundle cuFFT, and the Linux wheels do not bundle the CUDA runtime either, so install them with + the CUDA toolkit. * The conda-forge ``nyxus`` package has CUDA 12.9 builds for Linux x86_64 and Windows x86_64, which bring the runtime and cuFFT with them (see :doc:`installation`). * To build from source, pass ``-DUSEGPU=ON`` to CMake. The CUDA toolkit must be installed, or - CMake stops with an error. See :doc:`installation` for the full build steps. + CMake stops with an error. See :doc:`building` for the full build steps. A source build compiles kernels for a fixed list of architectures chosen by the CUDA major version: compute capability 5.0 to 9.0 with CUDA 12, and 7.5 to 12.1 with CUDA 13. diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 753853f81..a3780d30c 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -3,12 +3,11 @@ Installation ============ -Nyxus comes as a Python package and as a command-line program. The Python packages on PyPI and -conda-forge hold the Python module only; run the command-line program from a Docker image, or -build either one from source. +Nyxus comes as a Python package and as a command-line program. The Python packages hold the +Python module only; the command-line program runs from a Docker image or a source build. -Python packages ---------------- +Python package +-------------- .. tab-set:: @@ -24,156 +23,76 @@ Python packages conda install -c conda-forge nyxus +* **pip** has wheels for Python 3.10 to 3.13 on Linux (x86_64 and aarch64, glibc 2.28 or newer), + Windows x86_64 and macOS (Intel and Apple Silicon). +* **conda-forge** has packages for Python 3.11 to 3.14 on Linux x86_64, Windows x86_64 and Intel + Macs. On Apple Silicon and Linux aarch64, install the pip wheel into a conda environment. + +On any other platform, :doc:`build from source `. If ``pip`` or ``conda`` reports that +no package matches, see :ref:`troubleshooting-install`. + +The packages read every supported format, including OME-Zarr, DICOM and ``.nii.gz``, and write +Arrow IPC and Parquet. To read Arrow or Parquet output back into Python, also install +``pyarrow``. + +GPU package +----------- + +.. tab-set:: + .. tab-item:: pip, CUDA 12 .. code-block:: bash pip install nyxus-cuda12x -The PyPI wheels are built for CPython 3.10, 3.11, 3.12 and 3.13 on these platforms: + .. tab-item:: pip, CUDA 11 -* Linux x86_64 and aarch64, glibc 2.28 or newer (``manylinux_2_28``); -* Windows x86_64; -* macOS x86_64 (10.15 or newer) and arm64 (11.0 or newer). + .. code-block:: bash -PyPI has no source distribution, so where no wheel fits, ``pip`` falls back to an older release -without a warning, or stops with ``No matching distribution found for nyxus``: + pip install nyxus-cuda11x -* On Linux with a glibc older than 2.28 (for example CentOS 7 or Ubuntu 18.04), ``pip`` installs - 0.8.3, the last release built for ``manylinux2014``, on x86_64 with Python 3.8 to 3.12, and an - even older release with Python 3.6 or 3.7. With Python 3.13 or on aarch64 it stops with ``No - matching distribution found``. The conda-forge Linux x86_64 packages need glibc 2.17 or newer, - so use conda on these systems; on aarch64, build from source. -* On Python 3.9, ``pip`` installs 0.9.3, the last release built for it. On Python 3.8 it installs - 0.8.3 on Linux x86_64, Windows and Intel Macs, and stops with ``No matching distribution found`` - on Apple Silicon Macs and Linux aarch64. -* Python 3.14 has no wheel of any release, so ``pip`` stops with ``No matching distribution found - for nyxus``; the conda-forge package has Python 3.14 builds. -* There is no wheel for other platforms, such as Alpine and other musl-based Linux, Windows on ARM - or 32-bit systems. Build from source there. + .. tab-item:: conda -Check the installed version with ``python -c "import nyxus; print(nyxus.__version__)"``. + .. code-block:: bash -The conda-forge package is built for Linux x86_64, Windows x86_64 and macOS x86_64, for Python 3.10 -to 3.14. It has no build for Apple Silicon Macs or Linux aarch64, where ``conda install`` reports -that the package is not available from the current channels (``PackagesNotFoundError``, -``PackagesNotFoundInChannelsError`` in recent conda); install the PyPI wheel into the conda -environment there: + conda install -c conda-forge nyxus -.. code-block:: bash +* ``nyxus-cuda12x`` has wheels for Linux x86_64 and Windows x86_64, ``nyxus-cuda11x`` for Linux + x86_64. They need the CUDA runtime and cuFFT of the same CUDA version, and an NVIDIA driver that + supports it; a CUDA toolkit provides both libraries. +* On Linux x86_64 and Windows x86_64, the conda-forge ``nyxus`` package also has CUDA 12 builds, + which bring the CUDA libraries with them, and conda usually picks one of them. To get the CPU + build, add ``"cuda-version<12"`` to the ``conda install`` command. - conda create -n nyxus -c conda-forge python=3.12 numpy pandas - conda activate nyxus - pip install nyxus - -The Python package needs NumPy and pandas, which ``pip`` and ``conda`` install with it; NumPy 1 -and 2 both work. To read Arrow IPC or Parquet output back into Python, also install ``pyarrow``. - -What the packages read -^^^^^^^^^^^^^^^^^^^^^^ - -Every package build goes through ``setup.py``, which configures CMake with ``-DALLEXTRAS=ON``. -The PyPI and conda-forge packages therefore read DICOM files and write Arrow IPC and Parquet -output, in addition to TIFF, OME-TIFF and NIfTI. They also read OME-Zarr and compressed NIfTI -(``.nii.gz``), with these exceptions: - -* The Windows wheels on PyPI (``nyxus`` 0.9.3 and 0.11.0, and ``nyxus-cuda12x`` 0.9.3) were built - without OME-Zarr support, and so without ``.nii.gz``: they refuse OME-Zarr and fail on - ``.nii.gz`` files. The ``nyxus`` Windows wheels of 0.12.0 and later read both. -* The first conda-forge Windows builds of 0.11.0 (build number 0, a build string ending in ``_0`` - in ``conda list nyxus``) read none of OME-Zarr, ``.nii.gz`` and DICOM; conda installs one of - them into an environment that holds ``libarrow`` 19 or 20. - -These exceptions concern the published packages. What a source build reads depends on the -libraries it finds (see `Building from source`_). - -.. warning:: - - The conda-forge Windows packages of 0.11.0, 0.12.0 and 0.12.1 were built in Debug mode: their - extension module imports the Visual Studio debug runtime (``MSVCP140D.dll``, ``VCRUNTIME140D.dll``, - ``ucrtbased.dll``), which only an installation of Visual Studio provides, not the Visual C++ - redistributable. Without Visual Studio, ``import nyxus`` fails. This is a known issue - (`#528 `__). - -GPU packages -^^^^^^^^^^^^ - -``nyxus-cuda12x`` is the same package built with ``-DUSEGPU=ON`` against CUDA 12, and -``nyxus-cuda11x`` the same against CUDA 11. Both are published as Linux x86_64 wheels. The newest -``nyxus-cuda12x`` release with Windows wheels is 0.9.3, for CPython 3.9 to 3.12, a known issue -(`#526 `__). On Windows with Python 3.13 or newer, -``pip install nyxus-cuda12x`` therefore stops with ``No matching distribution found for -nyxus-cuda12x``; use Python 3.9 to 3.12 there, or conda-forge with Python 3.10 to 3.13, where conda -picks the CUDA build (it needs Visual Studio, see the warning above). - -The Linux wheels do not bundle the CUDA runtime or cuFFT, and the Windows wheels bundle the -runtime but not cuFFT: install the CUDA runtime and cuFFT libraries of the matching CUDA version, -and an NVIDIA driver that supports it. Without them, ``import nyxus`` fails: on Linux with -``ImportError: libcufft.so.11: cannot open shared object file`` (``libcufft.so.10`` for -``nyxus-cuda11x``), on Windows with ``ImportError: DLL load failed while importing backend`` (the -missing file is ``cufft64_11.dll``). On Linux, a CUDA toolkit of the package's major version -provides both libraries, with its ``lib64`` directory on ``LD_LIBRARY_PATH``. - -``nyxus``, ``nyxus-cuda12x`` and ``nyxus-cuda11x`` all install the module ``nyxus``, so an -environment holds only one of them. To change from one to another, remove all of them and install -the one you want (check first that a wheel of it exists for your platform and Python, or the -environment is left without Nyxus): +``nyxus``, ``nyxus-cuda12x`` and ``nyxus-cuda11x`` all install the same ``nyxus`` module, so keep +only one of them in an environment. To switch, uninstall all three first: .. code-block:: bash pip uninstall -y nyxus nyxus-cuda12x nyxus-cuda11x pip install nyxus-cuda12x -The conda-forge ``nyxus`` package has CUDA 12.9 builds for Linux x86_64 and Windows x86_64 next to -its CPU builds. A CUDA build depends on the conda packages ``cuda-cudart`` and ``libcufft`` (about -155 MB), so conda installs the runtime with it. On those two platforms conda currently picks a -CUDA build, both on a machine without a GPU and on one whose driver supports CUDA 12, and the CPU -build for an older driver. The exception is Python 3.14 on Windows, where it picks the CPU build. -To get the CPU build everywhere, ask for it: - -.. code-block:: bash - - conda install -c conda-forge nyxus "cuda-version<12" - -``conda list cuda-cudart`` in the environment shows whether a CUDA runtime was installed. :doc:`gpu` says which features run on the GPU and how to turn it on. Docker image ------------ -The ``polusai/nyxus`` image on Docker Hub holds the command-line program, built with all -optional formats and with CUDA support. The images of releases 0.9.2 to 0.11.0 are built on -``nvidia/cuda:11.5.2-runtime-ubuntu20.04`` (CUDA 11.5), images 0.4.0 to 0.8.3 on CUDA 11.0, and -the tags up to 0.2.3 on one older image without CUDA. The ``Dockerfile`` in the repository uses -``nvidia/cuda:12.6.3-runtime-ubuntu22.04``, and images built from it get that base. The images are -built for ``linux/amd64`` only: on Apple Silicon, Docker runs them under emulation, and on other -ARM hosts the command-line program has to be built from source. Each release since 0.9.2 is -tagged with its version number, for example ``polusai/nyxus:0.11.0``, and the newest release is -also tagged ``latest``. The image's entry point is the ``nyxus`` executable, so the container -arguments are Nyxus options. - -#. Pull a release: - - .. code-block:: bash +The ``polusai/nyxus`` image holds the command-line program, with every optional format and CUDA +support, for ``linux/amd64``. Each release is tagged with its version, and the newest is also +tagged ``latest``. The container arguments are Nyxus options: - docker pull polusai/nyxus:0.11.0 - -#. Mount the directory that holds your images, and pass paths inside the container. The output - directory (``/path/to/experiment/out`` here) must already exist: - - .. code-block:: bash - - docker run --rm -v /path/to/experiment:/data polusai/nyxus:0.11.0 \ - --intDir=/data/int --segDir=/data/seg --outDir=/data/out \ - --outputType=singlecsv --features="*ALL_INTENSITY*" +.. code-block:: bash -#. To use a GPU, add ``--gpus all`` to ``docker run`` and ``--useGpu=true`` to the Nyxus options. - This needs the NVIDIA Container Toolkit on the host. + docker pull polusai/nyxus:latest + docker run --rm -v /path/to/experiment:/data polusai/nyxus:latest \ + --intDir=/data/int --segDir=/data/seg --outDir=/data/out \ + --outputType=singlecsv --features="*ALL_INTENSITY*" -#. Nyxus sets its default memory budget from the host's memory, not from a limit given with - ``docker run --memory``. When you set such a limit, also pass ``--ramLimit`` with a value in - megabytes below it, so that large ROIs are processed out of core rather than exceeding the - container's memory (see :doc:`large_images`). +Paths are paths inside the container, and the output directory must already exist. To use a GPU, +add ``--gpus all`` to ``docker run`` and ``--useGpu=true`` to the Nyxus options; this needs the +NVIDIA Container Toolkit on the host. When you limit the container's memory with ``docker run +--memory``, also pass ``--ramLimit`` (in megabytes) below that limit, see :doc:`large_images`. Every option is listed in the :ref:`cli-reference`. @@ -182,8 +101,8 @@ Every option is listed in the :ref:`cli-reference`. Checking the installation ------------------------- -The script below prints the package version, whether Arrow IPC and Parquet output are -available, and whether a CUDA GPU can be used, and then computes one feature. +This script prints the version, whether Arrow IPC and Parquet output are available and whether a +CUDA GPU can be used, and then computes one feature: .. literalinclude:: ../examples/check_install.py :language: python @@ -194,264 +113,15 @@ Output from a CPU package: .. code-block:: text - Nyxus version: 0.11.0 + Nyxus version: 0.12.1 Arrow IPC and Parquet output: True CUDA GPU usable: False MEAN of 1, 2, 3, 4: 2.5 -``gpu_is_available`` takes the ``id`` of a ``Nyxus`` object. It returns ``False`` for a package -built without CUDA, and otherwise ``True`` when at least one CUDA device is found. - -The command-line program has no ``--version`` option. It prints its version in the first line of -every run, whatever the ``--verbose`` level, for example -``Nyxus /// 0.11.0 /// (c) 2021-2025 Axle Research Build of ``. ``nyxus --help`` prints the -usage screen. - -No call reports whether OME-Zarr or DICOM support is compiled in. A build without it refuses -such a file with ``This version of Nyxus was not build with OmeZarr support`` or ``This version -of Nyxus was not build with DICOM support``. When you build from source, the CMake configure step -prints which optional parts were requested and which were found: - -.. code-block:: text - - -- Nyxus Dependencies Summary - -- ================================ - -- Support | Requested | Found - -- ================================ - -- Z5 | ON | ON - -- Arrow | ON | ON - -- Dicom | ON | ON - -- CUDA | OFF | OFF +For the command-line program, ``nyxus --help`` prints the usage screen. Building from source -------------------- -Build from a git clone of the repository. The package version comes from the git tags, so a -GitHub source archive of the development head or a copy without the ``.git`` directory stops with -``setuptools-scm was unable to detect version``: - -.. code-block:: bash - - git clone https://github.com/PolusAI/nyxus.git - cd nyxus - -The ``ci-utils`` and ``tests`` paths on this page are relative to this directory. The build steps -below describe the development head; a release tag can differ (0.11.0, for example, is built as -C++17 and has no ``ci-utils/envs/conda_cpp_mac.txt``). - -Requirements -^^^^^^^^^^^^ - -* CMake 3.20 or newer. -* A C++20 compiler. On Windows, use MSVC: the conda-forge Windows libraries are built with MSVC - and do not link with GCC. -* libtiff, which is always required. -* For each optional part, its libraries: - -.. list-table:: - :header-rows: 1 - :widths: 25 75 - - * - Part - - Libraries - * - OME-Zarr input - - z5 (headers), Blosc, zlib, nlohmann_json; zstd for Zstandard-compressed Zarr version 3 - arrays, used when both its library and header are found - * - DICOM input - - DCMTK and zlib; fmjpeg2k for JPEG 2000 pixel data - * - Arrow IPC and Parquet output - - Apache Arrow and Parquet - * - Python package - - pybind11 - * - GPU - - a CUDA toolkit whose ``nvcc`` supports your host compiler - -Getting the dependencies -^^^^^^^^^^^^^^^^^^^^^^^^ - -.. tab-set:: - - .. tab-item:: conda (recommended) - - The files in ``ci-utils/envs/`` list the conda-forge packages: - - * ``conda_cpp.txt``: the C++ libraries, CMake and pybind11; - * ``conda_cpp_mac.txt``: the same without DCMTK and fmjpeg2koj, for Apple Silicon Macs and - Linux aarch64; - * ``conda_py.txt``: numpy, pandas, pyarrow and pip; - * ``conda_linux_compiler.txt`` and ``conda_linux_gpu.txt``: a Linux compiler and the CUDA 12.6 - compiler and libraries. - - .. code-block:: bash - - conda create -n nyxus_build -c conda-forge python=3.12 \ - --file ci-utils/envs/conda_cpp.txt --file ci-utils/envs/conda_py.txt - conda activate nyxus_build - - On Apple Silicon Macs and on Linux aarch64, use ``conda_cpp_mac.txt`` in place of - ``conda_cpp.txt``: the other file does not solve there, and this one has no DICOM libraries. - On Linux, also add ``--file ci-utils/envs/conda_linux_compiler.txt`` so that the compiler - matches the conda libraries, as the CI builds do. - - Point CMake at the environment with the ``NYXUS_DEP_DIR`` environment variable: - ``$CONDA_PREFIX`` on Linux and macOS, ``%CONDA_PREFIX%\Library`` on Windows. When it is set, - CMake uses it as ``CMAKE_PREFIX_PATH`` and as a library directory. - - .. tab-item:: Linux and macOS scripts - - ``ci-utils/install_prereq_linux.sh`` downloads and builds the dependencies into - ``./local_install``: - - .. code-block:: bash - - bash ci-utils/install_prereq_linux.sh --build_arrow yes - export NYXUS_DEP_DIR=$PWD/local_install - - Its options are ``--min_build yes`` (only pybind11, libtiff and their codecs, no OME-Zarr, - DICOM or Boost), ``--build_arrow yes`` (also Arrow and Parquet; off by default) and - ``--install_dir ``, a path relative to the current directory (the script prefixes it - with ``../../`` for each dependency build). The script needs ``curl``, ``unzip``, ``bzip2``, - ``make``, CMake and a C++ compiler. It does not stop when a step fails, so check its output - for errors before building. On macOS, run it with bash 4 or newer (for example Homebrew's - ``bash``): the system ``/bin/bash`` 3.2 reports ``bad substitution`` at the ``--min_build`` - check, ignores the option and builds every dependency. - - .. tab-item:: Windows script - - ``ci-utils\install_prereq_win.bat`` downloads and builds the dependencies, including Arrow, - into ``.\local_install``. Run it from a Visual Studio developer command prompt: - - .. code-block:: bat - - set PATH=%PATH%;C:\Program Files\Git\usr\bin - ci-utils\install_prereq_win.bat - set NYXUS_DEP_DIR=%cd%\local_install - set PATH=%NYXUS_DEP_DIR%\bin;%PATH% - - ``--min_build yes`` skips OME-Zarr and DICOM. The first line adds Git for Windows' - ``usr\bin``, for the ``unzip`` the script needs, at the end of ``PATH``. Placed earlier, its - ``link.exe`` and ``tar.exe`` hide the MSVC linker and the Windows ``tar`` that the script - uses for ``.zip`` files. The script does not stop when a step fails, so check its output for - errors before building. - - The dependency DLLs in ``local_install\bin`` must be on ``PATH`` when you run the - command-line program. Python does not search ``PATH`` for an extension module's DLLs, so in - Python call ``os.add_dll_directory(r"\local_install\bin")`` before - ``import nyxus``. - -Building the Python package -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -``pip`` builds the package through ``setup.py`` (see the CMake options below). With -``NYXUS_DEP_DIR`` set as above, run from the source tree: - -.. code-block:: bash - - python -m pip install . -vv - -Pass more CMake options in the ``CMAKE_ARGS`` environment variable, separated by spaces. For -example, a GPU build, which needs a CUDA toolkit: ``CMAKE_ARGS="-DUSEGPU=ON" python -m pip install -. -vv`` in bash, or ``set CMAKE_ARGS=-DUSEGPU=ON`` before the ``pip`` command in a Windows command -prompt. - -The package then includes every optional part whose libraries CMake finds. A missing optional -dependency switches its part off and the build continues, except the GPU part: without a CUDA -toolkit, configuring stops. Not every such case prints a warning (a missing DCMTK drops DICOM with -only status lines), so check the dependency summary at the end of the configure output. libtiff -and pybind11 are required: configuring stops without them. - -Building the command-line program -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: bash - - cmake -S . -B build-cli -DBUILD_CLI=ON -DALLEXTRAS=ON -DCMAKE_PREFIX_PATH=$NYXUS_DEP_DIR - cmake --build build-cli --config Release --parallel 4 - -The executable is ``build-cli/nyxus`` (``build-cli\Release\nyxus.exe`` with a Visual Studio -generator). Use a directory other than ``build``, which ``pip`` uses for the Python package. - -CMake options -^^^^^^^^^^^^^ - -.. list-table:: - :header-rows: 1 - :widths: 20 12 68 - - * - Option - - Default - - Effect - * - ``BUILD_CLI`` - - not set (off) - - Builds the ``nyxus`` command-line executable. - * - ``BUILD_LIB`` - - not set (off) - - Builds the Python extension module ``backend``. ``setup.py`` turns it on. - * - ``NOEXTRAS`` - - ``ON`` - - Turns ``USE_Z5``, ``USE_DCMTK`` and ``USE_ARROW`` off: the build reads TIFF, OME-TIFF and - uncompressed NIfTI only. Because it is on by default, a ``USE_*`` option has no effect - unless you also pass ``-DNOEXTRAS=OFF``. - * - ``ALLEXTRAS`` - - ``OFF`` - - Turns ``USE_Z5``, ``USE_DCMTK`` and ``USE_ARROW`` on. It takes precedence over - ``NOEXTRAS``. ``setup.py`` always passes it. - * - ``REQUIRE_ALLEXTRAS`` - - ``OFF`` - - Stops the configure with an error when ``USE_Z5``, ``USE_DCMTK`` or ``USE_ARROW`` is off. - Without it, a part whose libraries are missing is dropped with a warning. The ``nyxus`` - wheels on PyPI are built with it; the ``nyxus-cuda11x`` and ``nyxus-cuda12x`` wheels are not. - * - ``USE_Z5`` - - ``OFF`` - - OME-Zarr input. Also enables compressed NIfTI (``.nii.gz``), which needs the zlib that this - option finds. Dropped with a warning when zlib, Blosc, nlohmann_json or the z5 headers - are missing. - * - ``USE_DCMTK`` - - ``OFF`` - - DICOM input. Dropped when DCMTK or zlib is missing. JPEG 2000 pixel data is read when - fmjpeg2k is also found. - * - ``USE_ARROW`` - - ``OFF`` - - Arrow IPC and Parquet output (``--outputType=arrowipc`` or ``parquet``). Dropped with a - warning when Arrow or Parquet is missing. - * - ``USE_STATIC_ARROW`` - - ``OFF`` - - macOS only. Links Arrow and Parquet statically into the Python module and exports only its - init symbol, so the module's Arrow stays private when pyarrow loads its own Arrow in the - same process. Configuring stops when the Arrow installation has no static libraries. The - macOS wheels are built with it on. Elsewhere it is ignored with a warning. - * - ``USEGPU`` - - ``OFF`` - - Builds the CUDA kernels and the ``--useGpu`` and ``--gpuDeviceID`` options. Configuring - stops with ``USEGPU flag was set to ON but no CUDA compiler was found`` when no CUDA - compiler or toolkit is found. The GPU architectures compiled for follow the CUDA major - version, from 10 to 13. - * - ``RUN_GTEST`` - - ``OFF`` - - Downloads GoogleTest and builds the C++ test executable ``runAllTests``. - * - ``RUN_BENCHMARKS`` - - ``OFF`` - - Builds the ``bench_convex_hull`` micro-benchmark (see ``benchmarks/README.md``). - * - ``CMAKE_BUILD_TYPE`` - - ``Release`` (``Debug`` with MSVC) - - Single-configuration generators build ``Release`` unless told otherwise. With MSVC, CMake - itself presets ``Debug``, so pass ``-DCMAKE_BUILD_TYPE=Release`` when you use Ninja or - NMake. This is a known defect (`#524 `__). - -The C++ standard is C++20 and is required (``CMAKE_CXX_STANDARD 20``). On MSVC the build adds -``/permissive- /EHsc /bigobj /Zc:__cplusplus``. - -Running the tests -^^^^^^^^^^^^^^^^^ - -After installing the Python package, run the Python test suite from the source tree. Use a -checkout of the same version as the installed package (``git checkout 0.11.0`` for 0.11.0): the -tests on the development head cover features that a released package may not have. - -.. code-block:: bash - - python -m pip install pytest bfio imagecodecs pyarrow - python -m pytest tests/python/ - -With ``-DRUN_GTEST=ON``, the build also produces ``runAllTests``, the C++ test executable. It -does not need ``BUILD_CLI`` or ``BUILD_LIB``. +To build the Python package or the command-line program yourself, for example on a platform +without a package, see :doc:`building`. diff --git a/docs/source/supported_formats.rst b/docs/source/supported_formats.rst index 2f7858dd0..ee70cc5af 100644 --- a/docs/source/supported_formats.rst +++ b/docs/source/supported_formats.rst @@ -36,10 +36,9 @@ in a directory are read, so a file with an unsupported extension that matches th run with that error. OME-Zarr and DICOM support are optional parts of a source build (see the CMake options in -:doc:`installation`). The PyPI and conda packages include both, except that the Windows wheels -on PyPI of 0.9.3 and 0.11.0 have no OME-Zarr support, and the first conda-forge Windows builds of -0.11.0 (build number 0) have neither. Reading ``.nii.gz`` needs zlib, which a build includes -together with OME-Zarr support, so those packages do not read ``.nii.gz`` either. +:doc:`building`). The PyPI and conda packages include both. Reading ``.nii.gz`` needs zlib, +which a build includes together with OME-Zarr support, so a source build without OME-Zarr does not +read ``.nii.gz`` either. TIFF and OME-TIFF ----------------- diff --git a/docs/source/troubleshooting.rst b/docs/source/troubleshooting.rst index 7cf4bc228..1dd1b8840 100644 --- a/docs/source/troubleshooting.rst +++ b/docs/source/troubleshooting.rst @@ -10,6 +10,36 @@ control its threads and memory and how to time a run. Every option it names is d Common errors ------------- +.. _troubleshooting-install: + +Installing +^^^^^^^^^^ + +* ``pip`` stops with ``No matching distribution found for nyxus`` when no wheel fits your Python + and platform: Python 3.14 (use conda-forge), Linux with a glibc older than 2.28 such as CentOS 7 + (use conda-forge on x86_64), and musl-based Linux, Windows on ARM or 32-bit systems (build from + source, see :doc:`building`). An older ``pip`` may instead install an old release that still had + a wheel for your system, so check the version with + ``python -c "import nyxus; print(nyxus.__version__)"``. +* ``conda install`` reports ``PackagesNotFoundError`` on Apple Silicon Macs and Linux aarch64, + where conda-forge has no build. Install the pip wheel into the conda environment: + + .. code-block:: bash + + conda create -n nyxus -c conda-forge python=3.12 numpy pandas + conda activate nyxus + pip install nyxus + +* On Windows, ``import nyxus`` from the conda-forge package fails on a machine without Visual + Studio: the package is built in Debug mode and needs the Visual Studio debug runtime + (``MSVCP140D.dll``). Install the pip wheel instead. This is a known issue + (`#528 `__). +* A CUDA package whose libraries are missing fails at ``import nyxus``, on Linux with + ``ImportError: libcufft.so.11: cannot open shared object file`` (``libcufft.so.10`` for + ``nyxus-cuda11x``), on Windows with ``ImportError: DLL load failed while importing backend``. + Install the CUDA runtime and cuFFT of the package's CUDA version; on Linux, put the toolkit's + ``lib64`` directory on ``LD_LIBRARY_PATH``. + Feature names ^^^^^^^^^^^^^ @@ -150,11 +180,8 @@ A build without an optional part refuses its files or outputs: available. Please install Nyxus with Arrow enabled to use this functionality.`` and the call raises ``RuntimeError``. -The PyPI and conda packages include all of them, except that the Windows wheels on PyPI of 0.9.3 -and 0.11.0 have no OME-Zarr support (see :doc:`installation`). The first conda-forge Windows builds of -0.11.0 (build number 0) also lack OME-Zarr, ``.nii.gz`` and DICOM; conda installs one of them into -an environment that holds ``libarrow`` 19 or 20. -:ref:`installation-check` shows how to check a build. +The PyPI and conda packages include all of them, so these messages come from source builds (see +:doc:`building`). :ref:`installation-check` shows how to check a build. GPU ^^^ From 187311194790f78d5639dbed2ecba243158f0fe9 Mon Sep 17 00:00:00 2001 From: Demian Vladi Date: Mon, 23 Nov 2026 09:10:52 -0800 Subject: [PATCH 2/2] ci: re-run CI after GitHub returned 503 to the wheel jobs' downloads