App not deployed

Hi, I deployed my app and since then, it’s still “baking”. Can someone please tell me why it’s not yet deployed?

Here is the code on my GitHub page

I have tried to no avail to deploy it. It’s saying something like ‘sample.pdf’ is not found. But it’s there already. Also, I have deleted and redeployed the app. The problem still continues. Pls help!

datetime is a built-in library. Try removing it from your requirements file, then rebooting your app to make sure you get a clean start from scratch.

Thanks for the suggestions @mathcatsand . However, I tried it but the problem continues. Everything was working well on my local server even without the sample.pdf. I’m not supposed to add a PDF file because the user will have to generate it. Still, I added it. No way. why then is it having issues?

I have deleted and redeployed twice already.

The relevant pieces for deployment are the environment setup files. If there’s any problem with the Python code, it would be a different error message that comes up after your environment is built (i.e. “baked”).

Please can you copy the contents of the terminal after a clean reboot so we know where it is in the process? I’ve never used reportlab, so maybe there is a helpful message about a needed dependency.

@mathcatsand Here is the log message I think it’s causing the error. I don’t understand what it’s saying:

ERROR: Could not find a version that satisfies the requirement base64 (from versions: none)
ERROR: No matching distribution found for base64
WARNING: You are using pip version 22.0.3; however, version 22.3.1 is available.
You should consider upgrading via the '/home/appuser/venv/bin/python -m pip install --upgrade pip' command.
Checking if Streamlit is installed

────────────────────────────────────────────────────────────────────────────────────────

[09:33:00] ❗️ installer returned a non-zero exit code
[09:33:00] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.
[09:34:37] ❗️ Streamlit server consistently failed status checks
[09:34:37] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.
[09:35:46] 🐙 Pulling code changes from Github...
[09:35:47] 📦 Processing dependencies...

─

My pip is already the latest version but I think base64 is inbuilt library, why then is it complaining of base64

Here is another one @mathcatsand

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/dynamic_invoice_generator/pdf_invoice.py", line 204, in <module>
    with open('sample.pdf', 'rb') as pdf_file:
FileNotFoundError: [Errno 2] No such file or directory: 'sample.pdf'
2023-01-13 10:48:31.435 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/dynamic_invoice_generator/pdf_invoice.py", line 204, in <module>
    with open('sample.pdf', 'rb') as pdf_file:
FileNotFoundError: [Errno 2] No such file or directory: 'sample.pdf'
[19

That message was not displayed on my local computer as the code have to process and generate the PDF, making it available for displaying and downloading.

I don’t know what else is the problem.

Your local environment will have nothing to do with the cloud deployment. The warning about updating pip can be ignored, in general.

You will get errors if you include built-in libraries in your requirements file. I see that base64 was in a previous version of your requirements file, but it’s currently removed, so I assume this error is no longer coming up.

So now we have an error processing your Python code, which means it got past building the environment. We can walk through it stepwise. In your code, right above where you call the show_pdf function, you can insert a Debian command to check if the file is there from the system’s perspective:

if submit:
    # generate the pdf
    generate_pdf()
    
    ls = os.popen('ls').read()
    st.markdown(ls.replace('\n','  \n'))

    # display and download the pdf when prompted
    show_pdf()

Can you confirm that the extra lines does print on your page that ‘sample.pdf’ is there?

@mathcatsand Yeah, it does display the ‘sample.pdf’ as well as all the other files in the current directory, thus confirming that ‘sample.pdf’ is there.

Can you try referring to the file as ./sample.pdf in your code instead of sample.pdf to see if that changes anything?

By the way, I copied your show_pdf function and deployed it and I don’t get an error about my example pdf not being found. (I do hit a different problem I’ve seen before where Chrome/Edge block the embed, but Firefox is fine.)

I’m really not sure why you’d get an error that there is “no such file” when you can confirm with ls that it is there…

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.