message_ix icon indicating copy to clipboard operation
message_ix copied to clipboard

“MissingKeyError”and"NameError"in the "westeros_baseline.ipynb"

Open Robinson950619 opened this issue 2 years ago • 3 comments

Dear contributor, I'm a fresh postgraduate who first contact with the MESSAGEix model and desire to grasp and develop it. With the help of the Gidden who is the member of IIASA, I have finish the progress of the installation succesffuly. I'm very grateful to him. However, when I tried to run the model of the "westeros_baseline.ipynb", I got the first error on the step "Plotting Results", Like this image image image image image image

So the following steps about "Activity", "Capacity" and other varaities also raised the same errors named "NameError" which is the second error and I think this is due to the first error. For instance image

In addition, I guess these two errors may be caused by the issue during my installation. When I open my Anaconda Prompt and run the code "message-ix show-versions", I got

   ixmp:        3.5.0
   message_ix:  3.6.0
   message_ix_models: None
   message_data: None

   click:       8.1.3
   dask:        2022.9.2
   genno:       installed
   graphviz:    None
   jpype:       1.4.0
   … JVM path:  C:\Users\dell\anaconda3\envs\message_env\Library\bin\server\jvm.dll
   openpyxl:    3.0.10
   pandas:      1.5.0
   pint:        0.19.2
   xarray:      2022.9.0
   yaml:        6.0

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

   GAMS:        40.2.0

   python:      3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:30:19) [MSC v.1929 64 bit (AMD64)]
   python-bits: 64
   OS:          Windows
   OS-release:  10
   machine:     AMD64
   processor:   Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
   byteorder:   little
   LC_ALL:      None
   LANG:        None
   LOCALE:      ('Chinese (Simplified)_China', '936')

And I found one detail is different from the Youtube video of the installation instruction, that is

   plotnine:    None

Which shown in the Youtube video of the installation instruction is

   plotnine:    0.8.0

So I wonder if this difference has caused the first error. Please the contributors could help my issue! I'm deeply looking forward for your reply. Thanks so much for your patience!Have a nice day!

Robinson950619 avatar Oct 15 '22 09:10 Robinson950619

Could someone HELP me solve this problem? I couldn't continue my model right now. @_@

Robinson950619 avatar Oct 18 '22 11:10 Robinson950619

Can you please print conda list and tell the genno package version ?

awais307 avatar Oct 19 '22 06:10 awais307

Can you please print and tell the package version ?conda list``genno So sorry that I'm late for your suggestions because there were too much things to deal with in a few days. Here is my conda list message-ix

   # packages in environment at C:\Users\dell\anaconda3\envs\message_env:
   #
   # Name                    Version                   Build  Channel
   message-ix                3.6.0              pyhd8ed1ab_0    conda-forge

And here is my message-ix platform list,

   default: local
   local: {'class': 'jdbc', 'driver': 'hsqldb', 'path': WindowsPath('C:/Users/dell/.local/share/ixmp/localdb/default')}

And here is my message-ix version, which is shown previously ixmp: 3.5.0 message_ix: 3.6.0 message_ix_models: None message_data: None

   click:       8.1.3
   dask:        2022.9.2
   genno:       installed
   graphviz:    None
   jpype:       1.4.0
   … JVM path:  C:\Users\dell\anaconda3\envs\message_env\Library\bin\server\jvm.dll
  openpyxl:    3.0.10
  pandas:      1.5.0
  pint:        0.19.2
  xarray:      2022.9.0
  yaml:        6.0

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

  GAMS:        40.2.0

  python:      3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:30:19) [MSC v.1929 64 bit (AMD64)]
  python-bits: 64
  OS:          Windows
  OS-release:  10
  machine:     AMD64
  processor:   Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
  byteorder:   little
  LC_ALL:      None
  LANG:        None
  LOCALE:      ('Chinese (Simplified)_China', '936')

That's all. AND very thanks for your attention to my issues. I'm deeply to your reply! Have a Nice day! Best Wishes!

Robinson950619 avatar Oct 24 '22 08:10 Robinson950619

Can you please print and tell the package version ?conda list``genno

Dear Awais, Truly sorry about interruption to you. Could you please take a look for my conda list and other information about my message-ix version, which may take the errors to the process of the model. Thank you so much!

Robinson950619 avatar Oct 29 '22 01:10 Robinson950619

Anyone here?Could some talent people help me solve this issue?@_@

Robinson950619 avatar Oct 31 '22 11:10 Robinson950619

Could someone HELP me solve this problem?

Anyone here?

Please carefully read this notice in our GitHub Discussions forum.

khaeru avatar Nov 02 '22 08:11 khaeru

I also have the same problem in my new installation. It could be related to the mapping between GAMS and IXMP but I don't know yet. But in any case, you can still report the results from the GDX output file, which you can find the name from the GAMS output in powershell terminal.

gorkemgungormetu avatar Nov 09 '22 08:11 gorkemgungormetu

@gorkemgungormetu can you please perhaps provide information that was requested of the user, but not provided: what version of genno do you have installed?

khaeru avatar Nov 09 '22 13:11 khaeru

Name Version Build Channel
genno 1.14.1 pyhd8ed1ab_0 conda-forge

gorkemgungormetu avatar Nov 10 '22 05:11 gorkemgungormetu

Hi @Robinson950619, @khaeru, and @gorkemgungormetu, I am also fairly new in the messageix world. I have faced the exact same error message as @Robinson950619. I checked my 'genno' module and I am using the same version as @gorkemgungormetu.

Tried downgrading it to 1.14.0 with the expectation that it could be a bug in the most recent release. But unluckily, this did not do the trick. Any suggestions?

ebbekyhl avatar Nov 14 '22 17:11 ebbekyhl

@Robinson950619 have you tried "from ixmp.reporting import Reporter" instead of "from message_ix.reporting import Reporter". As I understand, the message_ix.reporting is built on the ixmp and genno. It might thus have some features that are missed when using the ixmp command instead. I can see that this causes some errors in the plotting, e.g., "rep.get("plot activity")" leads to a computation error (It might be that the temporal information, e.g., dispatch is not included). Information such as deployed capacity, produced with "rep.get("plot capacity")", works fine. Please feel free to correct me, since I am still a newbie on message ;)

ebbekyhl avatar Nov 15 '22 12:11 ebbekyhl

Hi all - thanks for bearing with us on this. We believe that the issue is that the current version of message_ix available via pip and conda depend on a previous version of genno. Upstream changes in genno have been reflected on our current main, but break the tutorials in the installable versions. We will work to confirm this is the issue and then provide a new release.

In the mean time, our best current suggestion is to do one of two things:

  1. downgrade genno, e.g., pip install genno=1.11
  2. install message_ix from latest main, e.g., pip install git+https://github.com/iiasa/message_ix.git@main

gidden avatar Nov 17 '22 09:11 gidden

Hi All, thanks for the discussion. I would like to follow up on @gidden comment above. We did test various versions of genno, i.e., versions 1.11 - version 1.14, and it appears that only version 1.11 works. So, please downgrade genno to version 1.11 as @gidden mentioned above.

ywpratama avatar Nov 18 '22 09:11 ywpratama

Hello again. I downgraded genno to version 1.11 but this also uninstalled the genno-messageix compatibility module. So I downgraded message-ix to 3.4.0 which I believe re-installed the compatibility module and solved the issue. 👍

gorkemgungormetu avatar Nov 29 '22 08:11 gorkemgungormetu

These errors should not appear anymore with the latest versions of ixmp and message_ix, which will be 3.7.0 soon. Installing the corresponding release candidate for ixmp and the latest version of the main branch of message_ix, I am unable to reproduce the issue. The commands for that using pip are:

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ixmp==3.7.0rc1
pip install git+https://github.com/iiasa/message_ix.git@main

Checking the genno version reveals 1.16.0, while the output of message-ix show-versions is as follows:

ixmp:        3.7.0rc1
message_ix:  3.6.1.dev130+gec69b0b
message_ix_models: None
message_data: None

click:       8.1.3
dask:        2023.4.1
genno:       installed
graphviz:    0.20.1
jpype:       1.4.1
… JVM path:  /usr/lib/jvm/java-19-openjdk-amd64/lib/server/libjvm.so
openpyxl:    3.1.2
pandas:      2.0.1
pint:        0.21
xarray:      2023.4.2
yaml:        6.0

iam_units:   installed
jupyter:     1.0.0
matplotlib:  3.7.0
plotnine:    0.12.1
pyam:        1.8.0

GAMS:        41.5.0

python:      3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
python-bits: 64
OS:          Linux
OS-release:  5.19.0-41-generic
machine:     x86_64
processor:   x86_64
byteorder:   little
LC_ALL:      None
LANG:        en_US.UTF-8
LOCALE:      ('en_US', 'UTF-8')

glatterf42 avatar May 16 '23 07:05 glatterf42