[PYTHON] Prepare the environment for O'Reilly's book "Deep Learning from scratch" with apt-get (Debian 8)

Installation

The book recommends using Anaconda, but apt-get cuts it.

$ sudo apt-get install python3 python3-numpy python3-matplotlib

Run with "python3" instead of "python"

In Debian 8 (jessie), "python" refers to the Python 2.x family. "python3" will start the Python 3.x series.

$ python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> x = np.array([0, 1])
>>> w = np.array([0.5, 0.5])
>>> np.sum(w*x)
0.5

Bonus: When using matplotlib in a CUI environment

If it is standard, I get angry when I try to draw a graph and say "I don't know what the screen is."

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> x = np.arange(0, 6, 0.1)
>>> y = np.sin(x)
>>> plt.plot(x,y)
(abridgement)
_tkinter.TclError: no display name and no $DISPLAY environment variable

It is okay if you drop it in a file by referring to Output the result of plotting with matplotlib on the server to a file | mwSoft.

>>> import numpy as np
>>> import matplotlib
>>> matplotlib.use('Agg')
>>>
>>> import matplotlib.pyplot as plt
>>> x = np.arange(0, 6, 0.1)
>>> y = np.sin(x)
>>> plt.plot(x,y)
[<matplotlib.lines.Line2D object at 0x7fcb0656ada0>]
>>> plt.savefig('sinwave.png')

sinwave.png (uselessly huge) sinwave.png

Recommended Posts

Prepare the environment for O'Reilly's book "Deep Learning from scratch" with apt-get (Debian 8)
Create an environment for "Deep Learning from scratch" with Docker
Realize environment construction for "Deep Learning from scratch" with docker and Vagrant
[Windows 10] "Deep Learning from scratch" environment construction
Good book "Deep Learning from scratch" on GitHub
Deep Learning from scratch
Deep Learning from scratch The theory and implementation of deep learning learned with Python Chapter 3
[Deep Learning from scratch] I implemented the Affine layer
Create a machine learning environment from scratch with Winsows 10
Deep Learning from scratch 1-3 chapters
A memo when executing the deep learning sample code created from scratch with Google Colaboratory
"Deep Learning from scratch" Self-study memo (Part 8) I drew the graph in Chapter 6 with matplotlib
Deep learning from scratch (cost calculation)
Deep Learning memos made from scratch
Prepare the development environment with anyenv
Prepare the environment for Atom for Pythonista
Deep learning tutorial from environment construction
[Deep Learning from scratch] Main parameter update methods for neural networks
Deep Learning from scratch 4.4.2 Gradient for neural networks The question about the numerical_gradient function has been solved.
[Learning memo] Deep Learning made from scratch [Chapter 7]
Deep learning from scratch (forward propagation edition)
Deep learning / Deep learning from scratch 2-Try moving GRU
Deep learning / Deep learning made from scratch Chapter 6 Memo
[Learning memo] Deep Learning made from scratch [Chapter 5]
[Learning memo] Deep Learning made from scratch [Chapter 6]
"Deep Learning from scratch" in Haskell (unfinished)
Prepare the development environment for keyhac for Mac
Deep learning / Deep learning made from scratch Chapter 7 Memo
Until the Deep Learning environment (TensorFlow) using GPU is prepared for Ubuntu 14.04
Learning record of reading "Deep Learning from scratch"
Build a "Deep learning from scratch" learning environment on Cloud9 (jupyter miniconda python3)
[Deep Learning from scratch] About hyperparameter optimization
"Deep Learning from scratch" Self-study memo (Part 12) Deep learning
[Learning memo] Deep Learning made from scratch [~ Chapter 4]
[For beginners] After all, what is written in Deep Learning made from scratch?
"Deep Learning from scratch" self-study memo (unreadable glossary)
The story of doing deep learning with TPU
"Deep Learning from scratch" Self-study memo (9) MultiLayerNet class
Note: Prepare the environment of CmdStanPy with docker
Prepare the execution environment of Python3 with Docker
Deep Learning from scratch ① Chapter 6 "Techniques related to learning"
Deep Learning from scratch Chapter 2 Perceptron (reading memo)
[Learning memo] Deep Learning from scratch ~ Implementation of Dropout ~
Machine learning starting from scratch (machine learning learned with Kaggle)
Python vs Ruby "Deep Learning from scratch" Summary
"Deep Learning from scratch" Self-study memo (10) MultiLayerNet class
"Deep Learning from scratch" Self-study memo (No. 11) CNN
Countermeasures for "Unable to get upper directory" error when using Deep Learning ② created from scratch with spyder of ANACONDA
"Deep Learning from scratch" Self-study memo (No. 16) I tried to build SimpleConvNet with Keras
"Deep Learning from scratch" Self-study memo (No. 17) I tried to build DeepConvNet with Keras
Dare to learn with Ruby "Deep Learning from scratch" Importing pickle files from forbidden PyCall
"Deep Learning from scratch" Self-study memo (No. 19) Data Augmentation
"Deep Learning from scratch 2" Self-study memo (No. 21) Chapters 3 and 4
Application of Deep Learning 2 made from scratch Spam filter
Techniques for understanding the basis of deep learning decisions
Deep Learning from the mathematical basics Part 2 (during attendance)
Othello ~ From the tic-tac-toe of "Implementation Deep Learning" (4) [End]
Study method for learning machine learning from scratch (March 2020 version)
Install Ubuntu 20.04 with GUI and prepare the development environment
[Deep Learning from scratch] I tried to explain Dropout
I built an environment for machine learning from scratch (windows10 + Anaconda + VSCode + Tensorflow + GPU version)