Detect SCIP installation in conda environment if SCIPOPTDIR is not defined#1103
Detect SCIP installation in conda environment if SCIPOPTDIR is not defined#1103Joao-Dionisio merged 2 commits intomasterfrom
Conversation
|
I assume you tested this, so all good on my end! Just bringing copilot over, just in case. |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the setup script to automatically detect and use conda environments when SCIPOPTDIR is not explicitly set, improving the installation experience for conda users.
- Added automatic conda environment detection via the
CONDA_PREFIXenvironment variable - Refactored the fallback installation logic to prioritize conda environments over global installations
- Cleaned up redundant platform checks for Windows
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| setup.py | Added conda environment detection logic and refactored the installation path resolution to check for conda first, then fall back to global installations |
| INSTALL.md | Added documentation explaining the new automatic conda environment detection behavior |
| CHANGELOG.md | Documented the new feature for conda environment detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # check if we're in a conda environment | ||
| conda_prefix = os.environ.get("CONDA_PREFIX", "").strip('"') | ||
|
|
||
| if conda_prefix and os.path.exists(os.path.join(conda_prefix, "include")): |
There was a problem hiding this comment.
The validation only checks for the existence of the include directory but not the lib directory. This could lead to setup failures later when the library path is used. Consider also validating that os.path.join(conda_prefix, 'lib') exists before committing to use the conda environment.
| if conda_prefix and os.path.exists(os.path.join(conda_prefix, "include")): | |
| if ( | |
| conda_prefix | |
| and os.path.exists(os.path.join(conda_prefix, "include")) | |
| and os.path.exists(os.path.join(conda_prefix, "lib")) | |
| ): |
Yup tested against the latest conda package of scip 9.2.4 |
To make it a bit easier to develop pyscipopt for some people. Including me :)