Python in Ubuntu - mikedorais/python_learning GitHub Wiki

Python In Ubuntu

Created Friday 10 March 2017

Pip is used to install python packages: sudo apt-get install python3-pip

pip3 install --upgrade pip

Jupyter notebooks are a popular way of running Python interactively in a web browser with ability to view results in the page in a visual representation not possible from a REPL. Also the activity can be saved in a "notebook".

pip3 install jupyter

Miniconda might be enough, to get conda, but I couldn't find the right version to go with the Python 3.5.2 version that is on Ubuntu 16.0.4

So I found this:

https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-16-04

Installing Anaconda

The best way to install Anaconda is to download the latest Anaconda installer bash script, verify it, and then run it.

Find the latest version of Anaconda for Python 3 at the Anaconda Downloads page. At the time of writing, the latest version is 4.2.0, but you should use a later stable version if it is available.

Next, change to the /tmp directory on your server. This is a good directory to download ephemeral items, like the Anaconda bash script, which we won't need after running it.

cd /tmp

Use curl to download the link that you copied from the Anaconda website:

curl -O https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh

We can now verify the data integrity of the installer with cryptographic hash verification through the SHA-256 checksum. We’ll use the sha256sum command along with the filename of the script:

sha256sum Anaconda3-4.2.0-Linux-x86_64.sh

You’ll receive output that looks similar to this:

Output 73b51715a12b6382dd4df3dd1905b531bd6792d4aa7273b2377a0436d45f0e78 Anaconda3-4.2.0-Linux-x86_64.sh

You should check the output against the hashes available at the Anaconda with Python 3 on 64-bit Linux page for your appropriate Anaconda version. As long as your output matches the hash displayed in the sha2561 row then you’re good to go.

Now we can run the script:

bash Anaconda3-4.2.0-Linux-x86_64.sh

You’ll receive the following output:

Output

Welcome to Anaconda3 4.2.0 (by Continuum Analytics, Inc.)

In order to continue the installation process, please review the license agreement. Please, press ENTER to continue

Press ENTER to continue and then press ENTER to read through the license. Once you’re done reading the license, you’ll be prompted to approve the license terms:

Output Do you approve the license terms? [yes|no]

As long as you agree, type yes.

At this point, you’ll be prompted to choose the location of the installation. You can press ENTER to accept the default location, or specify a different location to modify it.

Output Anaconda3 will now be installed into this location: /home/sammy/anaconda3

  • Press ENTER to confirm the location
  • Press CTRL-C to abort the installation
  • Or specify a different location below

[/home/sammy/anaconda3] >>>

The installation process will continue, it may take some time.

Once it’s complete you’ll receive the following output:

Output ... installation finished. Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/sammy/.bashrc ? [yes|no] [no] >>>

Type yes so that you can use the conda command. You’ll next see the following output:

Output Prepending PATH=/home/sammy/anaconda3/bin to PATH in /home/sammy/.bashrc A backup will be made to: /home/sammy/.bashrc-anaconda3.bak ...

In order to activate the installation, you should source the ~/.bashrc file:

source ~/.bashrc

Once you have done that, you can verify your install by making use of the conda command, for example with list:

conda list

You’ll receive output of all the packages you have available through the Anaconda installation:

Output

packages in environment at /home/sammy/anaconda3:

_license 1.1 py35_1
_nb_ext_conf 0.3.0 py35_0
alabaster 0.7.9 py35_0
...

===========

Notes from Esri seminar for Python API for ArcGIS

Download Anaconda now.

First isntall Anaconda which installs conda on your system.

Will isntall conda, Panda, Jupyter Notebook,

conda install -c esri arcgis

jupyter notebook

Or from Arc GIS Pro Python Conda packages Python Package Manager