- D. Pintossi, February 2022 -
Repository for the Chemical Engineering problem session of Thursday February 17, 2022. We will use Python and Streamlit to create an interactive web app based on the content of Fabian's problem session (stoichiometry in gas-liquid reactions).
The resulting web app is hosted here.
To edit and run Python code, we will use an integrated development environment (IDE). To install PyCharm Community Edition, head to its website and download the installer.
To manage Python packages (pre-built, open-source code) and virtual environements, we use Conda. To use Conda, install Anaconda Individual Edition from here.
PyCharm should guide you to create a project when first opened. If that is not the case, choose File from the menu, then New Project....
Keep the default location, unless you have a valid reason to change it, and choose the project name (the folder will have the same name).
Note that you do not want a main.py file to be automatically created, as the folder should be empty to clone the repository from GitHub.
In the PyCharm GUI, check the menu at the top. Click on Git and from the dropdown menu choose Clone....
Alternatively, if Git is not displayed, you will find VCS and from the dropdown menu you have to choose Get from VCS....
Use the following URL:
https://github.com/Noel-Research-Group/Streamlit-problem-session.git
and set the directory to be the one of the project you created.
When you are done, you should see new files appearing. No new files showing up? Pat pat, there there.
At the top, choose File --> Settings. In the window that opens, select Project: blah blah and then Python Interpreter from the list on the left (you should see something like the image below).
Click on the gear icon, select Conda Environment, leave everything as it is, except the Python version, which we set to be 3.9 (see image below).
OK your way back to the underlying IDE. It may take a moment for the environment to fully set up (loading bar at the bottom).
At the bottom, choose the Terminal tab. Write the following code and hit enter.
pip install -r requirements.txt
To verify that it worked, run the following command.
conda list
If numpy, pandas, matplotlib, scipy, and streamlit are showing up in the list of packages, you are good to go.
Go to the Terminal tab at the bottom of the PyCharm CE graphical user interface and run the following command:
streamlit run Streamlit_GUI.py
A browser window (or a new tab) should open with the Streamlit app in it. To terminate the execution, go back to the Terminal and press ctrl+C.

