Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Lambda: File not found #218

Open
paulalex opened this issue Nov 11, 2024 · 6 comments
Open

AWS Lambda: File not found #218

paulalex opened this issue Nov 11, 2024 · 6 comments
Assignees
Labels
active bug something broken regression this used to work TNG related to next-generation architecture

Comments

@paulalex
Copy link

I have been using plotly and kaleido for generating reports in AWS lambda for well over a year now and its suddenly erroring on the report generation:

[ERROR] FileNotFoundError: [Errno 2] No such file or directory: '/home/sbx_user1051/.kaleido-qp0_looo'

I do not reference /home anywhere and previously was not seeing this error. Is there any way I can override the use of /home, I fixed tempfiles temp dir to /tmp but this still does not stop the error. I do not understand why this has started happening out of the blue.

@ayjayt
Copy link
Collaborator

ayjayt commented Nov 11, 2024

Hi @paulalex, did you recently upgrade kaleido? There is a prelease version of kaleido out that might cause this error but you would only get it if you used pip install --pre kaleido, it is not "officially" launched yet. Let me know what version you are using, it sounds like you are using a release candidate.

That said, I really appreciate this error report. The problem is that ubuntu/snap is now segmenting temporary files by process so that /tmp no longer behaves as expected, nor can be used to share data between processes. I will try to improve the error output, but if you would like to continue using the new version please show me the line of code you use to call kaleido and I will help you enable debugging so I can see more context. Thank you!

@ayjayt ayjayt self-assigned this Nov 11, 2024
@ayjayt ayjayt added bug something broken P1 needs immediate attention regression this used to work sev-1 blocker TNG related to next-generation architecture active and removed P1 needs immediate attention sev-1 blocker labels Nov 11, 2024
@ayjayt
Copy link
Collaborator

ayjayt commented Nov 11, 2024

Furthermore, @paulalex, the old version pulled in chromium on install but the new version asks you to install it yourself. Another reason you might stay with the old version, but the new version will ultimately be significantly faster for generating many images which may save you money on AWS Lambda.

We can also add an override for the tempfile path (/tmp will again not work with snap) early this week on the new version.

@paulalex
Copy link
Author

@ayjayt Tomorrow I will get the production image from ECR and login in locally so I can print all of the dependencies out, I re-ran an existing report on prod and it built fine, so this is currently only happening in dev so I assume its dependency related.

I did try pinning to some versions at the top of the stack for Kaleido and plotly to see if it was as simple as the last version but that didn't work so I will need to dig deeper but I will report back with my findings tomorrow.

Thanks for the reply.

@paulalex
Copy link
Author

paulalex commented Nov 12, 2024

@ayjayt, I have looked at the requirements.txt file which is inside the container (generated from a pip file) and it has the following dependencies for kaleido and plotly:

kaleido==0.2.1
plotly==5.24.1;

However the dev environment image has the following dependencies (exactly as you assumed):

kaleido==0.4.0rc5
plotly==5.24.1

My pip file does have allow_prereleases = true so I could fix this by setting this to false and I am testing now with fixed dependencies and also this property set to false. I would prefer not to have to pin to versions (irrespective of whether I do not allow pre releases) but I am unsure of the best path forwards right now, if you have any advice around how to successfully upgrade it would be much appreciated.

@ayjayt
Copy link
Collaborator

ayjayt commented Nov 12, 2024

Hi! I think we will have some other options for you by tomorrow, maybe EOD today.

@ayjayt
Copy link
Collaborator

ayjayt commented Nov 15, 2024

@paulalex, a new version of kaleido was pushed- it is not a rc so unless you pin, all your systems will use it. This version of kaleido requires chrome to be installed separately.

It now tries to detect if the user is using canonical's snap- and if they are not it does normal /tmp instead of /home/$USER/.tmpdir. However, there is also now a KALEIDO_TMP_PATH environmental variable which can override all other logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
active bug something broken regression this used to work TNG related to next-generation architecture
Projects
None yet
Development

No branches or pull requests

2 participants