This version is mostly stable, but with several users it can perform unexpectedly!
This version runs well, and is extremely fast!
"Virtual Environments" are in effect small computing worlds on your computer. They allow you to run special sets of tools in a way that keeps them isolated from all other programs. Different programs require different 'dependencies', and different versions of these dependencies. So keeping them separate is a good idea.
If you are new to virtual environments, one good solution is to manage environments is with Anaconda Navigator. Download it for your machine for free. Learn more about Anaconda Navigator.
Here are the steps:
- A. Click "+ create" at the bottom of Navigator
- B. Name it (anything you like, but perhaps "crim_streamlit")
- C. On the Python dialogue, select "3.10.13" or any version that starts with "3.10"
- D. Click "create" in the dialogue, and wait a minute or two . .
Now you will need to create a dedicated folder on your computer where you will keep the code for the CRIM Intervals Streamlit application.
- Make a new folder in the Documents folder on your machine. You can name it as you like, but something simple like "CRIM Streamlit Code" will do.
- You will not be editing any of the files here, but instead you will sync this folder to an online repository on GitHub. Don't worry, this won't put anything strange on your computer!
- Make sure you know where to find this folder, since you will need to point to it in the next step
-
Make sure that the new environment you created is the active one (see image).
-
Click on the arrow next your enviroment and select Open Terminal
- This will create an interactive 'Terminal' session, through which you can write commands to your computer that will download the code you need.
- You should see something like this, with the name of your environment, followed by the name of your computer, all followed by a symbol and space for your cursor:
(CRIM_Streamlit_Code) rfreedma@rfreedma-22 ~ %
- Now you will first need to make sure you have the 'git' code that will allow you to request code from github. Install it by pasting the following into your terminal:
conda install git
- This will in turn ask you to confirm that you want to install this software. Type y for 'yes'.
- You will see the code install and then something to confirm success, like the following:
- Now find the new project folder (which we will call a 'directory') you created in Step 3 above. We will enter the 'path' to that directory in the terminal, preceeded by "cd", like this:
cd Documents/Projects/MyProject
- Your path might look like this:
/Users/rfreedma/Documents/CRIM_Python/intervals-streamlit
- The whole command would be (remember ONE space between 'cd' and the path to your folder!)
cd /Users/rfreedma/Documents/CRIM_Python/intervals-streamlit
Type that into the Terminal and press enter. Now the terminal command prompt should include the name of your directory:
-
Now you will issue the command to 'clone' the code and put it in your Project Folder. Don't worry, you can always delete this, and it will have no effect on any other software on your computer!
-
At the terminal prompt paste in the following (remember just one space between each element), and press Enter/Return:
git clone https://github.com/RichardFreedman/intervals-streamlit.git
- This should only take a few seconds, but you will see the following confirmation:
- If you want to see the files, simply type 'ls' (which will list all the files)
- Now you need to install the various dependencies that make Streamlit and CRIM Intervals work together.
- First we need to 'change directory' into the folder you just installed. Copy and paste this into your terminal, then Enter/Return:
cd intervals-streamlit
- And now install the various
requirements
. Copy and paste the following into your terminal, and then Enter/Return:
pip install -r requirements.txt
- There will be a lot of activity for a minute or two as all the libraries are installed. But eventually you will return to the command prompt. But meanwhile you might see this:
- Congratulations, you are ready to run Streamlit!
- At the command prompt in the terminal, type the following:
streamlit run intervals_streamlit2.py
- After a brief 30 seconds or so, Streamlit should start in a browser window.
- The terminal will also show you the local IP address to use to access the application.
-
When you are finished you can simply close your browser window, and quit Anaconda Navigator and the Terminal application
-
If you want to restart another time you will need to:
- Open Anaconda Navigator
- Click on your Virtual Environment to activate it
- Open Terminal (as shown above at the start of Step 4)
- 'Change Directory' to your project folder (see above) using 'cd' and the rest of the path to your folder as you did in Step 6
- Remember to 'cd intervals-streamlit' so you are inside the correct sub-folder!
- Start the Streamlit App as shown in step 9