-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
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_PATHorMUIO_CBC_PATH(useful for custom CI/CD or container setups). - Windows Defaults: Preserves existing behavior using
SOLVERs_FOLDERif on Windows. - System Discovery: On macOS/Linux, it now uses
shutil.which()to findglpsolorcbcin the user's$PATH(e.g., Homebrew or APT installs).
Technical Impact:
- No import-time crashes if solvers are missing.
- Runtime
RuntimeErrorprovides 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:
botocorerequiredurllib3 < 1.27, butrequirements.txtpinnedurllib3==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.txtnow completes without errors. - Discovery: * Installed
glpkandcbcvia Homebrew.- Verified
Config.GLPK_PATHandConfig.CBC_PATHcorrectly resolve to/opt/homebrew/binand/opt/homebrew/opt/cbc/binrespectively.
- Verified
- 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.exebuild workflows are unaffected. - Logic: No changes were made to the actual solver execution arguments, only the directory resolution.
✅ Checklist
- Code follows the style guidelines of this project.
- I have performed a self-review of my own code.
- My changes generate no new warnings.
- Dependency versions have been tested for compatibility.
- Documentation/comments updated where necessary.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels