I’m not able to install pyomo on Streamlit Sharing.
Anyone has the same experience?
Hi @Tianoklein1, welcome to the Streamlit community!!
I’m sorry to hear you’re having trouble installing pyomo on sharing. Could you please share any error message you’re getting? That will help us to reproduce it. A screenshot would help too!
I was able to successfully install pyomo by including
pyomo in my
requirements.txt file. The demo/example repo can be found here GitHub - snehankekre/pyomo-test: test
Note that in their documentation, there is a section about conditional dependencies:
Extensions to Pyomo, and many of the contributions in pyomo.contrib, also have conditional dependencies on a variety of third-party Python packages including but not limited to: numpy, scipy, sympy, networkx, openpxl, pyodbc, xlrd, pandas, matplotlib, pymysql, pyro4, and pint. Pyomo extensions that require any of these packages will generate an error message for missing dependencies upon use.
If you’re using pyomo extensions that require additional dependencies, do include them in your requirements file.
Sorry. My mistake.
I mean, GLPK is getting error to install on streamlitshare.
*> ```* *> Building wheel for glpk (PEP 517): finished with status 'error'* *> ```* *> * *> ```* *> ERROR: Command errored out with exit status 1:* *> ```* *> * *> ```* *> command: /home/appuser/venv/bin/python /home/appuser/venv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp3kc7jp2j* *> ```* *> * *> ```* *> cwd: /tmp/pip-install-6kkq8czv/glpk_3fefe17034aa403dbbe46999c8950ed1* *> ```* *> * *> ```* *> Complete output (14 lines):* *> ```* *> * *> ```* *> running bdist_wheel* *> ```* *> * *> ```* *> running build* *> ```* *> * *> ```* *> running build_ext* *> ```* *> * *> ```* *> building 'glpk' extension* *> ```* *> * *> ```* *> creating build* *> ```* *> * *> ```* *> creating build/temp.linux-x86_64-3.7* *> ```* *> * *> ```* *> creating build/temp.linux-x86_64-3.7/src* *> ```* *> * *> ```* *> gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER="0.4.6" -I/home/appuser/venv/include -I/usr/local/include/python3.7m -c src/glpk.c -o build/temp.linux-x86_64-3.7/src/glpk.o* *> ```* *> * *> ```* *> In file included from src/glpk.c:21:* *> ```* *> * *> ```* *> src/lp.h:24:10: fatal error: glpk.h: No such file or directory* *> ```* *> * *> ```* *> #include <glpk.h>* *> ```* *> * *> ```* *> ^~~~~~~~* *> ```* *> * *> ```* *> compilation terminated.* *> ```* *> * *> ```* *> error: command 'gcc' failed with exit status 1* *> ```* *> * *> ```* *> ----------------------------------------* *> ```*
I was able to reproduce the GLPK error on my personal Linux computer and on Streamlit sharing. The problem seems to be that the
glpk Python package requires some non-obvious apt-get dependencies. i.e
glpk requires additional software to be installed on sharing.
In particular, it requires
libgmp3-dev. To install both of them on Streamlit sharing, create a
packages.txt file in your repo with the following entries:
And include the following in your
Once you create the packages file and reboot your app, both
glpk will install successfully.
I’ve updated the demo repo with the required entries in the packages file: GitHub - snehankekre/pyomo-test: test
Thanks a lot @snehankekre !!!
Did you have any tips to user ipopt library too?