Troubleshooting
The extension does not react to my model
Section titled “The extension does not react to my model”The sidebar is empty and there is no Run button.
- The file must be a
.jsonfile saved on your disk. - It must be recognised as a model: a Pywr v2 model has the
metadata,timeandnetworksections; a Pywr v1 model has atimesteppersection and a list ofnodes. 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.
The run fails
Section titled “The run fails”Each message starts with Cannot run the model.
No active Python environment
Section titled “No active Python environment”No environment is selected. Create one, then select it:
-
Open a terminal in the folder of your model and run
python -m venv .venv. -
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.
Cannot find the Python shared library
Section titled “Cannot find the Python shared library”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.
The pywr process stopped unexpectedly
Section titled “The pywr process stopped unexpectedly”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:
pip install pywror 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
A results file does not open
Section titled “A results file does not open”- The viewer reads the outputs of Pywr v2 and the files of the
TablesRecorderand theCSVRecorderof 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.
The schematic shows no results
Section titled “The schematic shows no results”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 of the schematic is blank
Section titled “The map of the schematic is blank”The map is downloaded from OpenStreetMap. Check your internet connection, and that your
network allows tile.openstreetmap.org and unpkg.com.
The Cython modules cannot be imported
Section titled “The Cython modules cannot be imported”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.cythonModulessetting, or run Pywr: Manage Cython Modules to remove a module that no longer exists.
See Use Cython modules.
The editor is slow with a large model
Section titled “The editor is slow with a large model”- Turn off
pywr.codeLens.componentActionsandpywr.codeLens.referenceActionsto remove the links above each component and each reference. - Turn off
pywr.expandTreesOnOpento open the trees collapsed.
See Settings.
Get the log
Section titled “Get the log”When you report a problem, the log helps to find its cause.
-
Turn on the
pywr.enableLoggingsetting. -
Do again what went wrong.
-
Open View > Output and pick pywr from the list at the top right of the panel.
-
Copy the text.
Report a problem or ask a question
Section titled “Report a problem or ask a question”- 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.