Wednesday, January 24, 2018

Python - Install matplotlib in Ubuntu using PIP

To install matplotlib in Ubuntu using PIP - execute the following command:

$ pip install matplotlib
Collecting matplotlib
  Downloading matplotlib-2.1.2-cp27-cp27mu-manylinux1_x86_64.whl (15.0MB)
    100% |████████████████████████████████| 15.0MB 81kB/s 
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 3.4MB/s 
Collecting backports.functools-lru-cache (from matplotlib)
  Downloading backports.functools_lru_cache-1.4-py2.py3-none-any.whl
Collecting subprocess32 (from matplotlib)
  Downloading subprocess32-3.2.7.tar.gz (54kB)
    100% |████████████████████████████████| 61kB 4.2MB/s 
Collecting pytz (from matplotlib)
  Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
    100% |████████████████████████████████| 512kB 1.6MB/s 
Collecting six>=1.10 (from matplotlib)
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting python-dateutil>=2.1 (from matplotlib)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 2.5MB/s 
Collecting cycler>=0.10 (from matplotlib)
  Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting numpy>=1.7.1 (from matplotlib)
  Downloading numpy-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl (16.9MB)
    100% |████████████████████████████████| 16.9MB 70kB/s 
Building wheels for collected packages: subprocess32
  Running setup.py bdist_wheel for subprocess32 ... done
  Stored in directory: /home/shree/.cache/pip/wheels/7d/4c/a4/ce9ceb463dae01f4b95e670abd9afc8d65a45f38012f8030cc
Successfully built subprocess32
Installing collected packages: pyparsing, backports.functools-lru-cache, subprocess32, pytz, six, python-dateutil, cycler, numpy, matplotlib
Successfully installed backports.functools-lru-cache cycler matplotlib numpy-1.14.0 pyparsing python-dateutil-2.6.1 pytz-2017.3 six-1.11.0 subprocess32
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


Tuesday, January 16, 2018

Python - Install Pandas in Ubuntu using PIP

To install Pandas in Ubuntu using PIP - execute the following command:

$ sudo pip install pandas
[sudo] password for ubuntu: 
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pandas
  Downloading pandas-0.22.0-cp27-cp27mu-manylinux1_x86_64.whl (24.3MB)
    100% |████████████████████████████████| 24.3MB 51kB/s 
Collecting pytz>=2011k (from pandas)
  Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
    100% |████████████████████████████████| 512kB 860kB/s 
Collecting numpy>=1.9.0 (from pandas)
  Downloading numpy-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl (16.9MB)
    100% |████████████████████████████████| 16.9MB 73kB/s 
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/local/lib/python2.7/dist-packages (from python-dateutil->pandas)
Installing collected packages: pytz, numpy, pandas
Successfully installed numpy-1.14.0 pandas-0.22.0 pytz-2017.3
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


Monday, January 15, 2018

Python - Install boto3 to connect to AWS in Ubuntu

To install boto3 in Ubuntu - you need to first install PIP:
http://sashankexpresstech.blogspot.in/2018/01/python-install-pip-in-ubuntu.html

After this, execute the following command to install boto3:


~$ sudo pip install boto3
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting boto3
  Downloading boto3-1.5.14-py2.py3-none-any.whl (128kB)
    100% |████████████████████████████████| 133kB 854kB/s 
Collecting jmespath<1.0.0,>=0.7.1 (from boto3)
  Downloading jmespath-0.9.3-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3)
  Downloading s3transfer-0.1.12-py2.py3-none-any.whl (59kB)
    100% |████████████████████████████████| 61kB 944kB/s 
Collecting botocore<1.9.0,>=1.8.28 (from boto3)
  Downloading botocore-1.8.28-py2.py3-none-any.whl (4.0MB)
    100% |████████████████████████████████| 4.0MB 274kB/s 
Collecting futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" (from s3transfer<0.2.0,>=0.1.10->boto3)
  Downloading futures-3.2.0-py2-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.9.0,>=1.8.28->boto3)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 860kB/s 
Collecting docutils>=0.10 (from botocore<1.9.0,>=1.8.28->boto3)
  Downloading docutils-0.14-py2-none-any.whl (543kB)
    100% |████████████████████████████████| 552kB 808kB/s 
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.28->boto3)
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: jmespath, futures, six, python-dateutil, docutils, botocore, s3transfer, boto3
Successfully installed boto3-1.5.14 botocore-1.8.28 docutils-0.14 futures-3.2.0 jmespath-0.9.3 python-dateutil-2.6.1 s3transfer-0.1.12 six-1.11.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
~$ 

Python - Install pip in Ubuntu

To Install python pip in Ubuntu open the terminal and execute the following command:

~$ sudo apt-get install python-pip
[sudo] password for ubuntu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython-all-dev python-all python-all-dev python-pip-whl python-wheel
The following NEW packages will be installed:
  libpython-all-dev python-all python-all-dev python-pip python-pip-whl python-wheel
0 upgraded, 6 newly installed, 0 to remove and 12 not upgraded.
Need to get 1,306 kB of archives.
After this operation, 2,084 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libpython-all-dev amd64 2.7.11-1 [992 B]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-all amd64 2.7.11-1 [978 B]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-all-dev amd64 2.7.11-1 [1,000 B]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip-whl all 8.1.1-2ubuntu0.4 [1,110 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip all 8.1.1-2ubuntu0.4 [144 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python-wheel all 0.29.0-1 [48.0 kB]
Fetched 1,306 kB in 2s (558 kB/s)      
Selecting previously unselected package libpython-all-dev:amd64.
(Reading database ... 190040 files and directories currently installed.)
Preparing to unpack .../libpython-all-dev_2.7.11-1_amd64.deb ...
Unpacking libpython-all-dev:amd64 (2.7.11-1) ...
Selecting previously unselected package python-all.
Preparing to unpack .../python-all_2.7.11-1_amd64.deb ...
Unpacking python-all (2.7.11-1) ...
Selecting previously unselected package python-all-dev.
Preparing to unpack .../python-all-dev_2.7.11-1_amd64.deb ...
Unpacking python-all-dev (2.7.11-1) ...
Selecting previously unselected package python-pip-whl.
Preparing to unpack .../python-pip-whl_8.1.1-2ubuntu0.4_all.deb ...
Unpacking python-pip-whl (8.1.1-2ubuntu0.4) ...
Selecting previously unselected package python-pip.
Preparing to unpack .../python-pip_8.1.1-2ubuntu0.4_all.deb ...
Unpacking python-pip (8.1.1-2ubuntu0.4) ...
Selecting previously unselected package python-wheel.
Preparing to unpack .../python-wheel_0.29.0-1_all.deb ...
Unpacking python-wheel (0.29.0-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython-all-dev:amd64 (2.7.11-1) ...
Setting up python-all (2.7.11-1) ...
Setting up python-all-dev (2.7.11-1) ...
Setting up python-pip-whl (8.1.1-2ubuntu0.4) ...
Setting up python-pip (8.1.1-2ubuntu0.4) ...
Setting up python-wheel (0.29.0-1) ...

To confirm the installation:

~$ which pip
/usr/bin/pip
~$