Last active
June 28, 2020 12:29
-
-
Save igjit/523dbfe6d217b0e02cf69c06b3739780 to your computer and use it in GitHub Desktop.
Use reticulate with pyenv
This file contains 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
# https://github.com/rocker-org/rocker/tree/master/r-ubuntu | |
FROM rocker/r-ubuntu:18.04 | |
RUN apt update && \ | |
apt install -y \ | |
make build-essential libssl-dev zlib1g-dev libbz2-dev \ | |
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ | |
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git | |
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \ | |
echo 'export PATH="/root/.pyenv/bin:$PATH"' >> ~/.bash_profile && \ | |
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile && \ | |
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile | |
ENV CONFIGURE_OPTS="--enable-shared" | |
RUN . ~/.bash_profile && \ | |
pyenv install 3.7.0 | |
RUN Rscript -e 'install.packages("reticulate")' |
This file contains 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
$ docker build -t reticulate-pyenv-test . | |
$ docker run --rm -it reticulate-pyenv-test R -q | |
> library(reticulate) | |
> use_python("/root/.pyenv/versions/3.7.0/bin/python") | |
> py_discover_config() | |
python: /root/.pyenv/versions/3.7.0/bin/python | |
libpython: /root/.pyenv/versions/3.7.0/lib/libpython3.7m.so | |
pythonhome: /root/.pyenv/versions/3.7.0:/root/.pyenv/versions/3.7.0 | |
version: 3.7.0 (default, Nov 10 2019, 03:29:18) [GCC 7.4.0] | |
numpy: [NOT FOUND] | |
python versions found: | |
/root/.pyenv/versions/3.7.0/bin/python | |
/usr/bin/python | |
/usr/bin/python3 | |
> os <- import("os") | |
> os$system("ls") | |
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | |
[1] 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment