Custom Search

Tuesday, May 30, 2017

How to install NumPy SciPy Matplotlib for Python 3 and Python 2.7

1)
#For Python 2.7
sudo apt-get install python-pip python-dev

sudo pip install numpy scipy matplotlib
sudo pip uninstall numpy scipy matplotlib
OR
sudo apt-get install python-numpy python-scipy python-matplotlib
sudo apt-get purge python-numpy python-scipy python-matplotlib

2)
#For python 3 and abov
e
sudo apt-get install python3-pip python3-dev

sudo pip3 install numpy scipy matplotlib
sudo pip3 uninstall numpy scipy matplotlib
OR
sudo apt-get install python3-numpy python3-scipy python3-matplotlib
sudo apt-get purge python3-numpy python3-scipy python3-matplotlib

How to install NumPy SciPy Matplotlib for Python 3 3.5 3.6

1)
sudo apt-get install python3-pip python3-dev

2)
sudo pip3 install numpy scipy matplotlib
sudo pip3 uninstall numpy scipy matplotlib
OR
sudo apt-get install python3-numpy python3-scipy python3-matplotlib
sudo apt-get purge python3-numpy python3-scipy python3-matplotlib

Monday, May 29, 2017

How to Install NumPy for Python 3.5 3.6

1)
sudo apt-get install python3-pip python3-dev

2)
Install or Uninstall numpy
sudo pip3 install numpy
sudo pip3 uninstall numpy

OR

sudo apt-get install python3-numpy
sudo apt-get purge python3-numpy


How to Install SciPy for Python 3.5 3.6

1)
sudo apt-get install python3-pip python3-dev

2)
Install/Uninstall scipy
sudo pip3 install scipy
sudo pip3 uninstall scipy

OR

sudo apt-get install python3-scipy
sudo apt-get purge python3-scipy

Wednesday, May 24, 2017

How to Install TensorFlow with Docker on Ubuntu 17.04 16.04

https://docs.docker.com/engine/installation/linux/ubuntu/

1)
Uninstall old versions of Docker
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them:

$ sudo apt-get remove docker docker-engine

2)
Install packages to allow apt to use a repository over HTTPS:

$sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

3)
Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4)
Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
$ sudo apt-key fingerprint 0EBFCD88

5)
Use the following command to set up the stable docker ubuntu repository.

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

6)
Install Docker
Update the apt package index.
$ sudo apt-get update

7)
Install the latest version of Docker.
$ sudo apt-get install docker-ce

OR

Install a specific version of Docker.
$ sudo apt-get install docker-ce=

8)
Verify that Docker CE.
$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Docker is installed and running. You need to use sudo to run Docker commands.

9)
Following command launches the latest TensorFlow CPU binary image in a Docker container from which you can run TensorFlow programs in a shell:

$ docker run -it gcr.io/tensorflow/tensorflow bash


10)
Validate your installation.

Run a short TensorFlow program

Invoke python from your shell as follows:

$ python

Enter the following short program inside the python interactive shell:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

How to Install Tensorflow with Anaconda on Ubuntu 17.04 16.04

1)
Download Anaconda

https://www.continuum.io/downloads

2)
Install Anaconda

$ bash Anaconda3-4.3.1-Linux-x86_64.sh

3)
Create a conda environment

$ conda create -n mycondaenv

4)
Activate the conda environment

$ source activate mycondaenv

5)
$python

6)
Find URL of TensorFlow Python package

https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package

7)

Install TensorFlow
$ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp36-cp36m-linux_x86_64.whl

8)
$python
>>> import tensorflow

How to Install Anaconda with Python 3.6 on Ubuntu 17.04 16.04

1)
Download Anaconda

https://www.continuum.io/downloads

2)
Install Anaconda

$ bash Anaconda3-4.3.1-Linux-x86_64.sh

3)
Create a conda environment

$ conda create -n mycondaenv

4)
Activate the conda environment

$ source activate mycondaenv

5)
$python

Tensorflow Hello World Program

$ python

Enter the following short program inside the python interactive shell:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

How to Install TensorFlow with Docker on Ubuntu 17.04 16.04 14.04

1)
Install Docker
http://fosshelp.blogspot.com/2017/05/how-to-install-latest-docker-ce-on.html

2)
Following command launches the latest TensorFlow CPU binary image in a Docker container from which you can run TensorFlow programs in a shell:


$ docker run -it gcr.io/tensorflow/tensorflow bash

3)
Validate your installation.


Run a short TensorFlow program

Invoke python from your shell as follows:

$ python

Enter the following short program inside the python interactive shell:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))


>>> print(sess.run(hello))
Hello, TensorFlow!
>>>


How to install latest Docker CE on Ubuntu 17.04 16.04 Linux Debian

https://docs.docker.com/engine/installation/linux/ubuntu/

1)
Uninstall old versions of Docker

Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them:

$ sudo apt-get remove docker docker-engine

2)
Install packages to allow apt to use a repository over HTTPS:


$sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

3)
Add Docker’s official GPG key:


$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4)
Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.

$ sudo apt-key fingerprint 0EBFCD88

5)
Use the following command to set up the stable docker ubuntu repository.


$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

6)
Install Docker

Update the apt package index.
$ sudo apt-get update

7)
Install the latest version of Docker.

$ sudo apt-get install docker-ce

OR

Install a specific version of Docker.
$ sudo apt-get install docker-ce=

8)
Verify that Docker CE.

$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Docker is installed and running. You need to use sudo to run Docker commands.

Python 3.5 How to Install TensorFlow

1)
Install pip3 and virtualenv.


$ sudo apt-get install python3-pip python3-dev python-virtualenv

2)
Create a virtualenv environment.


$ virtualenv -p python3.5 --system-site-packages myenv

3)
Activate the virtualenv environment


$ source myenv/bin/activate

4)
Install TensorFlow in the active virtualenv environment


$ pip3 install --upgrade tensorflow

5)
Test
$ python3.5
import tensorflow

Python 3 How to Install TensorFlow

1)
Install pip3 and virtualenv.


$ sudo apt-get install python3-pip python3-dev python-virtualenv

2)
Create a virtualenv environment.


$ virtualenv -p python3 --system-site-packages myvenv

3)
Activate the virtualenv environment


$ source myvenv/bin/activate

4)
Install TensorFlow in the active virtualenv environment


$ pip3 install --upgrade tensorflow

5)
Test
$ python3
import tensorflow


Tuesday, May 23, 2017

How to Install TensorFlow on Ubuntu 17.04 16.04

1)
Install pip and virtualenv.


$ sudo apt-get install python-pip python-dev python-virtualenv

2)
Create a virtualenv environment.


$ virtualenv --system-site-packages myvenv

3)
Activate the virtualenv environment


$ source myvenv/bin/activate

4)
Install TensorFlow in the active virtualenv environment


$ pip install --upgrade tensorflow

5)
Test

$ python
import tensorflow

Wednesday, May 17, 2017

Golang Go no new variables on left side of :=


$vim test.go

package main

import "fmt"

func main() {
    //var age int = 42
    //age := 42
    var age int
    age := 42
    fmt.Printf("%#v\n", age)
}




OutPut:
======

$go run test.go
# command-line-arguments
./test.go:8: no new variables on left side of :=
$

Golang Go Primitive data types

package main

import "fmt"

//int, uint, int8, uint8
//string
//float32, float64
//bool
//complex64, complex128



func main(){

    fmt.Printf("Value: %v, Type: %T\n", "Hello", "Hello")
    fmt.Printf("Value: %v, Type: %T\n", 8, 8)
    fmt.Printf("Value: %v, Type: %T\n", uint(9), uint(9))
    fmt.Printf("Value: %v, Type: %T\n", int8(6), int8(6))
    fmt.Printf("Value: %v, Type: %T\n", true, true)
    fmt.Printf("Value: %v, Type: %T\n", 4.1, 4.1)
    fmt.Printf("Value: %v, Type: %T\n", (1 + 5i), (1 + 5i))
}

OutPut:
=========
$go run primitive_types.go

Value: Hello, Type: string
Value: 8, Type: int
Value: 9, Type: uint
Value: 6, Type: int8
Value: true, Type: bool
Value: 4.1, Type: float64
Value: (1+5i), Type: complex128
$
 

Tuesday, May 16, 2017

Golang Go Programming Setup GOPATH and install package

a)
Create workspace directory structure
$mkdir mygoproject
$cd mygoproject
$mkdir bin
$mkdir src
$mkdir pkg

b)
Export path of workspace and bin directory.
$export GOPATH=$HOME/golang_tuto/mygoproject
$export PATH=$GOPATH/bin:$PATH



c)
Install dependency packages in workspace:
$go get github.com/gorilla/mux
$go get -u github.com/gorilla/mux

d)
Then check bin, src and pkg directories fo workspace.
$ls mygoproject/bin
$ls mygoproject/src
$ls mygoproject/pkg

go golang how to remove packages installed with go get

a)
Install package
$go get -x github.com/gorilla/mux



b)
Remove package
$go clean -i -x github.com/gorilla/mux

golang go how to install package from Github

a)
Create workspace directory structure

$mkdir myproject
$cd myproject
$mkdir bin
$mkdir src
$mkdir pkg

b)
Export path of workspace and bin directory.

$export GOPATH=$HOME/golang_tuto/myproject
$export PATH=$GOPATH/bin:$PATH






c)
Install dependency packages in workspace:

$go get github.com/gorilla/mux
$go get -u github.com/gorilla/mux

$go get golang.org/x/crypto/bcrypt
$go get -u golang.org/x/crypto/bcrypt

$go get golang.org/x/tools/cmd/goimports

d)
Then check bin, src and pkg directories of workspace.

$ls myproject/bin
$ls myproject/src
$ls myproject/pkg

How does the golang go build command work

$go build --help
$go build -x hello.go
$go build -x -work hello.go



$go build -x -a hello.go
$go build -x -n hello.go

go golang How to install dependency packages in workspace

a)
Create workspace directory structure
$mkdir mygoproject
$cd mygoproject
$mkdir bin
$mkdir src
$mkdir pkg

b)
Export path of workspace and bin directory.
$export GOPATH=$HOME/golang_tuto/mygoproject
$export PATH=$GOPATH/bin:$PATH



c)
Install dependency packages in workspace:
$go get github.com/gorilla/mux
$go get -u golang.org/x/crypto/bcrypt
$go get golang.org/x/tools/cmd/goimports

d)
Then check bin, src and pkg directories fo workspace.
$ls mygoproject/bin
$ls mygoproject/src
$ls mygoproject/pkg



go Golang How to create workspace for a project

a)
Create workspace directory structure
$mkdir mygoproject
$cd mygoproject
$mkdir bin
$mkdir src
$mkdir pkg



b)
Export path of workspace and bin directory.
$export GOPATH=$HOME/golang_tuto/mygoproject
$export PATH=$GOPATH/bin:$PATH


c)
Test workspace by installing a package from github:

$go get github.com/gorilla/mux
 

How to install latest Go Compiler on GNU/Linux

a)
Download Go compiler from https://golang.org/dl/

b)
Extract it ($HOME/golang_tuto/)

c)
Create a new directory for your go project ($HOME/golang_tuto/mygo)



d)
Add the following lines to your $HOME/.bashrc
export GOROOT=$HOME/golang_tuto/go
export PATH=$GOROOT/bin:$PATH

export GOPATH=$HOME/golang_tuto/mygo
export PATH=$GOPATH/bin:$PATH

e)
$go help


f)
$vim hello.go

package main

import "fmt"

func main() {
    fmt.Println("Hello World")
}

g)
$go build hello.go
$./hello

OR

$go run hello.go