pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

Pyomo test-solvers errors

Open andregirard opened this issue 6 years ago • 7 comments

I have a working installation of Pyomo. I now want to install some solvers following the instructions at

https://pyomo.readthedocs.io/en/latest/installation.html#using-conda

I installed the standard solvers with

conda install -c conda-forge ipopt coincbc glpk
Collecting package metadata: done
Solving environment: done

Package Plan

  environment location: /home/andre/anaconda3

  added / updated specs:
    - coincbc
    - glpk
    - ipopt


The following packages will be UPDATED:

  glpk                      pkgs/main::glpk-4.65-h3ceedfd_2 --> conda-forge::glpk-4.65-ha14ba45_1001


Proceed ([y]/n)? 

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
``
I then run 
``
pyomo test-solvers
``
and get 
``
Traceback (most recent call last):
  File "/home/andre/anaconda3/bin/pyomo", line 11, in <module>
    sys.exit(main())
  File "/home/andre/anaconda3/lib/python3.6/site-packages/pyomo/scripting/pyomo_main.py", line 82, in main
    retval = _options.func(_options)
  File "/home/andre/anaconda3/lib/python3.6/site-packages/pyomo/opt/plugins/driver.py", line 31, in test_exec
    pyomo.solvers.tests.testcases.run_test_scenarios(options)
  File "/home/andre/anaconda3/lib/python3.6/site-packages/pyomo/solvers/tests/testcases.py", line 353, in run_test_scenarios
    rc = model_class.validate_current_solution(suffixes=model_class.test_suffixes)
  File "/home/andre/anaconda3/lib/python3.6/site-packages/pyomo/solvers/tests/models/base.py", line 205, in validate_current_solution
    with open(self.results_file,'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/andre/anaconda3/lib/python3.6/site-packages/pyomo/solvers/tests/models/LP_block.json'`

Sure enough, the file is not there

~/anaconda3/lib/python3.6/site-packages/pyomo/solvers/tests/models$ ls
base.py                    
LP_unique_duals.py
__init__.py                
LP_unused_vars.py
LP_block.py                
MILP_discrete_var_bounds.py
MILP_infeasible1.py
LP_constant_objective1.py  
MILP_simple.py
LP_constant_objective2.py  
MILP_unbounded.py
LP_duals_maximize.py       
MILP_unused_vars.py
LP_duals_minimize.py       
MIQCP_simple.py
LP_inactive_index.py       
MIQP_simple.py
LP_infeasible1.py          
__pycache__
LP_infeasible2.py          
QCP_simple.py
LP_piecewise.py            
QP_constant_objective.py
LP_simple.py               
QP_simple.py
LP_trivial_constraints.py  
SOS1_simple.py
LP_unbounded.py            
SOS2_simple.py

andregirard avatar Feb 12 '19 16:02 andregirard

I'm not sure what the test-solvers option does but if you just want to check which solvers are available to Pyomo, use the command:

pyomo help -s

blnicho avatar Feb 12 '19 17:02 blnicho

Test-solver seems to run some test on a set of problems to check the installation.

I have been able to use Pyomo to solve some simple problems so this is no longer an issue for me.

andregirard avatar Feb 14 '19 15:02 andregirard

I am reopening this. This is a definite issue with packaging in Pyomo. Clearly, the test-solvers command has never been used by anyone that did not work with a checkout of the pyomo source installed with setup-develop. I believe it is a relatively easy fix to setup.py to get it to include the necessary JSON files as part of the distribution.

In the future, we should revisit the design / utility of test-solvers to see if it is something that is really useful to users and if there is a better way to distribute the models/reference files to support things like this.

jsiirola avatar Feb 14 '19 20:02 jsiirola

@jsiirola - Are there any other JSON files that need to be included in the packaging? With the current setup.py configuration, there are no json, ui, or any other types of non-Python files being grabbed.

mrmundt avatar May 27 '20 18:05 mrmundt

Updating packaging is going to be involved, and will probably involve a PEP to define what should be included in, e.g., the wheels. I am not entirely sure that adding the testing data and baselines into the distribution is a good idea.

Separately, I just tried pyomo test-solvers with a checkout of master, and the tests failed with a missing LP_unbounded.json. This indicates that pyomo test-solvers doesn't work at all (and may not have worked for quite some time). This raises the question as to if the ultimate resolution of this specific issue is to remove the pyomo test-solvers sub-command entirely.

jsiirola avatar May 27 '20 20:05 jsiirola

Just want to add my vote to resolve this as well. I was trying to test SCIP which I built from source, and this error almost misdirected me towards worrying about whether I missed something while compiling.

misyntropy avatar Oct 08 '20 05:10 misyntropy

pyomo test-solvers has been broken for some time. We need to decide on a path forward.

blnicho avatar Sep 26 '23 19:09 blnicho