Artificial Intelligence and Machine Learning are definitely making the headlines again, and developers are starting to make use of it in applications. Getting started with AI is not as easy as it should be.
Setting up a development environment in order to run through a number of tutorials available is also a difficult task for a lot of developers especially if those developers are not familiar with Python and its ever-expanding ecosystem.
How to develop AI enabled applications with Python on Ubuntu 18.04
If you are taking the time to learn how to develop in Python, then there is a good chance that you will enevitably be interested in developing applications for large-scale data processing, predictive analytics, scientific computing, Machine Learning (ML) or Artificial Intelligence (AI).
These types of projects will typically require the creation of a number of different operating environments using possibly different versions of Python or even library versions to work.
For instance, TensorFlow, which is a popular machine learning library, is not compatible with Python 3.7 and in most
This is where Virtual Environments are ideal. Python comes prepackaged with a Virtual Environment tool, called
What is Anaconda
Anaconda is an open-source package manager, environment manager, and distribution of the Python and R programming languages. It is commonly used for large-scale data processing, scientific computing, and predictive analytics, serving data scientists, developers, business analysts, and those working in DevOps.
Package versions are managed by the package management system
The Anaconda distribution is used by over 6 million users and includes more than 250 popular data-science packages suitable for Windows, Linux, and Mac.
The first step to installing Anaconda on Ubuntu 18.04 is to download the Anaconda installer for
The name of the file will typically start with Anaconda but will then include a version number and environment i.e.
Anaconda3-2018.12-Linux-x86_64 we will just use the descriptor Anaconda-latest-Linux-x86_64.sh to refer to file
Depending on how you have your Ubuntu configured you can install Anaconda with or without
To install anaconda with
After the install is complete, you should see a new folder in your Home directory :
Once the Anaconda installation has completed you can now start using it. To verify that anaconda has been installed, you can simply use the command
python in a terminal window and see a response similar too :
You’ll notice that Anaconda is now included within your python version information. You can use
quit() to exit out.
To check which packages are installed you use the command
conda list which will list all the libraries available.
If you would like a friendly user interface to anaconda simply use the command
anaconda-navigator the Anaconda Navigator will be displayed
Conda is package and environment management system that helps to quickly install run and update packages and their dependencies.
Conda also helps to easily create, save, load and switch between different environments on your local computer. It was specifically created for Python but is flexible enough to package and distribute software for any language.
Conda can be combined with continuous integration systems such as Travis CI and AppVeyor to provide frequent, automated testing of your code.
If you have followed the steps detailed above you should have conda installed, to double check this you can check which version of conda is installed by using the following terminal command
To check if there are any updates to your conda environment you can use the following command to update
Create an environment using Conda
Conda makes it super easy to create separate environments containing files, packages and dependencies which are isolated and won’t interfere with other environments.
When you installed Conda a default environment was created called
base. Ideally, you shouldn’t create or put applications into your base environment, you should create separate environments to keep your programs isolated from each other.
If you installed Anaconda using the instructions above, you’ll have noticed we installed
Python 3.7 which is the latest version of Python, but what if you wanted to develop an application using a specific version of Python, for instance maybe an AI or machine learning application making use of TensorFlow which may restrict you to using Python 3.6
You can easily create an environment, in my case, I will call it
I can then activate that environment
Then I can install Tensorflow to that environment
In 1 simple line of code we have now created a python environment already configured with TensorFlow and we can now start developing straight away.
Let’s build on that environment. Let’s say we would
A popular python library called
We can install textract to our environment quite easily using
We can now start our development environment, typically a Text Editor or an Integrated Development Environment.
Anaconda is the fastest and easiest way to do Python and R data science and machine learning on Linux. It’s the defacto industry standard for developing, testing, and training on a single machine.
Conda is an open source package management system and environment management system that runs on Linux. Conda quickly installs, runs and updates packages and their dependencies.
Conda easily creates, saves, loads and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language.
A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.
Latest posts by Gary Woodfine (see all)
- How to start a new project using Vue.js - April 29, 2019
- How to install DynamoDb on local Ubuntu Development - April 17, 2019
- Why every business needs a web maintenance retainer - March 11, 2019