You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the following code to generate a multi worksheet excel file using ExcelWriter. This code is being run in a lambda function, which only has 500MB available in the /tmp folder so I've tried to create the file completely in memory. The issue arises when I try to create an excel file that is larger than about 100 MB.
The following error is returned when writer.close() is called
Traceback (most recent call last):\n File \"/opt/python/xlsxwriter/workbook.py\", line 320, in close\n self._store_workbook()\n File \"/opt/python/xlsxwriter/workbook.py\", line 685, in _store_workbook\n xml_files = packager._create_package()\n File \"/opt/python/xlsxwriter/packager.py\", line 135, in _create_package\n self._write_worksheet_files()\n File \"/opt/python/xlsxwriter/packager.py\", line 190, in _write_worksheet_files\n worksheet._assemble_xml_file()\n File \"/opt/python/xlsxwriter/worksheet.py\", line 3875, in _assemble_xml_file\n self._write_sheet_data()\n File \"/opt/python/xlsxwriter/worksheet.py\", line 5483, in _write_sheet_data\n self._write_rows()\n File \"/opt/python/xlsxwriter/worksheet.py\", line 5676, in _write_rows\n self._write_cell(row_num, col_num, col_ref)\n File \"/opt/python/xlsxwriter/worksheet.py\", line 5857, in _write_cell\n self._xml_number_element(cell.number, attributes)\n File \"/opt/python/xlsxwriter/xmlwriter.py\", line 137, in _xml_number_element\n self.fh.write(\"\"\"<c%s><v>%.16G</v></c>\"\"\" % (attr, number))\n File \"/var/lang/lib/python3.8/codecs.py\", line 721, in write\n return self.writer.write(data)\n File \"/var/lang/lib/python3.8/codecs.py\", line 378, in write\n self.stream.write(data)\nOSError: [Errno 28] No space left on device\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/var/task/src/forecasting/shape_tool/shape_tool_controller.py\", line 133, in generate_multi_shape\n output_file = service.generate_multi_mpan_shape(\n File \"/var/task/src/forecasting/forecasting_logging.py\", line 32, in wrapper_func\n obj = func(*args)\n File \"/var/task/src/forecasting/shape_tool/shape_tool_service.py\", line 520, in generate_multi_mpan_shape\n writer.close()\n File \"/opt/python/pandas/io/excel/_base.py\", line 898, in close\n content = self.save()\n File \"/opt/python/pandas/io/excel/_xlsxwriter.py\", line 198, in save\n return self.book.close()\n File \"/opt/python/xlsxwriter/workbook.py\", line 322, in close\n raise FileCreateError(e)\nxlsxwriter.exceptions.FileCreateError: [Errno 28] No space left on device"
I'm not sure what is causing the issue here. The error seems to be saying that it is trying to save the file to disk but there is no space, but this is what I was trying to avoid by creating the file completely in memory
Expected Output
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 67a3d42
python : 3.8.2.final.0
python-bits : 64
OS : Linux
OS-release : 4.4.0-17763-Microsoft
Version : #1432-Microsoft Mon Aug 18 18:18:00 PST 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
No - there's no changes to \tmp while the code runs. Have tried openpyxl but that has efficiency issues. It takes too long which causes the lambda function to time out and uses up all of the allocated memory. The file that is created for my test case shouldn't use up all the disk space as is - which makes me think there's something else going on.
Yes, this was the issue! I added {'in_memory': True} to my options dictionary and am no longer getting the error. Seems Pandas can already forward this option to xlsxwriter. Thanks for your help!
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
I'm using the following code to generate a multi worksheet excel file using ExcelWriter. This code is being run in a lambda function, which only has 500MB available in the /tmp folder so I've tried to create the file completely in memory. The issue arises when I try to create an excel file that is larger than about 100 MB.
The following error is returned when
writer.close()
is calledI'm not sure what is causing the issue here. The error seems to be saying that it is trying to save the file to disk but there is no space, but this is what I was trying to avoid by creating the file completely in memory
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 67a3d42
python : 3.8.2.final.0
python-bits : 64
OS : Linux
OS-release : 4.4.0-17763-Microsoft
Version : #1432-Microsoft Mon Aug 18 18:18:00 PST 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.4
numpy : 1.19.4
pytz : 2020.4
dateutil : 2.8.1
pip : 19.2.3
setuptools : 41.2.0
Cython : None
pytest : 6.1.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: