OSeMOSYS / osemosys_global

A global power system model generator for OSeMOSYS
https://osemosys-global.readthedocs.io/
GNU Affero General Public License v3.0
27 stars 14 forks source link

[BUG] Error in rule demand_projections #141

Closed JdtMg closed 1 year ago

JdtMg commented 1 year ago

Conda environment check

Current Behavior

I tried after installing everything to run de first example. It gave the following error. I am not a programmer so I'm not sure what this means or how I could fix the issue, if it is my fault.

Error in rule demand_projections: jobid: 12 input: resources/data/PLEXOS_World_2015_Gold_V1.1.xlsx, resources/data/iamc_db_GDPppp_Countries.xlsx, resources/data/iamc_db_POP_Countries.xlsx, resources/data/iamc_db_URB_Countries.xlsx, resources/data/iamc_db_POP_GDPppp_URB_Countries_Missing.xlsx, resources/data/T&D Losses.xlsx output: results/data/SpecifiedAnnualDemand.csv, results/data/../figs/Demand projection South America.jpg, results/data/../figs/Demand projection Oceania.jpg, results/data/../figs/Demand projection North America.jpg, results/data/../figs/Demand projection Europe.jpg, results/data/../figs/Demand projection Asia.jpg, results/data/../figs/Demand projection Africa.jpg log: results/data/logs/demand_projections.log (check log file(s) for error message) conda-env: /home/name/osemosysglobal/.snakemake/conda/4f4ef365f72db9e6e4de8cabb894bff4 shell: python workflow/scripts/osemosys_global/OPG_demand_projection.py 2> results/data/logs/demand_projections.log (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Expected Behavior

No response

Steps To Reproduce

No response

Operating System

WSL Ubuntu

Log output

No response

Anything else?

No response

maartenbrinkerink commented 1 year ago

Hi @JdtMg. Inside your osemosys_global folder, could you open the results/data/logs/demand_projections.log file and copy paste the content of it in this thread so we can have a look what the problem is?

JdtMg commented 1 year ago

Let me know if this is what you were asking for.

Traceback (most recent call last): File "/home/name/osemosys_global/workflow/scripts/osemosys_global/OPG_demand_projection.py", line 12, in from sklearn.linear_model import LinearRegression ModuleNotFoundError: No module named 'sklearn'

maartenbrinkerink commented 1 year ago

Thanks. It seems the sklearn package is not being read properly which can happen for a number of reasons.

To start with, I see that you have checked the 'I have tried using the osemosys-global conda environment.' box when starting the issue. This means you've also successfully installed and loaded the environment as discussed in step 5. of the installation tutorial? https://osemosys-global.readthedocs.io/en/latest/installation.html

In WSL when my directory is set to the osemosys-global folder and the environment is installed and activated the command line looks something like the below, is that the same for you?

(osemosys-global) /mnt/c/users/user/osemosys_global$

JdtMg commented 1 year ago

Yes, when my directory is set to the osemosys-global the command line looks the same. I had been doing the commands on the Ubuntu for Windows app. I retried it on the cmd after launching WSL there in the hopes that that might be the cause of the issue somehow, nevertheless, the issue persisted. I ran snakemake twice and it finished a couple of jobs on each run (9 & 10 on the first run; 11, 13 & 14 on the second), but the program stopped when it tried to run job 12, the one mentioned above. I tried a third time, and on this occasion, it only ran and stopped on job 12 again.

trevorb1 commented 1 year ago

Hi @JdtMg ! Can you try installing sklearn manually through conda to see if that solves the issue? This can be done through the command conda install -c conda-forge scikit-learn while in your osemosys-global environment.

JdtMg commented 1 year ago

Hi, the workflow finished successfully! Thanks a lot for the help.