Deploying SCIP solver in streamlit

Sorry, I’m stumped. All of the solutions I can find either suggest conda, which doesn’t seem to be working, or download and building the solver yourself (which you can’t do on Community Cloud). Sorry I couldn’t help more – maybe someone else will be able to. If you do find an answer, please post it here for others who may have the same issue.

Hi @blackary thanks a lot for your efforts. I am changing my approach towards solving this problem. I am now creating a local application which runs the streamlit application after double clicking a file. Can you guide how can I make a streamlit app run from either a python/exe file or a batch file.

I tried developing the below run.py but it doesn’t work always.

from subprocess import Popen, PIPE, STDOUT
import os
import time
import webbrowser
import sys

path_to_main = os.path.join(os.path.dirname(file), “streamlit_app.py”)

executable = sys.executable
process = Popen([“streamlit”, “run”, path_to_main,

“–server.port=8501”,
“–server.headless=true”,
“–global.developmentMode=false”
],
stdin=PIPE,
stdout=PIPE,
stderr=STDOUT,
text=True,
shell=True)

time.sleep(5)
webbrowser.open(r’http://localhost:8501’)

That seems like it should work reasonably well. I made a simplified example of that script and it worked fine when I ran it with python

import time
import webbrowser
from pathlib import Path
from subprocess import check_output

path_to_main = Path(__file__).parent / "streamlit_app.py"

out = check_output(["streamlit", "run", str(path_to_main), "--server.port", "8501"])
print(out)

time.sleep(1)
webbrowser.open("http://localhost:8501/")

If you’re looking to make it into an executable, you should check out this post and see how others have accomplished this Streamlit Deployment as an Executable File (.exe) For Windows MacOS And Android

Hi @blackary this code runs and I am able to create an exe using pyinstaller/cx_freeze which opens on my local system. But it gives an error while running from other systems. Is streamlit needed to be installed on any system for the exe to work correctly? Really stuck on this. Will be really helpful if we can do a quick call to solve this issue. I was not able to follow the nativefier method given in your link. It could be since the app itself was not deployed in Streamlit cloud.

Hi @akhileshgarude, sorry for the slow response. I’m afraid I wouldn’t be much help with any pyinstaller questions, as I haven’t used it before. You will need to have streamlit installed on your other machines that run this, but I would imagine it would be installed along with the exe. One guess is that your script might not be finding the streamlit binary, so you may need to change the command to ["python", "-m", "streamlit", "run" ...], but that’s just a guess.

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