Installing the Anaconda 2020-02 Python Distribution with Spyder 4.1.3 on Linux Ubuntu 20.04 and Mint 19.3

Installation Video

Installation

Go to the Anaconda website:

Select Download:

Download the Linux 64 Bit installer.

Select Save File and then OK:

Open up a terminal and type in:

cd Downloads

cd stands for change directory.

To install type in bash followed by a space and then the file name including .sh extension (note the installer may be updated so ensure the date matches that of the standalone installer):

bash Anaconda3-2020.02-Linux-x86_64.sh

Type in [Enter] multiple times to scroll through the license agreement. Then type in:

yes

to accept the agreement and proceed with the install.

Type in [Enter] to proceed with the default location.

Type in:

yes

to run conda init.

Once done, close the terminal.

Updating Anaconda

Open up a new terminal and type in:

conda update anaconda

Type in

y

to proceed with update Anaconda.

Wait for the update to proceed.

Update Anaconda Navigator

To update the Anaconda Navigator type in:

conda update anaconda-navigator

Type in

y

To proceed with the update.

Now that this is updated, the Anaconda installation and Anaconda navigator should work correctly on Linux Mint:

Launch Anaconda Navigator

To launch Anaconda navigator type in:

anaconda-navigator

You can then launch Spyder:

Launching Spyder and Installing Kite

When Spyder is initially launched you will be prompted to install Kite. Select Install Now:

Wait for Kite to download and install:

You can close Kite when it is installed:

Check Dependencies

Before using Spyder, it is worthwhile to check its dependencies. Go to help and then Dependencies:

They should all be ticked:

Changing to the Spyder Light Theme

Select Tools and then Preferences:

If you have a high resolution screen. Select General and Enable auto high DPI scaling.

Select Appearance. Under Syntax Highlighting Theme change Spyder Dark to Spyder:

Select Apply:

Select yes to restart Spyder

Running a Script for the First Time and Accessing Variables from within the Console

Let's create a variable:

a=1

We can then select the run button:

At first launch, you will be given the run settings. If you want to access variables from the console in a script. Check "Run in console's namespace instead of an empty one", this was enabled by default in Spyder 3:

If you don't have this setting enabled the script won't be able to access variables created from earlier scripts or from the console. Here a is present in the variable explorer but the script cannot find it:

These settings can also be accessed by selecting Tools then Preferences:

The run tab shows the settings above:

Plot Settings

We can put together a very basic test script to create a plot:

import numpy as np
import matplotlib.pyplot as plt
x=np.arange(start=0,stop=10,step=1)
y=np.arange(start=0,stop=10,step=1)
plt.figure()
plt.clf()
plt.plot(x,y)
plt.show()

By default plots will display inline within the plots pane.

The backend can be changed to automatic in order to plot a graph in its own dedicated window by typing the following in the console:

%matplotlib auto

It can also be reverted to inline using:

%matplotlib inline

This change will be made only for the current session and will revert to a default setting once the kernal has been restarted. To change the default setting, go to Tools and Preferences:

To the left hand side, select IPython console. Select the graphics tab. Change the backline to either automatic or inline:

Select Apply:

How to Use Spyder 4

I have created a Getting Started with Spyder 4 guide focusing on Core Python fundamentals.

And additional details on the Numeric Python (numpy) library and the matplotlib plotting library which are the most commonly used Python libraries in Data Science.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.