Or-tools: Add support for Alpine

Created on 14 Jul 2018  路  7Comments  路  Source: google/or-tools

It does not seems like it is possible to install the ortools on Alpine.
Is it possible to add support for that?

FROM python:3-alpine

RUN pip install ortools
Step 2/2 : RUN pip install ortools
 ---> Running in 2cf3452ad8a8
Collecting ortools
  Could not find a version that satisfies the requirement ortools (from versions: )
No matching distribution found for ortools
The command '/bin/sh -c pip install ortools' returned a non-zero code: 1

Feature Request Linux

Most helpful comment

I'll try to do it on my free time once I finish my docker rework !
Should be easy to add alpine docker image.

Alpine is good but never use it, except to create a port for assimp

All 7 comments

I'll try to do it on my free time once I finish my docker rework !
Should be easy to add alpine docker image.

Alpine is good but never use it, except to create a port for assimp

Is it possible, though? I'm trying to get or-tools running on an alpine distro, and it seems like ortools is trying to call to dlvsym, causing an error:

Traceback (most recent call last):
  File "/root/.local/lib/python3.6/site-packages/ortools-6.8.5510-py3.6-linux-x86_64.egg/ortools/linear_solver/pywraplp.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: Error relocating /root/.local/lib/python3.6/site-packages/ortools-6.8.5510-py3.6-linux-x86_64.egg/ortools/linear_solver/../../ortools/.libs/libortools.so: dlvsym: symbol not found

dlvsym is a glibc specific extension, which unfortunately is not implemented in musl libc, the C standard library used by alpine. From dlvsym man page

Glibc extensions: dladdr() and dlvsym()
Glibc adds two functions not described by POSIX, with prototypes

I've been trying a number of workarounds, but I've been unable to get it to work, so any ideas are welcome.

ortools is a python native library, and like you figure out alpine is based on libmusl not glibc that's why they are binary incompatible

You may be interested on https://github.com/pypa/manylinux/issues/37
TLDR: python native package for alpine is not supported by Pypi.org :cry:

Sorry won't fix on our side.
We welcome PR though.

Maybe this is the reason of there is no whl for or-tools https://pythonspeed.com/articles/alpine-docker-python/
in this article, we find out alpine is not the best choice to dockerize python based projects

we do have alpine docker to test python and all other languages, we simply don't upload the wheel package to pypi yet...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mlk621 picture mlk621  路  3Comments

KeremAslan picture KeremAslan  路  3Comments

karomad picture karomad  路  3Comments

frodrigo picture frodrigo  路  5Comments

jack-zalora picture jack-zalora  路  5Comments