[docker] python3.5 + numpy + matplotlib environment construction

Creating an environment for deep learning from scratch Memo

=========== 2017/04/15 22:24 Addendum =============== A docker image created according to the method in this article https://hub.docker.com/r/gorogoroyasu/deeplearning-env Woke up in Please feel free to use it. ================ Addendum =================

Prepare ubuntu16 docker container and I built an environment in which python works.

Download ubuntu: 16.04 docker image, start the container and go inside the container.

sudo docker pull ubuntu:16.04
sudo docker run -d --name ubuntu16 ubuntu:16.04 /sbin/init
sudo docker exec -it ubuntu16 /bin/bash

Execute the following command in the container

apt update
apt-get install gcc g++ make git openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev curl libopenblas-dev vim wget -y

git clone https://github.com/yyuu/pyenv.git ~/.pyenv
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc 
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc

pyenv install 3.5.1
pyenv rehash
pyenv global 3.5.1
pip install --upgrade pip
pip install numpy
pip install matplotlib

afterwards, find / -name matplotlibrc Is near line 38 of the file that comes out, backend : TKAgg To backend : Agg change to.

This completes the environment construction.

In addition, I decided to output the graph as an image. The reason was that it seemed to be annoying. If you don't like images, please refer to here. [Reference]: http://qiita.com/hyt-sasaki/items/cebdd953a5b5cfde00df

Click here for sample code to output images.

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0, 1, 0.1)
y = x

plt.plot(x,y)
plt.savefig('plot.png')

plt.savefig ('hoge.png') is outputting the image.

The output image looks like this. For the time being, if you only need a still image, I think this is enough.

plot.png

Good vibes.

=========== 2017/04/16 14:58 Addendum ============ Since I am using a module called PIL on P.74, pip install Pillow Seems to be necessary. To save images with PIL, pil_img.save('hoge.png') It seems that it should be done. docker image has not been updated.

========================================

Recommended Posts

[docker] python3.5 + numpy + matplotlib environment construction
NumPy and matplotlib environment construction
Environment construction (python)
Python --Environment construction
Python environment construction
python environment construction
Environment construction: GCP + Docker
python windows environment construction
homebrew python environment construction
Python development environment construction
python2.7 development environment construction
Mac environment construction Python
Python environment construction @ Win7
Python + Anaconda + Pycharm environment construction
Python environment construction (Windows10 + Emacs)
Python environment construction For Mac
Prepare python3 environment with Docker
Python3 environment construction (for beginners)
Python environment construction and TensorFlow
Python environment construction under Windows7 environment
[Python] OpenCV environment construction with Docker (cv2.imshow () also works)
WSL2 environment construction example Python, Node.js, Java, git-secrets, Docker
Report environment construction by python (matplotlib, pandas, sphinx) + wkhtmltopdf
Environment construction of python and opencv
Python environment construction memo on Windows 10
Anaconda python environment construction on Windows 10
Python + Unity Reinforcement learning environment construction
I checked Mac Python environment construction
Build Mysql + Python environment with docker
Python environment construction memo on Mac
Python environment construction (pyenv, anaconda, tensorflow)
[Python3] Development environment construction << Windows edition >>
Python development environment construction on macOS
Python environment construction (pyenv + poetry + pipx)
[Linux] Docker environment construction on Redhat
Python environment construction procedure memo using Docker on Windows10 Home
Environment construction of python3.8 on mac
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Python3 TensorFlow for Mac environment construction
pytorch @ python3.8 environment construction with pipenv
Docker environment update: add Python package
Python3.6 environment construction (using Win environment Anaconda)
OpenCV3 & Python3 environment construction on Ubuntu
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Python (anaconda) development environment construction procedure (SpringToolsSuites) _2020.4
Build Jupyter Lab (Python) environment with Docker
Python project environment construction procedure (for windows)
Using venv in Windows + Docker environment [Python]
[Python] Road to snake charmer (1) Environment construction
Create Python + uWSGI + Nginx environment with Docker
Python3 + venv + VSCode + macOS development environment construction
VScode environment construction (Windows10, Python, C ++, C, Git)
Created Ubuntu, Python, OpenCV environment on Docker
Environment construction procedure: Ubuntu + Apache2 + Python + Pyramid
Python and machine learning environment construction (macOS)
Let's get along with Python # 0 (Environment construction)
Windows + gVim + Poetry python development environment construction
Django environment construction
My Numpy (Python)
DeepIE3D environment construction
Emacs-based environment construction