From d286ec73d55266a39cf84e84953829ab016dd8a5 Mon Sep 17 00:00:00 2001 From: Robert Blackwell Date: Wed, 5 Feb 2025 12:23:37 -0500 Subject: [PATCH] installer: GUI no longer default enabled --- ManifoldEM/interfaces/gui.py | 10 +++++++--- README.md | 5 +++-- pyproject.toml | 8 ++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ManifoldEM/interfaces/gui.py b/ManifoldEM/interfaces/gui.py index eae5da5..7dcf054 100644 --- a/ManifoldEM/interfaces/gui.py +++ b/ManifoldEM/interfaces/gui.py @@ -11,9 +11,13 @@ from argparse import ArgumentParser -from PyQt5 import QtCore -from PyQt5.QtGui import QFont -from PyQt5.QtWidgets import QApplication +try: + from PyQt5 import QtCore + from PyQt5.QtGui import QFont + from PyQt5.QtWidgets import QApplication +except ImportError: + print("PyQt5 not found. Did you install ManifoldEM with the [gui] option? Consult the README for more information.") + sys.exit(1) import ManifoldEM diff --git a/README.md b/README.md index 9013d2d..bb300f9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ resources may prove useful for a review of ManifoldEM history, theory and implem ## Installation Should be installable in any modern python/conda environment (python 3.9+, though `mayavi` and -`pyqt` packages don't always immediately work with the most recent version of python). +`pyqt` packages don't always immediately work with the most recent version of python). If you don't +need the gui, feel free to omit the "[gui]" part of the install command! python: ```bash @@ -38,7 +39,7 @@ python3 -m venv ~/envs/manifoldem source ~/envs/manifoldem/bin/activate pip install --upgrade pip -pip install "git+ssh://git@github.com/flatironinstitute/ManifoldEM" +pip install "git+ssh://git@github.com/flatironinstitute/ManifoldEM[gui]" manifold-gui ``` diff --git a/pyproject.toml b/pyproject.toml index 0559585..d9d7b4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,8 +48,6 @@ dependencies = [ "nptyping", "numpy", "numba", - "mayavi", - "PyQt5", "psutil", "matplotlib", "scikit-image", @@ -66,6 +64,12 @@ dependencies = [ "fasthog", ] +[project.optional-dependencies] +gui = [ + "mayavi", + "PyQt5", +] + [project.scripts] manifold-cli = "ManifoldEM.interfaces.cli:main" manifold-gui = "ManifoldEM.interfaces.gui:main"