3.2 Confirm Python Environment

Now that the environment is installed, we can confirm it by printing the versions of each required library.

1. Open Gedit.

Click “Activities“

Type “gedit“

Click icon or press enter

2. Type the following script and save it as versions.py in the home directory.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

# scipy

import scipy

print('scipy: %s'%scipy.__version__)

# numpy

import numpy

print('numpy: %s'%numpy.__version__)

# matplotlib

import matplotlib

print('matplotlib: %s'%matplotlib.__version__)

# pandas

import pandas

print('pandas: %s'%pandas.__version__)

# scikit-learn

import sklearn

print('sklearn: %s'%sklearn.__version__)

# statsmodels

import statsmodels

print('statsmodels: %s'%statsmodels.__version__)

There is no copy-paste support; you may want to open Firefox within the VM and navigate to this page and copy paste the script into your Gedit window.

Write Versions Script

3. Run the script in the terminal.

Type:

1

python3 versions.py

Python3 Check Library Versions

Tips For Using the VM

This section lists some tips using the VM for machine learning development.

Copy-paste and Folder Sharing. These features require the installation of “Guest Additions” in the Linux VM. I have not been able to get this to install correctly and therefore do not use these features. You can try if you like; let me know how you do in the comments.

Use GitHub. I recommend storing all of your code in GitHub and checking the code in and out from the VM. It makes life a lot easier for getting code and assets in and out of the VM.

Use Sublime. I think sublime is a great text editor on Linux for development, better than Gedit at least.

Use AWS for large jobs. You can use the same procedure to setup Fedora Linux on Amazon Web Services for running large models in the cloud.

VM Tools. You can save the VM at any point by closing the window. You can also take a snapshot of the VM at any point and return to the snapshot. This can be helpful if you are making large changes to the file system.

Python2. You can easily install Python2 alongside Python 3 in Linux and use the python (rather than python3) binary or use alternatives to switch between the two.

Notebooks. Consider running a notebook server inside the VM and opening up the firewall so that you can connect and run from your main workstation outside of the VM.

Do you have any tips to share? Let me know in the comments.

Further Reading

Below are some resources for further reading if you are new to the tools used in this tutorial.