MimiDICE2010.get_model() PyError Excel xlsx file not supported

Hi – when I try to run:

m = MimiDICE2010.get_model()

I get the following error:

m = MimiDICE2010.get_model()
ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\Users\TTAN\.julia\packages\PyCall\BcTLp\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'xlrd.biffh.XLRDError'>
XLRDError('Excel xlsx file; not supported')
  File "C:\Users\TTAN\.julia\conda\3\lib\site-packages\xlrd\__init__.py", line 170, in open_workbook
    raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
Stacktrace:
 [1] pyerr_check at C:\Users\TTAN\.julia\packages\PyCall\BcTLp\src\exception.jl:62 [inlined]
 [2] pyerr_check at C:\Users\TTAN\.julia\packages\PyCall\BcTLp\src\exception.jl:66 [inlined]
 [3] _handle_error(::String) at C:\Users\TTAN\.julia\packages\PyCall\BcTLp\src\exception.jl:83

All that I have done before this is run “using MimiDICE2010”. I have followed all the steps in the tutorial before this, and have also tried uninstalling and reinstalling Julia. Would appreciate any assistance!

Hi - This looks like a problem with PyCall, which can be a bit of a pain but I’m sure we can figure it out. Am I correct that this is the code that you ran?

pkg> add MimiDICE2010

and then

using MimiDICE2010
m = MimiDICE2010.get_model()

If that’s right, can you send me a screenshot, or the text, after typing the following?

pkg> st

That will show me what your environment looks like so I can compare it to what I expect to see.

Thanks so much! Yes, that is correct. The text after I run pkg> st is below:

(@v1.5) pkg> st
Status `C:\Users\TTAN\.julia\environments\v1.5\Project.toml`
  [c52e3926] Atom v0.12.28
  [e5e0dc1b] Juno v0.8.4
  [e4e893b0] Mimi v1.1.1
  [4f2c5d70] MimiDICE2010 v1.0.0
  [ab869bb0] MimiDICE2016 v0.1.0 `https://github.com/AlexandrePavlov/MimiDICE2016.jl#master`
  [b3ba11de] MimiFUND v3.12.0
  [e25d4f70] MimiPAGE2009 v4.0.1

Hi @tammyt123, after some digging I think you found a bug introduced by a change to our Excel Reading dependency package … which was introduced on December 11th, so nice find! I noticed this in my testing the other day and had planned to get back to it post-holidays.

Short story is I think I can fix quickly and can get back to you as soon as I do! You will likely see this for all DICE models and RICE, but I will fix all four ASAP.

By the way, I saw you said you tried uninstalling and reinstalling Julia, a classic turn it off and turn it back on approach true to my heart :slight_smile:. If you keep working with Julia, I have found the following to be useful resets that are in the same vein but less extreme:

  1. Try just updating gall the packages in your environment with
up

2 Try cleaning up your environment and then reinstalling packages, which is just first using

pkg> rm <pkg_name>

and then once you’ve deleted the problematic packages, or all packages, add them back with

pkg> add <pkg_name>

and then run up for good measure

pkg> up
  1. If those two fail, there are options like deleting the folder of precompiled packages (deleting folders is always a little dangerous though you have to know what you’re doing) or re-installing Julia

You don’t have to take that advice it’s just what’s worked for me!

1 Like

Alright @tammyt123 you should be set to go. For now you will need to add the master branch of the model since we haven’t tagged a new one, but we will do so after Christmas and I’ll ping you then. Same story for all MimiDICE packages and MimiRICE.

To grab the master branch instead of the latest tagged version type:

pkg> add MimiDICE2010#master

I’d also just recommend using

pkg> rm <pkg_name>

to clear out your environment and start fresh with the code below for good measure.

pkg> add Mimi
pkg> add MimiDICE2010#master

Please don’t hesitate to reach out if you hit a snag, don’t muddle through alone :slight_smile:

Thanks so much for your help with this! I just tried

pkg> rm <pkg_name>
pkg> add Mimi
pkg> add MimiDICE2010#master
pkg> up

Then ran

using Mimi
using MimiDICE2010
m = MimiDICE2010.get_model()

and am still getting the same error… Am I missing something? My environment looks like this:

[c52e3926] Atom v0.12.28
[e5e0dc1b] Juno v0.8.4
[e4e893b0] Mimi v1.1.1
[4f2c5d70] MimiDICE2010 v1.0.1-DEV https://github.com/anthofflab/MimiDICE2010.jl.git#master
[ab869bb0] MimiDICE2016 v0.1.0 https://github.com/AlexandrePavlov/MimiDICE2016.jl#master
[b3ba11de] MimiFUND v3.12.0
[e25d4f70] MimiPAGE2009 v4.0.1

MimiDICE2016 seems to be working, though!

Oh that’s odd ok let me dig into this now. Just to be clear, when you called pkg> rm which packages did you remove, MimiDICE2010 and Mimi?

Also we have now tagged a new version of MimiDICE2016 with this patch so you can use the latest tagged version, to revert to this in your environment please type:

pkg> free MimiDICE2016

Thanks so much! I actually got

m = MimiDICE2010#master.get_model()

to run, but then when I run the next line

run(m)

it gives me the following error

> ERROR: MethodError: no method matching run(::Module)

Similarly, with

update_param!(m, :fco22x, 3.000)

I get

ERROR: MethodError: no method matching update_param!(::Module, ::Symbol, ::Float64)
Closest candidates are:
  update_param!(::Mimi.AbstractCompositeComponentDef, ::Symbol, ::Any; update_timesteps) at C:\Users\TTAN\.julia\packages\Mimi\mHt54\src\core\connections.jl:480
  update_param!(::Mimi.ModelInstance, ::Symbol, ::Any) at C:\Users\TTAN\.julia\packages\Mimi\mHt54\src\core\connections.jl:484
  update_param!(::Mimi.ComponentReference, ::Symbol, ::Any) at C:\Users\TTAN\.julia\packages\Mimi\mHt54\src\core\references.jl:21

Am I doing something incorrectly? I ran using Mimi and using MimiDICE2010#master beforehand and tried pkg> up, removing and re-adding the packages as you suggested above.

Really appreciate the help!

Oh, I apologize I should have been more clear but this is good news! When you typed

pkg> add MimiDICE2010#master

you instructed your environment to pull down the master branch of MimiDICE2010 as opposed to the latest tagged version, that is the intension for the #master suffix. When you do that, you set up your environment so that whenever you use the MimiDICE2010 package, under the hood it will remember to use the #master version. This page of Julia documentation should be helpful if you’re curious, 3. Managing Packages · Pkg.jl, but as I’ll state below it is not necessary for initial use of Mimi and MimiDICE.

You do not need to use this suffix in your normal coding, since when you run the code it will pick up whichever version of the package your environment instructs under the hood. Thus, you can still use:

using Mimi
using MimiDICE2010
m = MimiDICE2010.get_model()
run(m)
update_param(m, :fco22x, 3.000)

I apologize for throwing you in the deep end with environments, the include extra concepts and vocabulary, and are something you will need to pick up if you work on development in Julia but if not there’s no need to get tangled in it now. I moved quickly to provide you access before we officially tagged a version, but as soon as we tag a new version I’ll let you know, you can type pkg> free MimiDICE2010, and never worry about this #master business again!

Oh, wonderful, thanks so much! I only tried using the suffix because I was still getting the original error without it, but I’ve just tried again using a different text editor and it seems to be working now…!

However, now I’m getting an error when I try to add MimiDICE2016

ERROR: The following package names could not be resolved:
 * MimiDICE2016 (not found in project, manifest or registry)

I tried pkg> up and pkg> free MimiDICE2016 as well, the latter gave the same error. My environment looks like this:

(@v1.5) pkg> st
Status `C:\Users\TTAN\.julia\environments\v1.5\Project.toml`
  [c52e3926] Atom v0.12.28
  [e5e0dc1b] Juno v0.8.4
  [e4e893b0] Mimi v1.1.1
  [4f2c5d70] MimiDICE2010 v1.0.1-DEV `https://github.com/anthofflab/MimiDICE2010.jl.git#master`
  [b3ba11de] MimiFUND v3.12.0
  [e25d4f70] MimiPAGE2009 v4.0.1

Not sure if I’m doing something wrong again? So sorry for all the questions and thank you so, so much for your help and patience!!

(I also tried add MimiDICE2016#master with the same result)

No apologies needed I enjoy helping and it’s my job! What editor are you using, out of curiosity? It’s odd and irritating that the error was sticking for you, I don’t like that! We can stay in touch if it gives you any more trouble.

Per MimiDICE2016 you aren’t doing anything wrong, I get the same error, I think the author (this one is third party developed so I have a little less control) needs to carry out a few steps that I will be in touch with him about. If you need it I can give you a workaround, but for simplicity I’d just wait for now while I sort that out with him :slight_smile:.

Got it, thank you so much! I was using Atom, but I’ve switched to VSCode now. Really appreciate all of this :slight_smile:

Oh great, yes I think work on Atom is slowing or stopping in regards to Julia but VSCode is full steam ahead and what our team uses so I’d suggest using that one so we can be the most helpful!

Fantastic, thanks so much!

As an aside – as you can probably tell, I’m quite new to all of this and am trying to familiarise myself with the models / framework / mechanics by working through the tutorials. Do you think this is the best way to learn it all, or otherwise do you have any suggestions / advice on what you think the best method is, or anything else that you think would be important / helpful to read / do to boost my understanding? I mainly just want to avoid blindly running lines of code without really knowing why I’m doing it / how it all fits together. Thanks so much in advance once again!

** More specifically, also, is there somewhere that lays out the definitions of the model parameters / variables? e.g. things like t2xco2

In terms of learning the Mimi framework itself, starting with the tutorials is a great way to go. They are learning-oriented, aimed at providing instructions for well-constrained problems without overwhelming you too much with options. The How-To guides problem-oriented, aimed more at showing the options and process for common problems and tasks users face. These are probably a natural next step after tutorials if you’re still interested!

All of this documentation is aimed to help teach you about Mimi, but not integrated assessment models themselves. I’m not sure of your background or goals, but if you seek information on integrated assessment modeling or the specific models (FUND, DICE, etc.) then there are separate resources for those that I’m happy to suggest.

In terms of definitions of model parameters and variables, that information is quite model-specific. We are hoping to better integrate documentation of models into the Mimi platform, but for now it really varies by model. You can take a look at the academic literature, or Github homepages of the various models, available on our main homepage here: https://www.mimiframework.org. A starting point for some common models could be:

1 Like

Thank you so much for this! Really helpful and much appreciated.

Hi @tammyt123, we’ve now tagged the new versions of the models so you don’t need to have the master branch pinned anymore for DICE2010, or any of the models for that matter. When you go back to your code next, just type

pkg> free MimiDICE2010

and then if you type st Mimi you should then see something like

(@v1.5) pkg> st Mimi
Status `~/.julia/environments/v1.5/Project.toml`
  [e4e893b0] Mimi v1.1.1

Thanks so much Lisa! I just ran the code and it seems to be working. Will DICE2016 be available soon also? No rush, just wondering / for my information. Much appreciated once again!

@tammyt123 this will be interesting to you and happy to hear feedback: PSA: Changing the Time Dimension

Per DICE2016 good question let me circle back to the group on that!