Last active
February 6, 2024 14:22
-
-
Save rjw57/f5b33f91366bb4f760b6da016c7df777 to your computer and use it in GitHub Desktop.
Installing pypy3 and numpy from scratch on Debian 10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Dockefile demonstrates how to install upstream pypy3 on a bare Debian 10 | |
# box from scratch. | |
# | |
# To test: | |
# docker run --rm rjw57/pypy3 \ | |
# pypy3 -c 'import numpy as np; M=np.array(range(16)).reshape((4,-1)); Q, R = np.linalg.qr(M); [print(x) for x in (M, Q, R, np.dot(Q,R))]' | |
FROM debian:10 | |
# Install any system-wide dependencies we need including essential packages | |
# required to compile C-based Python modules. | |
RUN \ | |
apt-get -y update \ | |
&& apt-get -y install build-essential curl | |
# Specify the pypy version to install here. The version is used to construct the | |
# download URL for the binary distribution along with the prefix used by the | |
# binary tarball. It's worth checking which versions of PyPy3 are supported by | |
# the builds available at https://antocuni.github.io/pypy-wheels/manylinux2010/. | |
ARG PYPY_VERSION=3.6-v7.3.1 | |
ARG PYPY_ROOT=pypy$PYPY_VERSION-linux64 | |
ARG PYPY_URL=https://bitbucket.org/pypy/pypy/downloads/$PYPY_ROOT.tar.bz2 | |
# Install pypy itself under /opt and symlink the pypy3 binary into | |
# /usr/local/bin so that it appears on the PATH. | |
RUN \ | |
cd /opt \ | |
&& curl -L "${PYPY_URL}" | tar xjf - \ | |
&& ln -s "/opt/${PYPY_ROOT}/bin/pypy3" /usr/local/bin/pypy3 | |
# Ensure and update pip. | |
RUN \ | |
pypy3 -m ensurepip \ | |
&& pypy3 -m pip install --upgrade pip | |
# Install complex packages from a pre-built archive as they are tedious to build. | |
RUN pypy3 -m pip install \ | |
--extra-index-url https://antocuni.github.io/pypy-wheels/manylinux2010 \ | |
numpy==1.18.3 | |
# The cryptography module requires the libssl headers be installed. | |
RUN apt-get -y install libssl-dev && pypy3 -m pip install cryptography | |
# Install the remaining pip dependencies. | |
RUN pypy3 -m pip install \ | |
pykka ccxt file_read_backwards websocket protobuf pyerf jsonmerge | |
# Install scipy which takes *forever* and requires some additional system | |
# dependencies. | |
RUN \ | |
apt-get -y install gfortran libopenblas-dev liblapack-dev \ | |
&& pypy3 -m pip install scipy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment