Skip to content

Instantly share code, notes, and snippets.

@diyan
Last active April 21, 2016 22:46
Show Gist options
  • Save diyan/359088144bb516740de8 to your computer and use it in GitHub Desktop.
Save diyan/359088144bb516740de8 to your computer and use it in GitHub Desktop.
Did a try to setup matplotlib for PyPy in Docker container with Ubuntu 14.04 to run Multi Mechanize load test tool

Did a try to setup matplotlib for PyPy in Docker container with Ubuntu 14.04 to run Multi Mechanize load test tool.

Good news: NumPy can be easily installed for PyPy.

Bad news: matplotlib failed to install most likely due lack of NumPy's C-API.

If anyone have workaround for building matplotlib for PyPy I would happy to get your suggestions.

Dockerfile

FROM ubuntu:14.04
MAINTAINER Alexey Diyan [email protected]

### OS. Apply Docker workarounds, update the APT cache
# http://crosbymichael.com/dockerfile-best-practices-take-2.html
ENV LC_ALL C.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'root:root' | chpasswd
RUN locale-gen en_US en_US.UTF-8

# Setup add-apt-repository tool and all deps to build matplotlib from sources
RUN apt-get update && apt-get install -y software-properties-common curl libfreetype6-dev libxft-dev libpng-dev g++
RUN add-apt-repository -y ppa:pypy/ppa && apt-get update && apt-get install -y pypy pypy-dev
RUN curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py && pypy /tmp/get-pip.py
RUN pip install https://bitbucket.org/pypy/numpy/get/master.zip
RUN pip install requests matplotlib multi-mechanize

CMD echo NOTE call \'multimech-run src\' to start load test && bash

Error

building 'matplotlib.ft2font' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/extern
creating build/temp.linux-x86_64-2.7/extern/CXX
cc -O2 -fPIC -Wimplicit -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/lib/pypy/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/lib/pypy/include -c src/ft2font.cpp -o build/temp.linux-x86_64-2.7/src/ft2font.o
cc1plus: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/ft2font.cpp:7:0:
src/file_compat.h:6:30: fatal error: numpy/npy_common.h: No such file or directory
 #include "numpy/npy_common.h"
                              ^
compilation terminated.
error: command 'cc' failed with exit status 1
@ryanbahneman
Copy link

I'm running into this as well.

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