Skip to content

Requesting FreeBSD support for Python library #2105

Closed

Description

What language and solver does this apply to?

Python

Describe the problem you are trying to solve.

I would like to be able to easily install ortools on FreeBSD using pip.

Describe the solution you'd like

I would like to be able to write pip install ortools on FreeBSD and have ortools be installed.

Currently, running pip install ortools produces the following output on FreeBSD 12.1 STABLE:

Collecting ortools
  ERROR: Could not find a version that satisfies the requirement ortools (from versions: none)
ERROR: No matching distribution found for ortools

Describe alternatives you've considered

Approach 1:

I've tried installing the py3-ortools Python package via pip install py3-ortools.

However, running:

python3.7
from ortools.linear_solver import pywraplp

Produces error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/ortools/linear_solver/pywraplp.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: Shared object "libc.so.6" not found, required by "_pywraplp.so"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/ortools/linear_solver/pywraplp.py", line 21, in <module>
    _pywraplp = swig_import_helper()
  File "/usr/local/lib/python3.7/site-packages/ortools/linear_solver/pywraplp.py", line 20, in swig_import_helper
    return importlib.import_module('_pywraplp')
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywraplp'

Approach 2:

I've tried to build the library from source on FreeBSD (which required the installation of cmake and gcc, the latter to avoid build errors related to dependencies).

The procedure was (in a Vagrant FreeBSD image):

pkg install python37 py37-pip gcc cmake swig git
git clone https://github.com/google/or-tools
cd or-tools
CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ cmake -DBUILD_DEPS=ON -DBUILD_PYTHON=ON .

The build succeeds.

Unfortunately, the following does not work for some reason (perhaps there are build steps that I am missing):

cd python/Release
pip install .
python3.7
import ortools

Which produces the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'ortools'

Ideally one could just write pip install ortools and avoid the above entirely, just like on all the other major operating systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions