The Mondrian Map project includes cross-platform scripts to launch the Streamlit application with automatic port management and error handling.
- ✅ Automatic port detection and conflict resolution
- ✅ Cleanup of existing Streamlit processes
- ✅ Dependency checking (Streamlit installation)
- ✅ User-friendly error messages
# Make sure the script is executable (should already be set)
chmod +x scripts/run_streamlit.sh
# Run the application
./scripts/run_streamlit.shCleaning up any existing Streamlit processes...
Port 8501 is in use, trying next port...
Port 8502 is in use, trying next port...
Starting Streamlit on port 8503
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8503
Network URL: http://192.168.1.100:8503
External URL: http://your-ip:8503
- ✅ Automatic port detection and conflict resolution
- ✅ Cleanup of existing Streamlit processes
- ✅ Dependency checking (Streamlit installation)
- ✅ User-friendly error messages
REM Run from the project root directory
scripts\run_streamlit_win.batCleaning up any existing Streamlit processes...
Port 8501 is in use, trying next port...
Starting Streamlit on port 8502
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8502
If Streamlit is not installed, you'll see:
[ERROR] Streamlit is not installed. Please run: pip install -r config/requirements.txt
Solution: Install dependencies
pip install -r config/requirements.txtThe scripts automatically find the next available port starting from 8501.
If you get permission denied:
chmod +x scripts/run_streamlit.shTo modify the starting port, edit the script:
Unix/macOS (scripts/run_streamlit.sh):
# Change this line:
local port=8501
# To your preferred starting port:
local port=9000Windows (scripts/run_streamlit_win.bat):
REM Change this line:
set PORT=8501
REM To your preferred starting port:
set PORT=9000Both scripts bind to 0.0.0.0 to allow network access. To restrict to localhost only, change:
Unix/macOS:
streamlit run apps/streamlit_app.py --server.port $PORT --server.address 127.0.0.1Windows:
streamlit run apps/streamlit_app.py --server.port %PORT% --server.address 127.0.0.1- Check permissions (Unix/macOS):
ls -la scripts/ - Check Streamlit installation:
streamlit --version - Check Python environment:
python --version
- Check dependencies:
pip install -r config/requirements.txt - Check data files: Ensure
data/directory exists - Check logs: Look for error messages in the terminal
If ports are still in use after cleanup:
# Unix/macOS - Find and kill processes
lsof -ti:8501 | xargs kill -9
# Windows - Find and kill processes
netstat -ano | findstr :8501
taskkill /PID <PID_NUMBER> /FThe urllib3 warning about LibreSSL is expected on macOS and doesn't affect functionality:
NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'
This is resolved by using urllib3 v1.26.18 in our requirements.
The application includes security features:
- Only
.csvfiles with safe names are accepted - Required columns are validated:
GS_ID,wFC,pFDR,x,y - Invalid files are rejected with user-friendly warnings
- Scripts bind to all interfaces (
0.0.0.0) by default - For production, consider restricting to localhost (
127.0.0.1) - Use a reverse proxy (nginx, Apache) for production deployments
Add to .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Mondrian Map",
"type": "shell",
"command": "./scripts/run_streamlit.sh",
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "new"
},
"problemMatcher": []
}
]
}- Go to Run → Edit Configurations
- Add Shell Script configuration
- Set script path to
scripts/run_streamlit.sh - Set working directory to project root
Use the scripts as-is for local development.
For production deployment:
- Use a process manager (systemd, supervisor)
- Set up a reverse proxy
- Use environment variables for configuration
- Consider using Docker for containerization
If you encounter issues with the scripts:
- Check this documentation
- Look at the error messages
- Verify your Python environment
- Check GitHub Issues for similar problems