" would require ZIP64 extensions") LargeZipFile: Filesize would require ZIP64 extensions

Viewed 3821

can you please help me sort this error, I am getting an error when I try to write a large file is there any way to fix this error:

File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 1696, in _writecheck
    " would require ZIP64 extensions")

LargeZipFile: Filesize would require ZIP64 extensions

this is the stacktrace


  File "<ipython-input-1-211b07c43cd8>", line 1, in <module>
    runfile('C:/Users/Administrator/Desktop/new_paul.py', wdir='C:/Users/Administrator/Desktop')

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
    execfile(filename, namespace)

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Administrator/Desktop/new_paul.py", line 106, in <module>
    output_df = gen_stats()

  File "C:/Users/Administrator/Desktop/new_paul.py", line 104, in gen_stats
    return merge_main(all_users)

  File "C:/Users/Administrator/Desktop/new_paul.py", line 99, in merge_main
    all_users.to_excel('main_with_features_300win.xlsx', index=False)

  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py", line 2127, in to_excel
    engine=engine)

  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\formats\excel.py", line 664, in write
    writer.save()

  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel.py", line 1952, in save
    return self.book.close()

  File "C:\ProgramData\Anaconda3\lib\site-packages\xlsxwriter\workbook.py", line 306, in close
    self._store_workbook()

  File "C:\ProgramData\Anaconda3\lib\site-packages\xlsxwriter\workbook.py", line 679, in _store_workbook
    xlsx_file.write(os_filename, xml_filename)

  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 1743, in write
    with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:

  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 1470, in open
    return self._open_to_write(zinfo, force_zip64=force_zip64)

  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 1580, in _open_to_write
    self._writecheck(zinfo)

  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 1696, in _writecheck
    " would require ZIP64 extensions")

LargeZipFile: Filesize would require ZIP64 extensions

3 Answers

The flag allowZip64=True needs to be passed when initializing a ZipFile to allow it to store files larger than 4GB, or to be larger than 4GB itself.

Presumably this is something that needs to be fixed in whatever library you're using that implements to_excel. You didn't include that library's identity in your question, so we can't speak to it here.

Building on the analysis from @Charles Duffy you can enable ZIP64 extensions with the xlsxwriter engine like this:

writer = pd.ExcelWriter('pandas.xlsx', engine='xlsxwriter')

df.to_excel(writer, sheet_name='Sheet1')

writer.book.use_zip64()

I had a similar error in my Python 2.7 script that exports spatial tables from Sql Server to shapefile format and then compress it. Adding 'allowZip64=True' as a parameter worked:

zipObj = zipfile.ZipFile(nomZip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True)
Related