Thursday, May 30, 2019

Python - Bokeh - Download DataSets


On trying the example at: https://bokeh.pydata.org/en/latest/docs/gallery/texas.html , I received the following error:

RuntimeError: bokeh sample data directory does not exist, please execute bokeh.sampledata.download()

Hence, I executed the following as suggested in the message:

>>> import bokeh.sampledata
>>> bokeh.sampledata.download()
Creating /home/mhc/.bokeh directory
Creating /home/mhc/.bokeh/data directory
Using data directory: /home/mhc/.bokeh/data
Downloading: CGM.csv (1589982 bytes)
   1589982 [100.00%]
Downloading: US_Counties.zip (3171836 bytes)
   3171836 [100.00%]
Unpacking: US_Counties.csv
Downloading: us_cities.json (713565 bytes)
    713565 [100.00%]
Downloading: unemployment09.csv (253301 bytes)
    253301 [100.00%]
Downloading: AAPL.csv (166698 bytes)
    166698 [100.00%]
Downloading: FB.csv (9706 bytes)
      9706 [100.00%]
Downloading: GOOG.csv (113894 bytes)
    113894 [100.00%]
Downloading: IBM.csv (165625 bytes)
    165625 [100.00%]
Downloading: MSFT.csv (161614 bytes)
    161614 [100.00%]
Downloading: WPP2012_SA_DB03_POPULATION_QUINQUENNIAL.zip (4816256 bytes)
   4816256 [100.00%]
Unpacking: WPP2012_SA_DB03_POPULATION_QUINQUENNIAL.csv
Downloading: gapminder_fertility.csv (64346 bytes)
     64346 [100.00%]
Downloading: gapminder_population.csv (94509 bytes)
     94509 [100.00%]
Downloading: gapminder_life_expectancy.csv (73243 bytes)
     73243 [100.00%]
Downloading: gapminder_regions.csv (7781 bytes)
      7781 [100.00%]
Downloading: world_cities.zip (645274 bytes)
    645274 [100.00%]
Unpacking: world_cities.csv
Downloading: airports.json (6373 bytes)
      6373 [100.00%]
Downloading: movies.db.zip (5053420 bytes)
   5053420 [100.00%]
Unpacking: movies.db
Downloading: airports.csv (203190 bytes)
    203190 [100.00%]
Downloading: routes.csv (377280 bytes)
    377280 [100.00%]
Downloading: haarcascade_frontalface_default.xml (930127 bytes)
    930127 [100.00%]
>>> 

This has downloaded all the bokeh datasets.

Sunday, April 21, 2019

JavaScript - Angular - Installing Angular Material Module and dependencies

In order to install angular material module.  Let us install the following:

  • npm install @angular/material@6.4.7 --save
  • npm install @angular/cdk@6.4.7 --save
  • npm install @angular/animations@6.1.7 --save
  • npm install hammerjs@2.0.8 --save


Now, let us install the flex layout module:

npm install --save @angular/flex-layout@6.0.0-beta.18
npm WARN @angular/animations@6.1.7 requires a peer of @angular/core@6.1.7 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @angular/flex-layout@6.0.0-beta.18
added 1 package in 11.902s




JavaScript - Angular - Installing Angular of a specific version

Installing Angular of a specific version using npm:

$ npm install -g @angular/cli@6.2.1
/home/ubuntu/.nvm/versions/node/v8.11.1/bin/ng -> /home/ubuntu/.nvm/versions/node/v8.11.1/lib/node_modules/@angular/cli/bin/ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @angular/cli@6.2.1
added 5 packages, removed 6 packages and updated 27 packages in 11.412s


Now to check the options available with the ng command:

$ ng help
Available Commands:
  add Add support for a library to your project.
  build (b) Builds your app and places it into the output path (dist/ by default).
  config Get/set configuration values.
  doc (d) Opens the official Angular API documentation for a given keyword.
  e2e (e) 
  generate (g) Generates and/or modifies files based on a schematic.
  help Displays help for the Angular CLI.
  lint (l) Lints code in existing project.
  new (n) Creates a new directory and a new Angular app.
  run Runs Architect targets.
  serve (s) Builds and serves your app, rebuilding on file changes.
  test (t) Run unit tests in existing project.
  update Updates your application and its dependencies.
  version (v) Outputs Angular CLI version.
  xi18n Extracts i18n messages from source code.

For more detailed help run "ng [command name] --help"
$


To check for the version details:

$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.2.1
Node: 8.11.1
OS: linux x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.8.1
@angular-devkit/core         0.8.1
@angular-devkit/schematics   0.8.1
@schematics/angular          0.8.1
@schematics/update           0.8.1
rxjs                         6.2.2
typescript                   2.9.2
    


Now, let us setup one application:

$ ng new myNgApp2 --style=sass
CREATE myNgApp2/README.md (1025 bytes)
CREATE myNgApp2/angular.json (3653 bytes)
CREATE myNgApp2/package.json (1316 bytes)
CREATE myNgApp2/tsconfig.json (408 bytes)
CREATE myNgApp2/tslint.json (2837 bytes)
CREATE myNgApp2/.editorconfig (245 bytes)
CREATE myNgApp2/.gitignore (503 bytes)
CREATE myNgApp2/src/favicon.ico (5430 bytes)
CREATE myNgApp2/src/index.html (295 bytes)
CREATE myNgApp2/src/main.ts (371 bytes)
CREATE myNgApp2/src/polyfills.ts (3194 bytes)
CREATE myNgApp2/src/test.ts (642 bytes)
CREATE myNgApp2/src/styles.sass (80 bytes)
CREATE myNgApp2/src/browserslist (388 bytes)
CREATE myNgApp2/src/karma.conf.js (964 bytes)
CREATE myNgApp2/src/tsconfig.app.json (166 bytes)
CREATE myNgApp2/src/tsconfig.spec.json (256 bytes)
CREATE myNgApp2/src/tslint.json (314 bytes)
CREATE myNgApp2/src/assets/.gitkeep (0 bytes)
CREATE myNgApp2/src/environments/environment.prod.ts (51 bytes)
CREATE myNgApp2/src/environments/environment.ts (662 bytes)
CREATE myNgApp2/src/app/app.module.ts (314 bytes)
CREATE myNgApp2/src/app/app.component.sass (0 bytes)
CREATE myNgApp2/src/app/app.component.html (1141 bytes)
CREATE myNgApp2/src/app/app.component.spec.ts (1001 bytes)
CREATE myNgApp2/src/app/app.component.ts (213 bytes)
CREATE myNgApp2/e2e/protractor.conf.js (752 bytes)
CREATE myNgApp2/e2e/tsconfig.e2e.json (213 bytes)
CREATE myNgApp2/e2e/src/app.e2e-spec.ts (304 bytes)
CREATE myNgApp2/e2e/src/app.po.ts (208 bytes)
npm WARN deprecated @angular/http@6.1.10: Switch to @angular/common/http - see https://angular.io/guide/http
npm WARN deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:
npm WARN deprecated   npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.

> node-sass@4.11.0 install /home/ubuntu/Documents/ngWorks/jogesh/myNgApp2/node_modules/node-sass
> node scripts/install.js

Cached binary found at /home/ubuntu/.npm/node-sass/4.11.0/linux-x64-57_binding.node

> node-sass@4.11.0 postinstall /home/ubuntu/Documents/ngWorks/jogesh/myNgApp2/node_modules/node-sass
> node scripts/build.js

Binary found at /home/ubuntu/Documents/ngWorks/jogesh/myNgApp2/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1142 packages in 30.052s
    Successfully initialized git.


Now, let type the following command:
$ npm install
npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 8.378s


Now, let us type :

$ ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 10% building modules 3/3 modules 0 active                         



The app is now available on localhost at: http://localhost:4200/

This is a very simple bare bones application to help us get started with angular. Now, if we check the git:

$ git log --oneline
e222cd0 (HEAD -> master) initial commit



Monday, February 25, 2019

Ubuntu - Installing fonts quickly



To be able to install fonts in ubuntu quickly, I found the following link useful:
https://askubuntu.com/questions/191778/how-to-install-many-font-files-quickly-and-easily


Step 1: Create the path in home directory:
$ mkdir ~/.fonts

Step 2: Place the fonts in this folder:

~/.fonts$ ls -l
total 2096
drwxr-xr-x 2 ubuntu ubuntu    4096 Feb 25 11:02 league-spartan
-rw-rw-r-- 1 ubuntu ubuntu   21379 Feb 25 10:59 league-spartan.zip
drwxrwxr-x 2 ubuntu ubuntu    4096 Nov 29 13:15 Montserrat
-rw-rw-r-- 1 ubuntu ubuntu 2104101 Feb 25 10:59 Montserrat.zip
~/.fonts$ 

Step 3: Install the fonts using the command:

~/.fonts/Montserrat$ fc-cache -f -v
/usr/share/fonts: caching, new cache contents: 0 fonts, 6 dirs
/usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs
/usr/share/fonts/X11/Type1: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/X11/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/X11/misc: caching, new cache contents: 89 fonts, 0 dirs
/usr/share/fonts/X11/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cMap: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs
/usr/share/fonts/cmap/adobe-cns1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-gb1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-japan1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-japan2: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-korea1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/opentype/malayalam: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/opentype/noto: caching, new cache contents: 24 fonts, 0 dirs
/usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 46 dirs
/usr/share/fonts/truetype/Gargi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Gubbi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Nakula: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/tibetan-machine: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/tlwg: caching, new cache contents: 58 fonts, 0 dirs
/usr/share/fonts/truetype/ttf-khmeros-core: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/ubuntu: caching, new cache contents: 13 fonts, 0 dirs
/usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/home/mhc/.local/share/fonts: caching, new cache contents: 1 fonts, 0 dirs
/home/mhc/.fonts: caching, new cache contents: 0 fonts, 2 dirs
/home/mhc/.fonts/Montserrat: caching, new cache contents: 18 fonts, 0 dirs
/home/mhc/.fonts/league-spartan: caching, new cache contents: 1 fonts, 0 dirs
/var/cache/fontconfig: not cleaning unwritable cache directory
/home/mhc/.cache/fontconfig: cleaning cache directory
/home/mhc/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
~/.fonts/Montserrat$

We can verify that the fonts are installed by opening LibreOffice writer and typing the content is a particular font. 

Thursday, January 31, 2019

Python - install matplotlib - python3 with tkinter in Ubuntu


matplotlib

Step 1: Install matplotlib
Step 2: Install tkinter

Step 1: Install matplotlib

(python3runs01) $ pip3 install matplotlib
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/71/07/16d781df15be30df4acfd536c479268f1208b2dfbc91e9ca5d92c9caf673/matplotlib-3.0.2-cp36-cp36m-manylinux1_x86_64.whl (12.9MB)
    100% |████████████████████████████████| 12.9MB 115kB/s 
Collecting python-dateutil>=2.1 (from matplotlib)
  Using cached https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl
Collecting numpy>=1.10.0 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/7b/74/54c5f9bb9bd4dae27a61ec1b39076a39d359b3fb7ba15da79ef23858a9d8/numpy-1.16.0-cp36-cp36m-manylinux1_x86_64.whl (17.3MB)
    100% |████████████████████████████████| 17.3MB 85kB/s 
Collecting kiwisolver>=1.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/69/a7/88719d132b18300b4369fbffa741841cfd36d1e637e1990f27929945b538/kiwisolver-1.0.1-cp36-cp36m-manylinux1_x86_64.whl (949kB)
    100% |████████████████████████████████| 952kB 1.4MB/s 
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/de/0a/001be530836743d8be6c2d85069f46fecf84ac6c18c7f5fb8125ee11d854/pyparsing-2.3.1-py2.py3-none-any.whl (61kB)
    100% |████████████████████████████████| 71kB 3.6MB/s 
Collecting cycler>=0.10 (from matplotlib)
  Using cached https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil>=2.1->matplotlib)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting setuptools (from kiwisolver>=1.0.1->matplotlib)
  Using cached https://files.pythonhosted.org/packages/bf/ae/a23db1762646069742cc21393833577d3fa438eecaa59d11fb04fa57fcd5/setuptools-40.7.1-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, numpy, setuptools, kiwisolver, pyparsing, cycler, matplotlib
Successfully installed cycler-0.10.0 kiwisolver-1.0.1 matplotlib-3.0.2 numpy-1.16.0 pyparsing-2.3.1 python-dateutil-2.7.5 setuptools-40.7.1 six-1.12.0
$


Step 2: Install tkinter in ubuntu

(python3runs01) $ sudo apt-get install python3-tk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  blt libtcl8.6 libtk8.6 tk8.6-blt2.5
Suggested packages:
  blt-demo tcl8.6 tk8.6 tix python3-tk-dbg
The following NEW packages will be installed:
  blt libtcl8.6 libtk8.6 python3-tk tk8.6-blt2.5
0 upgraded, 5 newly installed, 0 to remove and 105 not upgraded.
Need to get 2,252 kB of archives.
After this operation, 9,233 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 libtcl8.6 amd64 8.6.8+dfsg-3 [881 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 libtk8.6 amd64 8.6.8-4 [693 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 tk8.6-blt2.5 amd64 2.5.3+dfsg-4 [572 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 blt amd64 2.5.3+dfsg-4 [4,944 B]
Get:5 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-tk amd64 3.6.7-1~18.04 [100 kB]
Fetched 2,252 kB in 2s (1,329 kB/s) 
Selecting previously unselected package libtcl8.6:amd64.
(Reading database ... 224648 files and directories currently installed.)
Preparing to unpack .../libtcl8.6_8.6.8+dfsg-3_amd64.deb ...
Unpacking libtcl8.6:amd64 (8.6.8+dfsg-3) ...
Selecting previously unselected package libtk8.6:amd64.
Preparing to unpack .../libtk8.6_8.6.8-4_amd64.deb ...
Unpacking libtk8.6:amd64 (8.6.8-4) ...
Selecting previously unselected package tk8.6-blt2.5.
Preparing to unpack .../tk8.6-blt2.5_2.5.3+dfsg-4_amd64.deb ...
Unpacking tk8.6-blt2.5 (2.5.3+dfsg-4) ...
Selecting previously unselected package blt.
Preparing to unpack .../blt_2.5.3+dfsg-4_amd64.deb ...
Unpacking blt (2.5.3+dfsg-4) ...
Selecting previously unselected package python3-tk:amd64.
Preparing to unpack .../python3-tk_3.6.7-1~18.04_amd64.deb ...
Unpacking python3-tk:amd64 (3.6.7-1~18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up libtcl8.6:amd64 (8.6.8+dfsg-3) ...
Setting up libtk8.6:amd64 (8.6.8-4) ...
Setting up tk8.6-blt2.5 (2.5.3+dfsg-4) ...
Setting up blt (2.5.3+dfsg-4) ...
Setting up python3-tk:amd64 (3.6.7-1~18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
(python3runs01) $


Let us now test by running the program in the following stackoverflow question:
https://stackoverflow.com/questions/31726643/how-do-i-get-multiple-subplots-in-matplotlib


Wednesday, January 30, 2019

Python - install WeasyPrint - python3



Install WeasyPrint in Python3:

(python3runs01) $ pip install WeasyPrint
Collecting WeasyPrint
  Downloading https://files.pythonhosted.org/packages/ec/0e/0d0f72e0832e9566f93d460676d8a34b2131f57424f5985604201a5102bf/WeasyPrint-44-py3-none-any.whl (354kB)
    100% |████████████████████████████████| 358kB 743kB/s 
Collecting Pyphen>=0.8 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/15/82/08a3629dce8d1f3d91db843bb36d4d7db6b6269d5067259613a0d5c8a9db/Pyphen-0.9.5-py2.py3-none-any.whl (3.0MB)
    100% |████████████████████████████████| 3.0MB 3.5MB/s 
Collecting cairocffi>=0.9.0 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/62/be/ad4d422b6f38d99b09ad6d046ab725e8ccac5fefd9ca256ca35a80dbf3c6/cairocffi-0.9.0.tar.gz (84kB)
    100% |████████████████████████████████| 92kB 7.1MB/s 
Collecting html5lib>=0.999999999 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/a5/62/bbd2be0e7943ec8504b517e62bab011b4946e1258842bc159e5dfde15b96/html5lib-1.0.1-py2.py3-none-any.whl (117kB)
    100% |████████████████████████████████| 122kB 6.4MB/s 
Collecting cssselect2>=0.1 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/12/e2/91fcd4cd32545beec6e11628d64d3e20f11b5a95dd1ccf3216fd69f176b7/cssselect2-0.2.1-py2.py3-none-any.whl
Collecting tinycss2>=0.5 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/88/95/0ec73db7fc638ec000e662936ffe1a4e1eaa22f2861c8de18b1597c42584/tinycss2-0.6.1-py2.py3-none-any.whl (61kB)
    100% |████████████████████████████████| 71kB 14.9MB/s 
Collecting cffi>=0.6 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/6d/c0/47db8f624f3e4e2f3f27be03a93379d1ba16a1450a7b1aacfa0366e2c0dd/cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl (421kB)
    100% |████████████████████████████████| 430kB 10.2MB/s 
Collecting CairoSVG>=1.0.20 (from WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/5c/57/dadc80948bcb83ea9c0968ccfd5a1a25ace6be0884484526f70dad3c10b9/CairoSVG-2.2.1-py3-none-any.whl (52kB)
    100% |████████████████████████████████| 61kB 12.6MB/s 
Collecting webencodings (from html5lib>=0.999999999->WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl
Collecting six>=1.9 (from html5lib>=0.999999999->WeasyPrint)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=0.6->WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
    100% |████████████████████████████████| 163kB 13.0MB/s 
Collecting defusedxml (from CairoSVG>=1.0.20->WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl
Collecting pillow (from CairoSVG>=1.0.20->WeasyPrint)
  Downloading https://files.pythonhosted.org/packages/85/5e/e91792f198bbc5a0d7d3055ad552bc4062942d27eaf75c3e2783cf64eae5/Pillow-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 5.4MB/s 
Building wheels for collected packages: cairocffi, pycparser
  Building wheel for cairocffi (setup.py) ... done
  Stored in directory: /home/mhc/.cache/pip/wheels/3a/2e/92/89e9dcce600a1a78bebe571fdd096669cba354b29c5e1140b9
  Building wheel for pycparser (setup.py) ... done
  Stored in directory: /home/mhc/.cache/pip/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511
Successfully built cairocffi pycparser
Installing collected packages: Pyphen, pycparser, cffi, cairocffi, webencodings, six, html5lib, tinycss2, cssselect2, defusedxml, pillow, CairoSVG, WeasyPrint
Successfully installed CairoSVG-2.2.1 Pyphen-0.9.5 WeasyPrint-44 cairocffi-0.9.0 cffi-1.11.5 cssselect2-0.2.1 defusedxml-0.5.0 html5lib-1.0.1 pillow-5.4.1 pycparser-2.19 six-1.12.0 tinycss2-0.6.1 webencodings-0.5.1
(python3runs01) $ which pip
/opt3/python3runs01/bin/pip
(python3runs01) $ pip --version
pip 19.0.1 from /opt3/python3runs01/lib/python3.6/site-packages/pip (python 3.6)
(python3runs01)



Tuesday, January 29, 2019

Python - Using virtualenv - python3


Step 1: Create a virtual environment for python3:

/opt3$ virtualenv -p python3 python3runs01
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /opt3/python3runs01/bin/python3
Also creating executable in /opt3/python3runs01/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
/opt3$ 

Step 2: Change directory to the virtual environment folder:

/opt3$ cd python3runs01

Step 3: Activate the virtual environment:

/opt3/python3runs01$ source bin/activate
(python3runs01) /opt3/python3runs01$ 

Notice that, after you activate, a prompt is added. 
(python3runs01) /opt3/python3runs01$ ls -l
total 0
drwxr-xr-x 2 ubuntu ubuntu 320 Jan 29 11:50 bin
drwxr-xr-x 2 ubuntu ubuntu  60 Jan 29 11:50 include
drwxr-xr-x 3 ubuntu ubuntu  60 Jan 29 11:50 lib
drwxr-xr-x 3 ubuntu ubuntu  60 Jan 29 11:50 share
(python3runs01) /opt3/python3runs01$


Step 4: Deactivate from virtual environment:

(python3runs01) /opt3/python3runs01$ deactivate
/opt3/python3runs01$


References: