Upgrade to python3 on CentOS

While working on machine learning, I faced issues to use NLTK 3. Event some libraries need python3 to run. I use alibaba cloud with centos6. Here are the steps to follow to install python 3.x and pip3

First, install minimum necessary tools:

$ sudo yum install yum-utils

Then using yum-builddep, set up a necessary build environment for python3 and install missing dependencies. The following command will automatically take care of that.

$ sudo yum-builddep python

Now download the latest python3 (e.g., python 3.5) from https://www.python.org/ftp/python/

$ curl -O https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz

Finally, build and install python3 as follows. The default installation directory is /usr/local. If you want to change this to some other directory, pass “–prefix=/alternative/path” parameter to configure before running make.

$ tar xf Python-3.5.0.tgz
$ cd Python-3.5.0
$ ./configure
$ make
$ sudo make install

This will install python3, pip3, setuptools as well as python3 libraries on your CentOS system.

$ python3 –version

alias python=’/usr/local/bin/python3.5′

Method Two: Install Python3 from EPEL Repository

The latest EPEL 7 repository offers python3 (python 3.4 to be exact). Thus if you are using CentOS 7 or later, you can easily install python3 by enabling EPEL repository as follows.

$ sudo yum install epel-release

Then install python 3.4 and its libraries using yum:

$ sudo yum install python34

Note that this will not install matching pip. To install pip and setuptools, you need to install them separately as follows.

$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo /usr/bin/python3.4 get-pip.py

Method Three: Install Python3 from Software Collections (SCL)

Another way to install python3 is via enabling Software Collections (SCL) repository. The SCL repository is available for CentOS 6.5 or later, and the latest SCL offers python 3.3. Once you enable the SCL repository, go ahead and install python3 as follows.

$ sudo yum install python33

To use python3 from the SCL, you need to enable python3 on a per-command basis as follows.

$ scl enable python33 <command>

You can also invoke a bash shell with python3 enabled as the default Python interpreter:

$ scl enable python33 bash
Source: http://ask.xmodulo.com/install-python3-centos.html
How to use pip to use virtualenv for packages

python3 -m virtualenv pyeztask/

Enable .htaccess directive in httpd CentOS

Make sure AccessFileName set to .htaccess

Search httpd.conf for AccessFileName directive. It defines name of the distributed configuration file:

grep -i AccessFileName httpd.conf

Make sure users are allowed to use .htaccess file

What you can put in these files is determined by the AllowOverride directive. This directive specifies, in categories, what directives will be honored if they are found in a .htaccess file. If this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

grep -i AllowOverride httpd.conf

When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files: AllowOverride All

Save and close the file. Restart httpd:

service httpd restart

Technical Problems on Ubuntu setup


I have been using CentOS, another RHEL flavored operating system since couple of years. Recently, I started using Ubuntu, not because I dont like CentOS but because my developers like this OS. Now I am an entrepreneur and every decision made by me has direct impact on my developers, so I follow the path of employee satisfaction is my biggest motto.  I freshly install Ubuntu in HP laptop, which was refurbished with new Hard disk. I tried using bootable USB stick to install Ubuntu, it was quite straight forward, Unetbootin usb creator helped me a lot. First I had to download Ubuntu iso package in my MacBook pro and then used Unetbootin to create a bootable USB stick with Ubuntu OS. It was quite simple to successfully create a Ubuntu bootable usb stick.

I then used this bootable stick in my HP laptop to install Ubuntu. It was successfully installed without any technical issues. However, post install, I had issues running softwares. However, google God helped me to get the solutions. Here are few of my technical problems and solutions, I hope it will help others too.

When binary programs in PATH are not recognized

This is because there is some 32 bit libraries are missing in your Ubuntu 64 bit. Run:

apt-get install libc6-i386

Then I had issue running any of nodejs npm commands.  I was getting following erros

/usr/bin/env: node: No such file or directory

Thanks to this web post, the solution is

sudo ln -s "$(which nodejs)" /usr/bin/node

You need to symlink the nodejs executable to node. I will keep on updating this post for any technical issues faced in Ubuntu and resolutions.