Skip to content

Troubleshooting

The sidebar is empty and there is no Run button.

  • The file must be a .json file saved on your disk.
  • It must be recognised as a model: a Pywr v2 model has the metadata, time and network sections; a Pywr v1 model has a timestepper section and a list of nodes. See Create a model.
  • A file that is not valid JSON, for example with a missing bracket, cannot be read. Fix the errors VS Code underlines first.

Each message starts with Cannot run the model.

No environment is selected. Create one, then select it:

  1. Open a terminal in the folder of your model and run python -m venv .venv.

  2. Run Python: Select Interpreter from the Command Palette and pick .venv.

The selected interpreter is a global interpreter, not an environment

Section titled “The selected interpreter is a global interpreter, not an environment”

The Python selected is the one of your system. The extension needs a virtual environment or a conda environment. Create one as above and select it.

Python 3.x is not supported. Use Python 3.10 or later

Section titled “Python 3.x is not supported. Use Python 3.10 or later”

The environment uses a version of Python that is too old to run Pywr v2 models. Create an environment with Python 3.10 or later and select it.

Free-threaded Python builds are not supported

Section titled “Free-threaded Python builds are not supported”

The environment uses a free-threaded build of Python. Create an environment from a standard build.

The Python of the environment was built without its shared library, so the extension cannot load it. Use a Python from python.org, from conda or from your system’s package manager.

Pywr v2 The process that runs the model crashed, for example in a Python package that your model uses. The message has the end of what the process wrote, which usually names the cause. VS Code keeps working, and you can run the model again once the cause is fixed.

pywr is not installed in the selected Python environment

Section titled “pywr is not installed in the selected Python environment”

Pywr v1 Pywr v1 models run with pywr from your environment. Install it there:

Terminal window
pip install pywr

or select the environment where it is installed with Python: Select Interpreter.

The model needs pywr 1 but the selected Python environment has pywr …

Section titled “The model needs pywr 1 but the selected Python environment has pywr …”

Pywr v1 The environment has another major version of pywr. Select, or create, an environment with pywr 1.

Cannot run the model because the file could not be saved

Section titled “Cannot run the model because the file could not be saved”

The model is saved before each run. Check that the file is not read-only and that the disk is not full.

The following occurred while running the model

Section titled “The following occurred while running the model”

The run started and Pywr stopped with an error. The message is the one from Pywr.

  • Look at the Problems panel first: a mistake in the model is often the cause. See Check the model for mistakes.
  • For a Pywr v1 model, press Show details to read the full message from Python.
  • A model can be valid and still impossible to solve, for example when a minimum flow cannot be met. Check the limits and the costs of the nodes named in the message.

There is no Open results button after a run

Section titled “There is no Open results button after a run”

The button is there when the run wrote an HDF5, CSV or Arrow stream file. Check that the model saves something:

  • Pywr v2 an output of type HDF5 or CSV, with a metric set
  • Pywr v1 a CSV recorder or a tables recorder
  • The viewer reads the outputs of Pywr v2 and the files of the TablesRecorder and the CSVRecorder of Pywr v1. See Supported formats.
  • An HDF5 file compressed with blosc2, bzip2 or lzo cannot be read.
  • A CSV file opens as text when you click it. Right-click it and pick Open the results chart.

Results on the schematic warns that the file has no results for the nodes and the edges of the model when the names in the file are not those of the model. Check that you picked the results of this model, and that it saves its nodes: click the file name in the bar at the top of the schematic to pick another file.

The map is downloaded from OpenStreetMap. Check your internet connection, and that your network allows tile.openstreetmap.org and unpkg.com.

Pywr v1 The warning starts with The Cython modules cannot be imported to check the component types of the model, followed by the reason. The model is still checked, but any custom type is accepted until the modules import.

  • A compiled module works with one version of Python and one operating system. Select the environment it was built for with Python: Select Interpreter.
  • pywr and the packages the module uses must be installed in that environment.
  • Check the paths in the pywr.v1.cythonModules setting, or run Pywr: Manage Cython Modules to remove a module that no longer exists.

See Use Cython modules.

  • Turn off pywr.codeLens.componentActions and pywr.codeLens.referenceActions to remove the links above each component and each reference.
  • Turn off pywr.expandTreesOnOpen to open the trees collapsed.

See Settings.

When you report a problem, the log helps to find its cause.

  1. Turn on the pywr.enableLogging setting.

  2. Do again what went wrong.

  3. Open View > Output and pick pywr from the list at the top right of the panel.

  4. Copy the text.

  • Report a bug in the issues of the project, with the version of the extension, the version of VS Code, your operating system and the log.
  • Ask a question or suggest an idea in the discussions.