Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Westeros Baseline Example Reporting Module Error #787

Open
brendandanaher opened this issue Jan 25, 2024 · 2 comments
Open

Westeros Baseline Example Reporting Module Error #787

brendandanaher opened this issue Jan 25, 2024 · 2 comments
Assignees
Labels
docs Documentation

Comments

@brendandanaher
Copy link

Code sample or context
When plotting results in westeros_baseline.ipynb there is a typo calling the reporting module. The error can be seen below.

There needs to be a change to the where the module is called so that it calls "from message_ix.reporting import Reporter". This will allow the program to work.

# Create a Reporter object to describe and carry out reporting
# calculations and operations (like plotting) based on `scenario`
from message_ix.report import Reporter

rep = Reporter.from_scenario(scenario)

# "prepare_plots" enables several to describe reporting operations, e.g.
# "plot activity", "plot capacity", or "plot prices"
# See message_ix/util/tutorial.py for more information
from message_ix.util.tutorial import prepare_plots

prepare_plots(rep)

Expected result

The program should prepare the plots that get called later on.

Problem description

Due to the typo, the following error is raised:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[~\AppData\Local\Temp\ipykernel_24900\3937561850.py](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/brend/Documents/CIVE%20566/MESSAGE%20Tutorials/iiasa-message_ix-f2bd088/tutorial/westeros/~/AppData/Local/Temp/ipykernel_24900/3937561850.py) in <module>
      1 # Create a Reporter object to describe and carry out reporting
      2 # calculations and operations (like plotting) based on `scenario`
----> 3 from message_ix.report import Reporter
      4 
      5 rep = Reporter.from_scenario(scenario)

ModuleNotFoundError: No module named 'message_ix.report'

Versions

Output of message-ix show-versions
ixmp:        3.4.0
message_ix:  3.4.0
message_ix_models: None
message_data: None

click:       8.1.7
dask:        2022.02.0
genno:       installed
graphviz:    None
jpype:       1.4.1
… JVM path:  C:\Program Files\Java\jdk-21\bin\server\jvm.dll
openpyxl:    3.0.10
pandas:      1.2.5
pint:        0.17
xarray:      0.20.2
yaml:        6.0

iam_units:   installed
jupyter:     installed
matplotlib:  3.4.2
plotnine:    None
pyam:        1.3.1

GAMS:        38.3.0

python:      3.7.15 (default, Nov 24 2022, 18:44:54) [MSC v.1916 64 bit (AMD64)]
python-bits: 64
OS:          Windows
OS-release:  10
machine:     AMD64
processor:   Intel64 Family 6 Model 154 Stepping 3, GenuineIntel
byteorder:   little
LC_ALL:      None
LANG:        None
LOCALE:      (None, None)
@brendandanaher
Copy link
Author

I am using MESSAGE as part of a course and originally downloaded using conda and the version was older. I updated through pip to version 3.7 and the error persists.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[~\AppData\Local\Temp\ipykernel_12324\3937561850.py](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/brend/Documents/CIVE%20566/MESSAGE%20Tutorials/iiasa-message_ix-f2bd088/tutorial/westeros/~/AppData/Local/Temp/ipykernel_12324/3937561850.py) in <module>
      1 # Create a Reporter object to describe and carry out reporting
      2 # calculations and operations (like plotting) based on `scenario`
----> 3 from message_ix.report import Reporter
      4
      5 rep = Reporter.from_scenario(scenario)
ModuleNotFoundError: No module named 'message_ix.report'

Versions

Output of message-ix show-versions
ixmp:        3.7.0
message_ix:  3.7.0
message_ix_models: None
message_data: None

click:       8.1.7
dask:        2022.02.0
genno:       installed
graphviz:    None
jpype:       1.4.1
… JVM path:  C:\Program Files\Java\jdk-21\bin\server\jvm.dll
openpyxl:    3.0.10
pandas:      1.2.5
pint:        0.17
xarray:      0.20.2
yaml:        6.0

iam_units:   installed
jupyter:     installed
matplotlib:  3.4.2
plotnine:    None
pyam:        1.3.1

GAMS:        38.3.0

python:      3.7.15 (default, Nov 24 2022, 18:44:54) [MSC v.1916 64 bit (AMD64)]
python-bits: 64
OS:          Windows
OS-release:  10
machine:     AMD64
processor:   Intel64 Family 6 Model 154 Stepping 3, GenuineIntel
byteorder:   little
LC_ALL:      None
LANG:        None
LOCALE:      (None, None)

@glatterf42
Copy link
Member

Hi @brendandanaher, thanks for reaching out!

This typo is somewhat intentional, I would say. Please note that we have recently released version 3.8.0 of message_ix, which changed the syntax of calling the reporting-related module (as you can see in our docs). So at version 3.4.0 and 3.7.0, the syntax needs to be the way you describe it (from message_ix.reporting import Reporter), while for version 3.8.0 and above, it needs to be the new way (from message_ix.report import Reporter).
We took precautions to avoid people running into such errors, so the version of the tutorials that is distributed along with the code always reflects the currently working syntax. For example, you will find that the westeros baseline tutorial in the 3.7.0 version does call from message_ix.reporting, while only the 3.8.0 version calls from message_ix.report. So you must have gotten your hands on the latest version of the tutorial, which does not necessarily work with not-the-latest version of message_ix.

Please try updating the message_ix module to the latest version or try running the old version of the tutorials! They are identical on the content side, but some syntax has changed.

@glatterf42 glatterf42 added the docs Documentation label Jan 26, 2024
@glatterf42 glatterf42 self-assigned this Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation
Projects
None yet
Development

No branches or pull requests

2 participants