4

When i am trying to install Snappy on alpine linux using: pip install snappy I am getting the following error when it tries to install a required package called cypari.

I installed snappy from "apk add snappy"

    gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -fPIC -Ilibcache/pari64/include -I/usr/include/python2.7 -c cypari_src/_pari.c -o build/temp.linux-x86_64-2.7/cypari_src/_pari.o
In file included from cypari_src/_pari.c:460:0:
cypari_src/implementation.c:47:22: fatal error: execinfo.h: No such file or directory
 #include <execinfo.h>
dwardu
  • 573
  • 6
  • 22

4 Answers4

7

I solved this problem by running apk add libexecinfo libexecinfo-dev

Then using apk add snappy

Then using pip install python-snappy

if you use pip install snappy it installs a completely different library which is this

dwardu
  • 573
  • 6
  • 22
5

Combining previous answers, this minimal Dockerfile works for me

FROM python:3.6-alpine

RUN apk add --no-cache g++ snappy-dev && \
    pip install --no-cache-dir --ignore-installed python-snappy
redacted
  • 3,789
  • 6
  • 25
  • 38
  • 2
    Cool! BTW. `apk add --no-cache g++ snappy-dev` is enough as `snappy` being a dependency of `snappy-dev`. – lk_vc Dec 22 '20 at 08:08
  • Are g++ and snappy-dev required after installing python-snappy? I mean, can I remove them after installing python-snappy to reduce docker image size? – Ahmed Hammad Oct 14 '21 at 07:28
  • @AhmedHammad not sure, but you can try and let us know!:) – redacted Oct 14 '21 at 08:06
  • I tried it, but docker image size was not reduced! – Ahmed Hammad Oct 16 '21 at 09:44
  • How did you try it? maybe doing it in the same command? `apk add --no-cache g++ snappy-dev && \ pip install --no-cache-dir --ignore-installed python-snappy && apk del g++ snappy-dev` ? – redacted Oct 16 '21 at 09:48
0

Installing execinfo-dev suffice, since execinfo.h is in that package.

You can check it here:

http://pkgs.alpinelinux.org/contents?file=execinfo.h&path=&name=&branch=&repo=&arch=

apk add snappy

will install the package, so you don't need to:

pip install snappy
0

To expand on the answer from @dwardu, I also had to install the snappy-dev package. That fixed this error I was getting from pip install:

snappy-c.h: No such file or directory