-
Notifications
You must be signed in to change notification settings - Fork 271
Detect SCIP installation in conda environment if SCIPOPTDIR is not defined #1103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")): |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :)