spine-tools / SpineOpt.jl

A highly adaptable modelling framework for multi-energy systems
https://www.tools-for-energy-system-modelling.org/
GNU General Public License v3.0
57 stars 13 forks source link

LoadError: MethodError: no method matching getindex(::Module, ::String #833

Closed asashishh closed 10 months ago

asashishh commented 10 months ago

I tried to run the simple systems and two hydro plants tutorials and getting the following error in both cases.

LoadError: MethodError: no method matching getindex(::Module, ::String)

datejada commented 10 months ago

Hi,

Would you mind sending the complete error log that appears in the Julia console?

Thanks!

asashishh commented 10 months ago

spineopt error

This is the complete error log. Thanks

datejada commented 10 months ago

Thanks @asashishh So, the error is in SpineInterface, which means that it might be a parameter in the input data that it is causing the problem.

Could you upload your input data file as JSON? You can do that by clicking on the export option in the Spine DB Editor, as shown in the following screenshots. Then, I can run it locally and see the problem easily.

thanks!

image image image
asashishh commented 10 months ago

simple system input.json two hydro plants input.json

Thanks @datejada. Here are the input files for both the cases.

Thanks!

datejada commented 10 months ago

@asashishh I was able to run both examples using the following versions of SpineOpt and SpineInterface

image

In addition, I'm using the SPineToolbox version 0.7.0.

Can you double-check the versions you have installed in your OS? And can you confirm which OS you are using?

In any case, the hydro example shows another error when running, but I am unfamiliar with that example/tutorial. It might need an update in the documentation, but I'm unsure. I'll debug it more and let you know if I find the problem.

asashishh commented 10 months ago

@datejada I am using the Microsoft windows 11 as my OS. I was using the latest version. Spine status

I forced update the spinetoolbox again as per the given instructions in the installation manual. Now I faced the following error. spinetoolbox error

I searched to solve this error and found that making the following change in the pendulum.py module will solve the error.

Replace this _IS_PENDULUM_2 = ( hasattr(pendulum, "version") and getattr(packaging.version.parse(pendulum.version), "major") == 2 )

with _IS_PENDULUM_2 = ( hasattr(pendulum, "version") and getattr(packaging.version.parse(pendulum.version), "major") >= 2 )

With this change the spinetoolbox command do work but still has the same error that I initially mentioned while i try to run any of the tutorial.

datejada commented 10 months ago

@asashishh, I was able to reproduce your error. I noticed you are using Julia v1.10.0, which was released the day after Christmas. So, we haven't had the opportunity to test SpineInterface and SpineOpt in that version. I did it today, and it failed for v 1.10.0. If I use the Julia version 1.8.5, it works as I have shown in a previous reply. So, in the meantime, please install Julia v1.8.5 while we fix it to work on the latest Julia release. You can change the Julia executable in SpineToolbox in the File->Settings menu as follows (notice that you will need to install again SpineInterface and SpineOpt for that Julia version):

image

Please let me know if that finally works.

datejada commented 10 months ago

@asashishh, actually, you might have the same problem using v1.8.5. I was able to reproduce the error when installing SpineInterface and SpineOpt from the registry, point 3.a here:

https://github.com/spine-tools/SpineOpt.jl?tab=readme-ov-file#installation

It seems that there is a problem with the registered versions (I'll create a separate issue for that problem).

However, if you install SpineOpt and SpineInterface using the procedure in point 3.b, it works even for Julia v1.10.0:

image

Please follow this procedure, and hopefully, that will finally solve the problem.

Let me know if it works

asashishh commented 10 months ago

@datejada I came across this. Please let me know if I should try or wait till this pendulum issue is resolved.

https://github.com/spine-tools/Spine-Toolbox/issues/2474

Thanks!

datejada commented 10 months ago

@asashishh, you mentioned that you have found a workaround for that issue, didn't you? If so, then try the installation procedure in point 3.2, since I think there are different issues. Thanks!

asashishh commented 10 months ago

@datejada , Indeed I found the workaround for that issue. I will try the installation with the procedure mentioned in 3.2.

Thanks!

clizbe commented 10 months ago

@datejada Can you please summarize the error and steps so whoever picks this up has an easy guide? :)

clizbe commented 10 months ago

Great! Closing this as redundant. See #835