1. Install Python-34 Numpy, Scipy
# yum -y install python34-numpy
# yum -y install scipy
2. Use Python-3.4 and use “Pip install” to install
# pip install numpy scipy
# pip install -U scikit-learn[alldeps]
3. Test scikit-learn
>>> import sklearn
1. Install Python-34 Numpy, Scipy
# yum -y install python34-numpy
# yum -y install scipy
2. Use Python-3.4 and use “Pip install” to install
# pip install numpy scipy
# pip install -U scikit-learn[alldeps]
3. Test scikit-learn
>>> import sklearn
If you do a pip install pillow for python-3 on CentOS 6, you may encounter a broken and exception error.
# pip install pillow ...... ...... ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
Solution: Install “libjpeg-turbo-devel” and “libjpeg-turbo-static” which is an important dependencies for pillow module
# yum install libjpeg*
# easy_install pillow Searching for pillow Reading https://pypi.python.org/simple/pillow/ Best match: Pillow 3.1.0 .......... .......... Installed /usr/local/python-3.4.3/lib/python3.4/site-packages/Pillow-3.1.0-py3.4-linux-x86_64.egg Processing dependencies for pillow Finished processing dependencies for pillow
By default, JupyterHub uses Python 3.3. However you may want to use Python-2 on JuypterHub. You may want to take a look at Basic Setup and Configuration of JupyterHub with Python-3.4.3
Step 1: Install latest version of Python-2
You may want to see Installing and Compiling Python 2.7.8 on CentOS 5. You can apply this for CentOS 6
Step 2: Remember to install iPython2 and iPython[notebook] on Python-2
Do take a look at Installing scipy and other scientific packages using pip3 for Python 3.4.1 for some similar ideas
Step 3: Install Python KernelSpec for Python 2
# /usr/local/python-2.7.10/bin/python2 -m IPython kernelspec install-self # /usr/local/python-3.4.3/bin/python3 -m IPython kernelspec install-self
Step 4: Restart JupytHub
# juypterHub
This is a basic setup and configuration of JupyterHub from
Prerequisites:
Step 1: Install Python-3.4.3
You can use the tutorial to learn how to setup Python 3 (Compiling and Configuring Python 3.4.1 on CentOS)
Step 2: Install Nodejs and npm and Javascript Dependencies. You will need to install and enable EPEL repository
# yum install nodejs npm # npm install -g configurable-http-proxy
Step 3a: Installation of JupyerHub
# pip3 install "ipython[notebook]" # pip3 install jupyterhub # git clone https://github.com/jupyter/jupyterhub.git # cd jupyterHub # pip3 install -r dev-requirements.txt -e .
Step 3b: Update Javascript
# python3 setup.py js # python3 setup.py css
Step 4a: Update .bashrc or /etc/profile.d for python-3 path if you wish to affect global settings
# export PATH=/usr/local/python-3.4.3/bin:$PATH
Step 4b: Launch the JupyterHub Server
# jupyterhub
and then visit `http://localhost:8000`, and sign in with your unix credentials. If it does not work, no worry, just read on
Step 5: Generate a default config file:
# jupyterhub --generate-config
Step 6: Create Group shadow and put users into the group
The intention is to allow users to read the /etc/shadow file which is a requirements for jupytehub
# groupadd shadow # chown root.shadow /etc/shadow # usermod -G shadow user1 # chmod 040 /etc/shadow
If you are using DNS name instead of localhost, you would have to modify the jupyterhub_config.py found in /usr/local/juypterhub.
At approximately line 46, 181, modify localhost to your public-facing IP Address for the c.JupyterHub.hub_ip
c.JupyterHub.hub_ip = '10.10.10.10'
Step 6: Using sudo to run JupyterHub without root privilege
Do read the important document from JupyterHub wiki Using sudo to run JupyterHub without root privilege
Launch jupyterhub again.
# jupyterhub
I wanted to install the packages using pip3. Before you can successfully install the python packages, do note that you have to make sure the following packages are found in your CentOS 6.
# yum install blas blas-devel lapack lapack-devel numpy
After you install according to Compiling and Configuring Python 3.4.1 on CentOS
The packages that I want to install are numpy scipy matplotlib ipython ipython[notebook] pandas sympy nose
# /usr/local/python-3.4.1/bin/pip install numpy # /usr/local/python-3.4.1/bin/pip install scipy # /usr/local/python-3.4.1/bin/pip install matplotlib # /usr/local/python-3.4.1/bin/pip install ipython # /usr/local/python-3.4.1/bin/pip install ipython[notebook] # /usr/local/python-3.4.1/bin/pip install pandas # /usr/local/python-3.4.1/bin/pip install sympy # /usr/local/python-3.4.1/bin/pip install nose
Step 1: Remember to turn on RPMForge and EPEL Repository.
For more information on repository, see Repository of CentOS 6 and Scientific Linux 6
Step 2: Download Python-3.4.1 from the Python Download Page
Step 3: Install Prerequisite Software
# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
Step 4: Configure and Build
# cd /installation_home/Python-3.4.1 # ./configure --prefix=/usr/local/python-3.4.1 # make # make install
Step 5: Check that scripts query the correct interpreter:
#/usr/local/python-3.4.1/bin/python3
Step 6: Run setup.py from the Installation Directory of Python
# python setup.py install
Step 7: Install Python Modules (whatever you need. Here is an example)
You can use pip install to install packages using pip3. See Using pip to install python packages
# /usr/local/python-3.4.1/bin/pip3 install networkx
Pointer 1: To install specific version of packages do
# pip install 'numpy==1.5.1'
Pointer 2: To show what files was installed
# pip show --files numpy --- Name: numpy Version: 1.8.1 Location: /usr/local/python-2.7.8/lib/python2.7/site-packages Requires: Files: ../numpy/__init__.py ..... .....
Pointer 3: Uninstall a package
# pip uninstall num Uninstalling SomePackage:
Pointer 4: Upgrade a package:
# pip install --upgrade SomePackage [...] Found existing installation: SomePackage 1.0 Uninstalling SomePackage: Successfully uninstalled SomePackage Running setup.py install for SomePackage Successfully installed SomePackage
Pointer 5: List what packages are outdated:
# pip list --outdated SomePackage (Current: 1.0 Latest: 2.0)
References:
Step 1: Install Python 2.7
python-igraph requires Python 2.5 and above. Do look at Installing and Compiling Python 2.7.8 on CentOS 5
Step 2: Download and unpack python-igraph from python-igraph.
The current version is python-igraph 0.7
Step 3: Unpack and compile
# tar -zxvf python-igraph-0.7.0 # cd python-igraph-0.7.0 # python setup.py install
If you encounter errors similar to /usr/lib64/libxml2.a: could not read symbols: Bad value
Step 4: Copy and update to /usr/local/
If you want to put all the packages in an easier to find directory. Copy
# mkdir -p /usr/local/python-igraph-0.7.0/bin # mkdir -p /usr/local/python-igraph-0.7.0/lib # cp $PYTHON-IGRAPH-HOME/build/scripts-2.7/igraph /usr/local/python-igraph-0.7.0/bin # cp -rv $PYTHON-IGRAPH-HOME/build/scripts-2.7/lib.linux-x86_64-2.7/igraph /usr/local/python-igraph-0.7.0/lib # cp -rv $PYTHON-IGRAPH-HOME/igraphcore/lib/libigraph.so* /usr/local/python-igraph-0.7.0/lib
Step 5: Test the python-igraph libraries.
Update .bashrc
export PATH=$PATH:/usr/local/python-igraph-0.7.0/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/python-igraph-0.7.0/lib
Test with python on the command line
$ python2.7 Python 2.7.8 (default, Jul 17 2014, 14:44:57) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import igraph >>>
*Easier Method*
You can use pip to install. For more information on how to install and use pip, see Installing and Compiling Python 2.7.8 on CentOS 5
References:
Step 1: Download the Python 2.7.8 from Python Site
Step 2: Use GCC44 to compile. If you have not done it, do
# yum install gcc44 gcc44-c++ gcc44-gfortran
Step 3: Update your alias in your .bashrc
alias gcc='gcc44'
Step 4: Configure python 2.7.8
# cd python-2.7.8 # ./configure --prefix=/usr/local/python-2.7.8 # make -j 8 # make install
Step 5: Update the PATH and LD_LIBRARY_PATH in your .bashrc
export PATH=$PATH:/usr/local/python-2.7.8/bin......... export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/python-2.7.8/lib
Step 6: Download get-pip.py
For more information see pip installation site
Create a directory inside python2.7 directory and put pip in that directory
# mkdir /usr/local/python-2.7.8/pip # wget https://bootstrap.pypa.io/get-pip.py .
Step 7: Install pip with Administrator rights
# python2.7 get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
To upgrade an existing setuptools (or distribute), run
# pip install -U setuptools # pip install numpy