dash icon indicating copy to clipboard operation
dash copied to clipboard

dcc.Upload errors with big files

Open celia-lm opened this issue 1 year ago • 5 comments

Context

  • Creating an app where end users can upload files >1GB with dcc.Upload.
  • The app code is the same as the first sample app of the doc page: https://dash.plotly.com/dash-core-components/upload
  • max_size is set to -1

Issues

  • If I run the app with gunicorn or in my local env, some time after I upload the file the tab freezes or I get an internal server error (NOT a timeout because dcc.Upload has some kind of async functionality). > This is similar to what this issue describes: https://github.com/plotly/dash/issues/1728 Screenshot 2024-05-28 at 10 13 32
  • If I run the app with Python in a Dash Enterprise workspace, I get a callback error which is kind of weird. If you look at the callback code and the print statements in the terminal, we only get two values despite having three Inputs. The first one is probably an empty string or list, which causes the if statement to “fail” (since list_of_contents is not None), so the error we see is related to code after the if statement. The real problem is that, even if the filenames and dates get passed correctly, the content is empty > This issue has been described before in the forum: (https://community.plotly.com/t/upload-500mb-csv-but-content-is-empty/83297. Screenshot error
Screenshot callback code

Additional context

  • I've tried dash-uploader (link) and it works okay but I’m concerned about (1) privacy (all files are accessible by all users by default, as opposed to session-specific storage) and (2) memory (how does saving many big files affect the app memory/performance)
  • dash-uploader is not an official component and it’s not maintained, which raises some concerns regarding production environment.

Request

  • dcc.Upload being able to handle big files (500MB, >1GB, etc).
  • If the file is not been processed correctly (list_of_contents is empty) show a more helpful error.

celia-lm avatar May 28 '24 15:05 celia-lm

@celia-lm I suggest you use other upload components with rich features, cooperate with flask or fastapi streaming file upload service to achieve more efficient file upload function:

https://fac.feffery.tech/AntdUpload https://fac.feffery.tech/AntdDraggerUpload

CNFeffery avatar Jun 03 '24 08:06 CNFeffery

@CNFeffery I see you promoting the feffery-antd-components fairly often.

Are you able to translate those docs to English?

For example, in the comment above you suggest Celia use the AntdUpload, but it's all in a different language, which will make it very hard to understand how to use.

image

Coding-with-Adam avatar Jun 21 '24 14:06 Coding-with-Adam

@Coding-with-Adam That would be a huge project to translate so many documents, I suggest to use some browser translate extensions in current stage(such as https://immersivetranslate.com/ or other AI-driven tools), which we often use to translate English to other language.

CNFeffery avatar Jun 21 '24 14:06 CNFeffery

@Coding-with-Adam The official website of fac has begun developing features related to the internationalization of documentation. Currently, the documentation is being translated one by one. When users visit https://fac.feffery.tech/, the website will automatically recognize the language preference of the user's computer and render the content in Chinese or English accordingly. Users can also switch languages manually from the top right corner. For example: https://fac.feffery.tech/AntdButton. For the implementation principles and contribution guidelines of the internationalization of the fac official website, please refer to: https://github.com/CNFeffery/feffery-antd-docs/issues/166. image

CNFeffery avatar Aug 25 '24 01:08 CNFeffery

Like magic :) Thanks for the update, @CNFeffery . This automated translation is going to help a lot of community members.

Coding-with-Adam avatar Aug 27 '24 14:08 Coding-with-Adam