Set up python and machine learning libraries on Ubuntu

background

I decided to do machine learning at work, so make a note of the setup method.

environment

Advance preparation

Install the modules required to install python first.

sudo aptitude install gcc g++ make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev

Installation of pyenv, pyenv-virtualenv

Use pyenv and pyenv-virtualenv so that versions and libraries can be switched for each directory.

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

Install the machine learning library in your working folder.

mkdir work
cd work
pyenv virtualenv 3.5.1 3.5.1_work
pyenv local 3.5.1_work
pip install numpy
pip install scipy
pip install scikit-learn
pip install gensim

pip freezeIf you check with, the list of installed libraries will be displayed only in the work folder.

pip freeze

boto==2.40.0
bz2file==0.98
gensim==0.12.4
...

mecab

Since I will do text system, I also install mecab.

sudo aptitude install libmecab-dev
sudo aptitude install mecab mecab-ipadic-utf8
mecab --version
pip install mecab-python3

Recommended Posts

Set up python and machine learning libraries on Ubuntu
Set up Python 3.4 on Ubuntu
Set up Python environment on CentOS
Notes on PyQ machine learning python grammar
Build Python3 and OpenCV environment on Ubuntu 18.04
Python virtual environment and packages on Ubuntu
Python and machine learning environment construction (macOS)
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Set cron from 1 on Ubuntu 16.04 (Sakura VPS) and execute python program regularly
Set up python Tornado environment on raspbian jessie
Install MongoDB on Ubuntu 16.04 and operate via python
Install Python and libraries for Python on MacOS Catalina
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Build a machine learning Python environment on Mac OS
Python learning memo for machine learning by Chainer Chapters 1 and 2
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Practical machine learning with Scikit-Learn and TensorFlow-TensorFlow gave up-
Until you create a machine learning environment with Python on Windows 7 and run it
Data set for machine learning
Use matplotlib on Ubuntu 12 & Python
Python on Ruby and angry Ruby on Python
Set Up for Mac (Python)
Machine learning with Python! Preparation
Put Python 3.x on Ubuntu
Install OpenCV on Ubuntu + python
Set up Polyglot on Windows
Introducing TensorFlow on Ubuntu + Python 2.7
Python Machine Learning Programming> Keywords
Machine learning and mathematical optimization
Beginning with Python machine learning
Build a python machine learning study environment on macOS sierra
Build an environment for machine learning using Python on MacOSX
Build a machine learning scikit-learn environment with VirtualBox and Ubuntu
What I learned about AI and machine learning using Python (4)
Install python3 and scientific calculation library on Ubuntu (virtualenv + pip)
Set up AWS (Ubuntu 14.04) for Deep Learning (install CUDA, cuDNN)
Machine learning environment settings based on Python 3 on Mac (coexistence with Python 2)
Remove ubuntu installed on Windows 10 machine
Python 3.4 pyvenv fails on Ubuntu 14.04 LTS
Notes on Python and dictionary types
Python 3.6 on Windows ... and to Xamarin.
Prepare Python development environment on Ubuntu
Significance of machine learning and mini-batch learning
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Install Python 3.8 on Ubuntu 20.04 (OS standard)
[Machine learning] Try running Spark MLlib with Python and make recommendations
Introducing Python using pyenv on Ubuntu 20.04
Preparing python using vscode on ubuntu
Machine learning with python (1) Overall classification
Machine learning summary by Python beginners
Integrate Modelica and Python on Windows
Classification and regression in machine learning
<For beginners> python library <For machine learning>
Install fabric on Ubuntu and try
Python: Preprocessing in Machine Learning: Overview
Set up Ubuntu as a Linux cheat sheet and https server
Install Python 3.9 on Ubuntu 20.04 (OS standard?)