[PYTHON] NumPy and matplotlib environment construction

It is a topical opportunity learning system recently, but it is being established as a field of Python. An event called PyData is also actively held.

Build the environment of NumPy and matplotlib on CentOS 6.x.

Advance preparation

Install Development Tools on CentOS

Install other yum required

...Postscript
$ sudo yum install freetype-devel

Installation

Python2.7.9


$ cd /home/cmscom/tmp
$ wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
$ tar zxvf Python-2.7.9.tgz
$ cd Python-2.7.9
$ ./configure
$ make
$ sudo make install

Installed below

/usr/local/lib/python2.7

Install PIP and virtualenv

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo /usr/local/bin/python get-pip.py
$ sudo pip install virtualenv
$ cd /home/cmscom
$ virtualenv python
$ ./python/bin/pip install numpy
$ ./python/bin/pip install nltk
$ ./python/bin/pip install matplotlib
$ ./python/bin/pip install ipython[notebook]

Trouble with installation

I had a problem installing NLTK in another environment on Mac OS. I will describe the background and solution.

AttributeError: 'module' object has no attribute 'finders' 

Looking at the content of the error, in NLTK setup.py, an error appears in the part where the following processing is performed.

nltk/setup.py


from setuptools.command import sdist
del sdist.finders[:]

I checked the version of setuptools in my installation and found that setuptools-11.0 was installed.

A similar phenomenon was reported.

NLTK bug report https://github.com/nltk/nltk/issues/824

Setuptools bug report https://bitbucket.org/pypa/setuptools/issue/322/failure-installing-nltk-300-using

I did the following to proceed with the installation.

$ ./python/bin/pip install setuptools==9.1 

This is the solution !!

Essential problem

On the NLTK side, I'm doing the following, but this is the problem.

del sdist.finders[:]

I don't know the details, but I think it was necessary when using the previous setuptools. It seems that changes have been made to setuptools since Ver.10, and it does not seem to match well with the support on the NLTK side.

A 2009 article talks about this. http://rhodesmill.org/brandon/2009/eby-magic/

It's an event at setuptools, so I'd like to hear from @aodag or @shimizukawa.

Recommended Posts

NumPy and matplotlib environment construction
[docker] python3.5 + numpy + matplotlib environment construction
Python environment construction and TensorFlow
Environment construction of python and opencv
Image recognition environment construction and basics
Environment construction with pyenv and pyenv-virtualenv
Django environment construction
DeepIE3D environment construction
Linux environment construction
Python environment construction
Environment construction (python)
django environment construction
CodeIgniter environment construction
python environment construction
Python --Environment construction
Python and machine learning environment construction (macOS)
Python environment construction
Graph trigonometric functions with numpy and matplotlib
Golang environment construction
python environment construction
Word2vec environment construction
Python3 TensorFlow environment construction (Mac and pyenv virtualenv)
MacOS 10.11 environment construction: Powerline with Anaconda and Dein.vim
Installation of Python3 and Flask [Environment construction summary]
Pillow environment construction --For Docker + iPython (and OpenCV)
[Django3] Environment construction and various settings summary [Python3]
Python and numpy tips
Environment construction: GCP + Docker
Django project environment construction
python windows environment construction
Go language environment construction
ConoHa environment construction memo
homebrew python environment construction
Anaconda-4.2.0-python3 environment construction (Mac)
YOLO v4 environment construction ①
pyenv + fish environment construction
python2.7 development environment construction
BigGorilla environment construction memo
grip environment construction onCentOS6.5
Anaconda environment construction memo
matplotlib this and that
Golang environment construction [goenv]
Mac environment construction Python
Pyxel environment construction (Mac)
[Numpy / pandas / matplotlib Exercise 01]
Python environment construction @ Win7
Report environment construction by python (matplotlib, pandas, sphinx) + wkhtmltopdf
[Ubuntu 18.04] Tensorflow 2.0.0-GPU environment construction
Python + Anaconda + Pycharm environment construction
About Linux environment construction (CentOS)
PyTorch C ++ (LibTorch) environment construction
Anaconda environment construction on CentOS7
Django development environment construction memo
First LAMP environment construction (Linux)
Python environment construction (Windows10 + Emacs)
Let's create a PRML diagram with Python, Numpy and matplotlib.
CI environment construction ~ Python edition ~
[Memo] Construction of cygwin environment
ML environment construction with Miniconda
Python environment construction For Mac
Anaconda3 python environment construction procedure