ERGO-Code/HiGHS

explicitly add the numpy dependency in highspy pypi package

pchtsp opened this issue · 5 comments

When installing highs from the pypi repo (i.e., pip install highspy), the numpy is not installed. Even if it's needed to then run the library.

example on pulp's CI, where we need to install both to test highspy:

https://github.com/coin-or/pulp/blob/cfc898ecb5bb46fc40edd536a90bd327121b30c3/.github/workflows/pythonpackage.yml#L42-L43

I was looking for the setup file to compile the python package inside this repo to propose a PR but I do not find it.

Since numpy isn't needed by highspy, I'd rather not add the dependency.

What's your view @galabovaa ?

It's not needed? because I do get an error when trying to test the highspy when numpy is not installed. Where would the dependency come from?

to reproduce (tried in ubuntu but I assume it's the same with windows):

  1. clone pulp
git clone git@github.com:coin-or/pulp.git
  1. install highspy
pip install highspy
  1. run highspy tests
python -m unittest pulp.tests.test_pulp.HiGHS_PYTest
  1. I get:
======================================================================
ERROR: test_unset_objective_value__is_valid (pulp.tests.test_pulp.HiGHS_PYTest)
Given a valid problem that does not converge,
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pchtsp/Documents/projects/pulp/pulp/tests/test_pulp.py", line 1229, in test_unset_objective_value__is_valid
    pulpTestCheck(prob, self.solver, [const.LpStatusOptimal])
  File "/home/pchtsp/Documents/projects/pulp/pulp/tests/test_pulp.py", line 1618, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/home/pchtsp/Documents/projects/pulp/pulp/pulp.py", line 1872, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/home/pchtsp/Documents/projects/pulp/pulp/apis/highs_api.py", line 482, in actualSolve
    self.buildSolverModel(lp)
  File "/home/pchtsp/Documents/projects/pulp/pulp/apis/highs_api.py", line 355, in buildSolverModel
    lp.solverModel.addCol(
ModuleNotFoundError: No module named 'numpy'

Apologies, numpy is required by highspy and we will add it as an explicit requirement in the upcoming release.

Is this now in master @galabovaa ?

We have just pushed the latest pre-release version 1.7.1.dev1 to PyPi, including an explicit dependency on numpy.