Skip to content

Conversation

@mmghannam
Copy link
Member

@mmghannam mmghannam commented Nov 5, 2025

To make it a bit easier to develop pyscipopt for some people. Including me :)

@mmghannam mmghannam changed the title Detect Scip installation in conda environment if SCIPOPTDIR is not de… Detect Scip installation in conda environment if SCIPOPTDIR is not defined Nov 5, 2025
@mmghannam mmghannam changed the title Detect Scip installation in conda environment if SCIPOPTDIR is not defined Detect SCIP installation in conda environment if SCIPOPTDIR is not defined Nov 5, 2025
@Joao-Dionisio
Copy link
Member

I assume you tested this, so all good on my end! Just bringing copilot over, just in case.

@Joao-Dionisio Joao-Dionisio requested a review from Copilot November 5, 2025 18:36
Copy link
Contributor

Copilot AI left a 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_PREFIX environment 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")):
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
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"))
):

Copilot uses AI. Check for mistakes.
@mmghannam
Copy link
Member Author

I assume you tested this, so all good on my end! Just bringing copilot over, just in case.

Yup tested against the latest conda package of scip 9.2.4

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.

3 participants