question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to build on Alpine Linux 3.8

See original GitHub issue

Using python2 on Alpine linux

as a user (non-root)

Reproducing code example:

pip install numpy
pip install scipy

Error message:

Installing collected packages: scipy, scikit-learn, sklearn, beurre, w
  Running setup.py install for scipy: started
    Running setup.py install for scipy: still running...
    Running setup.py install for scipy: still running...
    Running setup.py install for scipy: finished with status 'error'
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-E_AGhj/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-YdFjWn/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    
    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:
    
      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install scipy`   (last SciPy release on PyPI)
    
    
    lapack_opt_info:
    lapack_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
      NOT AVAILABLE
    
    openblas_lapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
    customize UnixCCompiler
    C compiler: gcc -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -Os -fomit-frame-pointer -Os -fomit-frame-pointer -fPIC
    
    creating /tmp/tmpVN2XOG/tmp
    creating /tmp/tmpVN2XOG/tmp/tmpVN2XOG
    compile options: '-c'
    gcc: /tmp/tmpVN2XOG/source.c
    gcc /tmp/tmpVN2XOG/tmp/tmpVN2XOG/source.o -L/usr/lib -lopenblas -o /tmp/tmpVN2XOG/a.out
    customize UnixCCompiler
      FOUND:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    
      FOUND:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    
    Running from scipy source directory.
    Splitting linalg.interpolative Fortran source files
    /home/builder/.local/lib/python2.7/site-packages/numpy/distutils/system_info.py:716: UserWarning: Specified path /home/builder/.local/include/python2.7 is invalid.
      return self.get_paths(self.section, key)
    blas_opt_info:
    blas_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
      NOT AVAILABLE
    
    blis_info:
    customize UnixCCompiler
      libraries blis not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
      NOT AVAILABLE
    
    openblas_info:
    customize UnixCCompiler
    customize UnixCCompiler
    customize UnixCCompiler
      FOUND:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    
      FOUND:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    
    non-existing path in 'scipy/signal/windows': 'tests'
    non-existing path in 'scipy/sparse': 'sparsetools/sparsetools_impl.h'
    non-existing path in 'scipy/sparse': 'sparsetools/bsr_impl.h'
    non-existing path in 'scipy/sparse': 'sparsetools/csc_impl.h'
    non-existing path in 'scipy/sparse': 'sparsetools/csr_impl.h'
    non-existing path in 'scipy/sparse': 'sparsetools/other_impl.h'
    [makenpz] scipy/special/tests/data/boost.npz not rebuilt
    [makenpz] scipy/special/tests/data/gsl.npz not rebuilt
    [makenpz] scipy/special/tests/data/local.npz not rebuilt
    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building py_modules sources
    creating build
    creating build/src.linux-x86_64-2.7
    creating build/src.linux-x86_64-2.7/scipy
    building library "dfftpack" sources
    building library "fftpack" sources
    building library "mach" sources
    building library "quadpack" sources
    building library "lsoda" sources
    building library "vode" sources
    building library "dop" sources
    building library "fitpack" sources
    building library "fwrappers" sources
    building library "odrpack" sources
    building library "minpack" sources
    building library "rootfind" sources
    building library "superlu_src" sources
    building library "arpack_scipy" sources
    building library "sc_c_misc" sources
    building library "sc_cephes" sources
    building library "sc_mach" sources
    building library "sc_amos" sources
    building library "sc_cdf" sources
    building library "sc_specfun" sources
    building library "statlib" sources
    building extension "scipy.cluster._vq" sources
    building extension "scipy.cluster._hierarchy" sources
    building extension "scipy.cluster._optimal_leaf_ordering" sources
    building extension "scipy.fftpack._fftpack" sources
    creating build/src.linux-x86_64-2.7/scipy/fftpack
    creating build/src.linux-x86_64-2.7/scipy/fftpack/src
    conv_template:> build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.c
    conv_template:> build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.c
    f2py options: []
    f2py: scipy/fftpack/fftpack.pyf
    Reading fortran codes...
    	Reading file 'scipy/fftpack/fftpack.pyf' (format:free)
    Post-processing...

# ...
    /usr/bin/gfortran -Wall -g -Wl,--as-needed build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/fortranobject.o -L/usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../lib -L/usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../lib -L/usr/lib -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so -Wl,--version-script=build/temp.linux-x86_64-2.7/link-version-scipy.fftpack._fftpack.map
    /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../lib/Scrt1.o: In function `_start_c':
    /home/buildozer/aports/main/musl/src/musl-1.1.19/crt/crt1.c:17: undefined reference to `main'
    collect2: error: ld returned 1 exit status
    /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../lib/Scrt1.o: In function `_start_c':
    /home/buildozer/aports/main/musl/src/musl-1.1.19/crt/crt1.c:17: undefined reference to `main'
    collect2: error: ld returned 1 exit status
    error: Command "/usr/bin/gfortran -Wall -g -Wl,--as-needed build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/fortranobject.o -L/usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../lib -L/usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../lib -L/usr/lib -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so -Wl,--version-script=build/temp.linux-x86_64-2.7/link-version-scipy.fftpack._fftpack.map" failed with exit status 1
    

Scipy/Numpy/Python version information:

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-E_AGhj/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-YdFjWn/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-E_AGhj/scipy/

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

13reactions
vallardcommented, Aug 8, 2019

I made this work for my alpine docker image with:

apk add --no-cache cmake gcc libxml2 \
       automake g++ subversion python3-dev \
       libxml2-dev libxslt-dev lapack-dev gfortran 

then it made scipy with pip install scipy Note that I’m using python3.7 here instead of python2 and I also installed a few more packages with pip so there may be some you don’t need. So YMMV.

0reactions
roldancommented, May 15, 2020

Hi @vallard which version of python/alpine you used to build the image?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker alpine image fails to build because of HDF5 and tables
I am building a Docker image based on alpine linux. During build I get the error when installing tables that I have no...
Read more >
Alpine Linux: Failed at the mediasoup@3.8.0 postinstall script
I just tried build docker image on native Ubuntu-20.04 host, not Mac, but still get the same error, My Dockerfile: FROM ubuntu:20.04 AS...
Read more >
Upgrading Alpine - Alpine Linux Wiki
The output of the above command should say 'OK'. If says 'FAILED', delete the iso file and download it again. If using Alpine...
Read more >
Using Alpine can make Python Docker builds 50× slower
Alpine Linux is often recommended as a smaller, faster Docker base image. ... FROM python:3.8-alpine RUN apk --update add gcc build-base ...
Read more >
Docker Compose release notes
Release notes for Docker Compose. ... Added Compose version 3.8. ... Fixed a bug where build context URLs would fail to build on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found