PyPSA / pypsa-usa

PyPSA-USA: An Open-Source Energy System Optimization Model for the United States
https://pypsa-usa.readthedocs.io
MIT License
60 stars 23 forks source link

EFS file extraction error, unable to extract zip format #466

Open huainie opened 3 weeks ago

huainie commented 3 weeks ago

Checklist

The Issue

I was using the command“Snakemake-j1-- configfile config/config.default.yaml” when I found that the EFS file could not be decompressed and wanted to know what to do with it

Steps To Reproduce

No response

Expected Behavior

No response

Error Message

[Thu Oct 31 00:37:18 2024]
Error in rule retrieve_nrel_efs_data:
    jobid: 22
    output: data/nrel_efs/EFSLoadProfile_Reference_Moderate.csv
    log: logs/retrieve/retrieve_efs_Reference_Moderate.log (check log file(s) for error details)

RuleException:
CalledProcessError in file C:\Windows\System32\pypsa-usa\workflow\rules/retrieve.smk, line 71:
Command 'D:/Miniconda/envs/pypsa-usa/python.exe "C:\Windows\System32\pypsa-usa\workflow\.snakemake\scripts\tmpvztggb_a.retrieve_databundles.py"' returned non-zero exit status 1.
  File "C:\Windows\System32\pypsa-usa\workflow\rules/retrieve.smk", line 71, in __rule_retrieve_nrel_efs_data
  File "D:\Miniconda\envs\pypsa-usa\Lib\concurrent\futures\thread.py", line 58, in run
Removing output files of failed job retrieve_nrel_efs_data since they might be corrupted:
data/nrel_efs/EFSLoadProfile_Reference_Moderate.csv
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake\log\2024-10-30T231010.703325.snakemake.log

Anything else?

No response

huainie commented 3 weeks ago

Additional error information: EFSLoadProfile_Reference_Moderate.csv: Unsupported ZIP compression method (9: deflation-64-bit)

trevorb1 commented 3 weeks ago

Hey @huainie; thanks for reporting! What OS are you using? Windows? If you are on windows, I would suggest running PyPSA-USA via WSL (this is what I do). Im not sure we have any regular developers using Windows, so this may just be a Windows specific bug. Sorry for the hassle!

ktehranchi commented 3 weeks ago

@samdotson you found a fix for this on windows correct? Could you share what you did?

huainie commented 2 weeks ago

@trevorb1 Yes, I use windows @ktehranchi Yes, I solved the problem by finding the unzipped part of the code that uses Python's zipfile module to handle all the zipped files instead of relying on the system command tar. The original decompression method could not handle DEFLATE64.

huainie commented 2 weeks ago

I replaced the system command tar with Python's zipfile module to handle it

samgdotson commented 1 week ago

I solved the issue by installing 7 Zip and replacing the tar system command with 7z. Worked like a charm. The only challenge is that it depends on users having 7z installed (which could be added to the instructions). Or I could add a snakemake rule to install check for 7z and install it if not found.