Installation from python, numpy, scipy sources without root privileges on Linux

A memo about the procedure for the general public without root privileges to install the python2 series.

A word summary

Build from source.

Why you need it

Users with root privileges rarely need to think about this.

However, if you're just a person without root privileges, you can't even install a package that requires just one line, such as pip or easy_install (which is partly a lie: -p). Also, in the case of a shared machine environment, the point that you cannot upgrade the python version or add and update packages without permission is also a bottleneck.

install

bzip2

Without this, you will be hurt later. reference:

# cd ~/tmp
# wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
# tar xzf bzip2-1.0.6.tar.gz
# cd bzip2-1.0.6
# make -f Makefile-libbz2_so
# make
# make install PREFIX=/home/akisato/src/downloads/bzip2-1.0.6
# export CFLAGS=-I/home/akisato/src/downloads/include
# export CPPFLAGS=$CFLAGS
# export LDFLAGS=-L/home/akisato/src/downloads/lib

python body

Sometimes there are packages that require a dynamic link library like theano, so be careful. To avoid this problem, simply enable-shared with configure will have side effects, so specify -rpath to avoid it. [^ 1].

[^ 1]: It's probably okay, hoping that it hasn't been overwritten by the previous LDFLAGS.

# cd ~/tmp
# wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6rc1.tgz
# tar xzf Python-2.7.6rc1.tgz
# cd Python-2.7.6
# ./configure --prefix=/home/akisato/src/downloads/python-2.7.6rc1 --with-threads --enable-shared LDFLAGS=-Wl,-rpath,/home/akisato/src/downloards/python-2.7.6rc1/lib
# vi Makefile
CCSHARED=-fPIC
# make
# make install
# export PATH=/home/akisato/src/downloads/python-2.7.6rc1/bin:${PATH}
# export PYTHONPATH=/home/akisato/src/downloads/python-2.7.6rc1/lib/python2.7/site-packages

It is better to write PATH and PYTHONPATH in ~ / .bashrc for later.

BLAS

reference: Install numpy and scipy on CentOS 5.5 without using yum http://yuku-tech.hatenablog.com/entry/20110325/1301048750

# cd ~/tmp
# wget http://www.netlib.org/blas/blas.tgz
# tar xzf blas.tgz
# cd BLAS
# gfortran -O3 -m64 -fPIC -c *.f
# ar r libfblas.a *.o
# ranlib libfblas.a
# rm -rf *.o
# cp libfblas.a /home/akisato/lib    #Copy to a place to leave permanently
# gfortran -O3 -m64 -fPIC -shared *.f -o libfblas.so
# cp libfblas.so /home/akisato/lib    #Copy to a place to leave permanently
# export BLAS=/home/akisato/lib/libfblas.so    #OK if you can see it only when installing scipy

LAPACK

# cd ~/tmp
# wget http://www.netlib.org/lapack/lapack.tgz
# tar xzf lapack.tgz
# cd lapack
# cp INSTALL/make.inc.gfortran make.inc
# vi make.inc
OPTS = -O2 -m64 -fPIC
NOOPT = -m64 -fPIC
# make lapacklib
# cp liblapack.a /home/akisato/lib    #Copy to a place to leave permanently
# export LAPACK=/home/akisato/lib/liblapack.a    #OK if you can see it only when installing scipy

numpy

It can be installed without BLAS and LAPACK, but it is better to see it if there is one. Please note that the python you just installed will not be used unless you set the path properly.

# which python
/home/akisato/src/downloads/python-2.7.6rc1/bin/python
# wget http://sourceforge.net/projects/numpy/files/NumPy/1.8.0/numpy-1.8.0.tar.gz/download --no-check-certificate
# tar xzf numpy-1.8.0.tar.gz
$ cd numpy-1.8.0
$ python setup.py build
$ python setup.py install

scipy

If the environment variables CFLAS, CCFLAGS, and LDFLAGS are set, it seems that the settings of the scipy build script will be overwritten, so it is better to delete them before build.

# unset CFLAGS
# unset CCFLAGS
# unset LDFLAGS
# wget http://sourceforge.net/projects/scipy/files/scipy/0.14.0/scipy-0.14.0.tar.gz/download
# tar xzvf scipy-0.14.0.tar.gz
# cd scipy-0.14.0
# python setup.py build
# python setup.py install

easy_install

With this, you can easily install the python library with easy_install .

# cd ~/tmp
# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-3.4.1.tar.gz --no-check-certificate
# tar xzf setuptools-3.4.1.tar.gz
# cd setuptools-3.4.1
# python ez_setup.py

pip

This is more convenient than easy_install.

# easy_install pip
# pip freeze
(OK if the already installed package is displayed)

If you can't install pip via easy_install, use get-pip.py.

# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
# python get-pip.py

Recommended Posts

Installation from python, numpy, scipy sources without root privileges on Linux
Stray build Python-3.8.5 on CentOS without root privileges
Install scipy on Linux without internet connection
Use Numpy, Scipy, scikit-learn on Amazon Linux
Install the python module with pip on a server without root privileges
Install and run Python3.5 + NumPy + SciPy on Windows 10
Update monitoring of dmesg (/ dev / kmsg) from python on Linux
Fastest Python installation on Windows
Install CaboCha without root privileges.
[Python + heroku] From the state without Python to displaying something on heroku (Part 1)
[Python + heroku] From the state without Python to displaying something on heroku (Part 2)
Install Python Pillow on Amazon Linux
Use Numpy, Scipy, scikit-learn on Heroku
Installation of SciPy and matplotlib (Python)
Installation of Python, SciPy, matplotlib (Windows)
Notes on accessing dashDB from python
If Python 3.5.0 installation fails on Mac
Introduce Python 3.5.2 environment on Amazon Linux
python> os.path.join ('data','checkpoint')>'data / checkpoint' on linux
Call C / C ++ from Python on Mac
Update Python on Mac from 2 to 3
Data integration from Python app on Linux to Amazon Redshift with ODBC