Description: Improve Cross-Platform Development Setup (macOS/Linux)
Closes #10
Summary
This PR addresses two primary blockers for running MUIO from source on non-Windows platforms (specifically macOS/Apple Silicon and Linux). It refactors solver path resolution to move away from hard-coded Windows-centric paths and fixes a dependency conflict that prevented clean environment builds.
Changes
1. Dynamic Solver Path Handling
Refactored OsemosysClass.py and Config.py to move away from hard-coded, platform-specific directory strings.
Resolution Priority Logic:
- Environment Variables: Checks for
MUIO_GLPK_PATH or MUIO_CBC_PATH (useful for custom CI/CD or container setups).
- Windows Defaults: Preserves existing behavior using
SOLVERs_FOLDER if on Windows.
- System Discovery: On macOS/Linux, it now uses
shutil.which() to find glpsol or cbc in the user's $PATH (e.g., Homebrew or APT installs).
Technical Impact:
- No import-time crashes if solvers are missing.
- Runtime
RuntimeError provides clear feedback if a solver is called but not found.
- Full support for Apple Silicon via system-installed binaries.
2. Dependency Resolution Fix
Fixed a ResolutionImpossible error during pip install -r requirements.txt.
- Conflict:
botocore required urllib3 < 1.27, but requirements.txt pinned urllib3==2.2.1.
- Fix: Downgraded pin to
urllib3==1.26.18. This satisfies all current project dependencies and allows for clean virtual environment creation.
Manual Verification (macOS Apple Silicon)
Tests conducted on macOS 14.x (M1 Pro) in a fresh Python 3.9 environment.
- Installation:
pip install -r requirements.txt now completes without errors.
- Discovery: * Installed
glpk and cbc via Homebrew.
- Verified
Config.GLPK_PATH and Config.CBC_PATH correctly resolve to /opt/homebrew/bin and /opt/homebrew/opt/cbc/bin respectively.
- End-to-End: * Successfully launched the app via
python API/app.py.
- Triggered model execution from the UI; solvers executed correctly via the new path resolution logic.
- Verified output results were generated without permission or path errors.
Backward Compatibility
- Windows: The logic specifically preserves the existing
Path(SOLVERs_FOLDER, ...) structure. Windows users and existing .exe build workflows are unaffected.
- Logic: No changes were made to the actual solver execution arguments, only the directory resolution.
✅ Checklist
Description: Improve Cross-Platform Development Setup (macOS/Linux)
Closes #10
Summary
This PR addresses two primary blockers for running MUIO from source on non-Windows platforms (specifically macOS/Apple Silicon and Linux). It refactors solver path resolution to move away from hard-coded Windows-centric paths and fixes a dependency conflict that prevented clean environment builds.
Changes
1. Dynamic Solver Path Handling
Refactored
OsemosysClass.pyandConfig.pyto move away from hard-coded, platform-specific directory strings.Resolution Priority Logic:
MUIO_GLPK_PATHorMUIO_CBC_PATH(useful for custom CI/CD or container setups).SOLVERs_FOLDERif on Windows.shutil.which()to findglpsolorcbcin the user's$PATH(e.g., Homebrew or APT installs).Technical Impact:
RuntimeErrorprovides clear feedback if a solver is called but not found.2. Dependency Resolution Fix
Fixed a
ResolutionImpossibleerror duringpip install -r requirements.txt.botocorerequiredurllib3 < 1.27, butrequirements.txtpinnedurllib3==2.2.1.urllib3==1.26.18. This satisfies all current project dependencies and allows for clean virtual environment creation.Manual Verification (macOS Apple Silicon)
Tests conducted on macOS 14.x (M1 Pro) in a fresh Python 3.9 environment.
pip install -r requirements.txtnow completes without errors.glpkandcbcvia Homebrew.Config.GLPK_PATHandConfig.CBC_PATHcorrectly resolve to/opt/homebrew/binand/opt/homebrew/opt/cbc/binrespectively.python API/app.py.Backward Compatibility
Path(SOLVERs_FOLDER, ...)structure. Windows users and existing.exebuild workflows are unaffected.✅ Checklist