Skip to content

["scip.exe", "--version"] timed out after 1 second #3064

Closed
@mihsamusev

Description

Summary

A proper and feasible linear model solves ok with scip but on a rare occasion a subprocess error of a kind subprocess.TimeoutExpired: Command [".../scip.exe", "--version"] timed out after 1 second error is thrown. If it is possible to reach the solver within given 1 second the rest of the interaction with solver and problem results are correct every single time.

Steps to reproduce the issue

Very hard to reproduce, but it seems to be affected by how many python processes are re-using scip and whether the os is busy running some other heavy task like Teams Video call.

Error Message

File "C:\Users\MyUser\miniconda3\envs\ramiro\Lib\site-packages\my_library\model_wrapper\pyomo_model_wrapper.py", line 123, in __solve_chunks
results: SolverResults = factory.solve(model, tee=True)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\site-packages\pyomo\opt\base\solvers.py", line 533, in solve
self.available(exception_flag=True)
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\site-packages\pyomo\opt\solver\shellcmd.py", line 135, in available
ans = self.executable()

^^^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\site-packages\pyomo\opt\solver\shellcmd.py", line 206, in executable
else self._default_executable()

^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\site-packages\pyomo\solvers\plugins\solvers\SCIPAMPL.py", line 77, in _default_executable
self._known_versions[executable_path] = self._get_version(

^^^^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\site-packages\pyomo\solvers\plugins\solvers\SCIPAMPL.py", line 104, in _get_version
results = subprocess.run(

^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\subprocess.py", line 550, in run
stdout, stderr = process.communicate(input, timeout=timeout)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\subprocess.py", line 1209, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MyUser\miniconda3\envs\some_project\Lib\subprocess.py", line 1628, in _communicate
raise TimeoutExpired(self.args, orig_timeout)
subprocess.TimeoutExpired: Command '['C:\\Users\\MyUser\\miniconda3\\envs\\some_project\\Library\\bin\\scip.exe', '--version']' timed out after 1 seconds

Information on your system

Pyomo version: 6.6.0
Python version: 3.11
Operating system: Windows 11
How Pyomo was installed (PyPI, conda, source): pip install Pyomo==6.6
Solver (if applicable): SCIP 8.1.0 installed by conda install -c conda-forge scip

Additional

Tried the same problem on GLPK solver and it doesnt seem to call the above mentioned subprocess first before calling the solver executable. No matter how busy is the OS.

Here it is i believe, timeout set 1:

def _get_version(self, solver_exec=None):
"""
Returns a tuple describing the solver executable version.
"""
if solver_exec is None:
solver_exec = self.executable()
if solver_exec is None:
return _extract_version('')
results = subprocess.run(
[solver_exec, "--version"],
timeout=1,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
return _extract_version(results.stdout)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions