Import Errors¶
Symptoms¶
ModuleNotFoundError: No module named 'PyFLASH'when you runimport PyFLASH.import PyFLASHworks, butpyflash-uiis not found orimport streamlitfails.run_specon a.yamlfile raisesImportError: PyYAML is required to load .yaml spec files.; a.tomlfile raises the matchingtomllib (Python 3.11+) or tomli is required for .toml specs.- The first access of
PyFLASH.plotting,PyFLASH.pipeline,PyFLASH.stats, or a pipeline (correlation,data_overview, …) raises an import error even thoughimport PyFLASHitself succeeded.
Likely Causes¶
- PyFLASH is installed in a different interpreter than the one running your code (a common Jupyter kernel or virtual-environment mismatch).
- PyFLASH is not installed in the active environment at all.
- An optional extra is missing. Streamlit and PyYAML (
ui),pointpats(spatial), anddabest(estimation) are not installed by the base package. - Heavy analysis submodules load lazily, so an import problem inside
plotting/pipeline/statsonly surfaces on first use, not atimport PyFLASH.
Fix¶
Install the package into the environment you actually run:
The distribution name on PyPI is PyFLASH-analysis; the import name is always
PyFLASH. For the Streamlit UI and YAML spec support, install the UI extra:
Other extras: .[spatial] (pointpats), .[estimation] (dabest),
.[windows] (pywin32). PyYAML alone can be added with pip install pyyaml.
Core scientific dependencies (pandas, numpy, matplotlib, seaborn,
scipy, statsmodels, scikit-posthocs, scikit-learn, openpyxl,
read-roi, Pillow) install automatically with the base package. A bare
import PyFLASH deliberately avoids loading matplotlib, seaborn, scipy, and
statsmodels; they load on first access of a plotting or pipeline entry point.
Check¶
Confirm the interpreter and install location match:
If you use Jupyter, run the same line in a kernel cell to verify the kernel points at the same environment. To confirm the plotting stack loads, force one lazy submodule: