Skip to content

Improve cross-platform development setup (solver path handling + dependency conflict)#11

Open
parthdagia05 wants to merge 1 commit intoOSeMOSYS:masterfrom
parthdagia05:fix/cross-platform-dev-setup
Open

Improve cross-platform development setup (solver path handling + dependency conflict)#11
parthdagia05 wants to merge 1 commit intoOSeMOSYS:masterfrom
parthdagia05:fix/cross-platform-dev-setup

Conversation

@parthdagia05
Copy link

Closes #10

Improve Cross-Platform Development Setup (macOS/Linux)

Overview

This PR addresses two issues encountered while attempting to run MUIO from source on macOS (Apple Silicon):

  1. Hard-coded solver paths for non-Windows systems prevented standard macOS/Linux installations from working.
  2. An incompatible dependency pin in requirements.txt prevented clean installation in a fresh virtual environment.

Together, these issues block cross-platform development workflows. This PR resolves both while preserving existing Windows behavior.


1. Cross-Platform Solver Path Resolution

Problem

OsemosysClass.py previously defined solver directories using OS-specific hard-coded paths for non-Windows systems (e.g., glpk-4.65/w64, Cbc-2.10-osx10.15-x86_64-gcc9/bin).

These paths:

  • Do not match standard macOS/Linux installations
  • Are not compatible with Apple Silicon
  • Assume bundled solver binaries that are not present in the repository
  • Prevent running the application from source without manual modification

Solution

Solver path resolution has been centralized in Config.py with the following priority:

  1. Environment variable override:
    • MUIO_GLPK_PATH
    • MUIO_CBC_PATH
  2. Windows default (existing behavior preserved)
  3. PATH-based discovery for macOS/Linux using:
shutil.which("glpsol")
shutil.which("cbc")

- Centralize solver path resolution in Config.py
- Add PATH-based discovery for GLPK and CBC on macOS/Linux
- Preserve existing Windows behavior
- Add environment variable overrides (MUIO_GLPK_PATH, MUIO_CBC_PATH)
- Fix urllib3 version conflict in requirements.txt (compatible with botocore)

This enables running MUIO from source on macOS/Linux and resolves
dependency installation failure in a clean virtual environment.

Refs OSeMOSYS#10
parthdagia05 pushed a commit to parthdagia05/MUIO that referenced this pull request Feb 25, 2026
…m fixes

- Config.py: anchor all paths to PROJECT_ROOT via __file__ (CWD-independent)
- app.py: use Config.WebAPP_PATH for template/static dirs, clean startup banner
- OsemosysClass.py: 3-tier solver resolution (env var → PATH → bundled fallback)
- SyncS3.py + UploadRoute.py: replace hardcoded backslash with os.sep
- SyncS3.py + UploadRoute.py: guard against None in S3 list_objects_v2
- CustomThreadClass.py: propagate exceptions from background threads
- Base.Class.js: use window.location.origin for API URL resolution
- Osemosys.Class.js: guard null casename in getData/getResultData
- index.html: comment out missing wijmo licence.js
- Config.py: fix EmissionActivityRatio typo ('e''t' → 'e','t')
- setup.sh: cross-platform setup script (venv, deps, GLPK/CBC via Homebrew)

Closes OSeMOSYS#3, OSeMOSYS#8, OSeMOSYS#12, OSeMOSYS#25, OSeMOSYS#34, OSeMOSYS#39, #43, #45
Supersedes PRs: OSeMOSYS#11, OSeMOSYS#13, OSeMOSYS#28, OSeMOSYS#31, OSeMOSYS#32, OSeMOSYS#35, OSeMOSYS#40, #44, #46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve cross-platform development setup (solver path handling + dependency conflict)

1 participant