When I tried to do something with Anaconda (https://store.continuum.io/cshop/anaconda/), I got angry with munmap_chunk (): invalid pointer
when reading a large table with pandas, so I gave up. I built the Python 3.4 system from the source and built the environment for scientific calculation, so the summary.
read_json ()
method of pandas. .. ..Before building the Python body, install the necessary libraries. Even if these are not included, the Python installation itself will pass safely, but later I will suffer from a not found error in the library and I will have to reinstall Python, so I will put it in first anyway. (Self-discipline)
$ sudo yum groupinstall --skip-broken "Development tools"
$ sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
Build Python itself. (This time we will introduce the current latest version 3.4.2)
This time, install it under / usr / local
. Check the version from the following site.
https://www.python.org/downloads/source/
$ wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
$ tar xzvf Python-3.4.2.tgz
$ cd Python-3.4.2
$ ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
$ make
$ sudo make install
Installation is complete if the following command can be executed.
$ which python3
/usr/local/bin/python3
If the Python build is successful, pip should be installed automatically, so check it with the following command.
$ which pip3
/usr/local/bin/pip3
Install the packages required to install Scipy in advance.
sudo yum install blas-devel lapack-devel
Except for specific packages, it can be introduced smoothly with pip3.
$ sudo /usr/local/bin/pip3 install nose pytest numpy scipy scikit-learn pandas
Install the packages required to install matplotlib in advance.
$ sudo yum install libpng-devel
When I try to install matplotlib with pip3, the build fails with the following message.
============================================================================
* The following required packages can not be built:
* freetype
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /root/.pip/pip.log
If you look closely at the error message, you will find the following message.
REQUIRED DEPENDENCIES AND EXTENSIONS
...
freetype: no [Requires freetype2 2.4 or later. Found
2.3.11.]
In order to install matplotlib, freetype2 2.4 or higher is required, but it seems that 2.3.11 is included by default. Here, I decided to build freetype from source. The source can be downloaded from the following site. http://download.savannah.gnu.org/releases/freetype/
$ wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
$ tar xzvf freetype-2.5.3.tar.gz
$ cd freetype-2.5.3
$ ./configure
$ make
$ sudo make install
When I tried pip3 again after finishing up to this point, the following error occurred this time.
Downloading/unpacking matplotlib
Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
result = package.check()
File "/tmp/pip_build_root/matplotlib/setupext.py", line 945, in check
min_version='2.4', version=version)
File "/tmp/pip_build_root/matplotlib/setupext.py", line 433, in _check_for_pkg_config
if (not is_min_version(version, min_version)):
File "/tmp/pip_build_root/matplotlib/setupext.py", line 166, in is_min_version
return found_version >= expected_version
File "/usr/local/lib/python3.4/distutils/version.py", line 76, in __ge__
c = self._cmp(other)
File "/usr/local/lib/python3.4/distutils/version.py", line 343, in _cmp
if self.version < other.version:
TypeError: unorderable types: str() < int()
After investigating this error, I found that it seems to be a known bug in Python 3.3 / 3.4 series. See the issue below for details. http://bugs.python.org/issue14894
Download the 14894.patch
listed here and apply it to Python. (When will this change be applied to Python itself and released ...)
$ wget http://bugs.python.org/file25808/14894.patch
$ cd /usr/local/lib/python3.4/distutils/
$ sudo patch -p3 < /path/to/patch/14894.patch
Matplotlib can be installed by executing pip3 at the end of this process.
$ sudo /usr/local/bin/pip3 install matplotlib
Introduced the following packages.
$ sudo /usr/local/bin/pip3 install ipython jinja2 tornado pyzmq
After that, I ran IPython Notebook Server and put in pytest / Theano / wabbit_wappa, but it became difficult to put together, so it ends here. For IPython Notebook Server, the following sites are well organized for your reference. http://akiniwa.hatenablog.jp/entry/2013/11/25/001805
Enjoy PyData!
Recommended Posts