Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Artificial Intelligence for Search

You're reading from   Hands-On Artificial Intelligence for Search Building intelligent applications and perform enterprise searches

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789611151
Length 124 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Devangini Patel Devangini Patel
Author Profile Icon Devangini Patel
Devangini Patel
Arrow right icon
View More author details
Toc

Installing and setting up libraries

Before we get into the basic concepts of searching, we will take a look at the following libraries that have to be installed and how to install them in Windows:

  • Pip: The tools for installing Python packages are as follows:
    • Pydot: A Python interface to Graphviz's DOT language
    • Matplotlib: This is a Python 2D plotting library

Execute the steps in the following section to install the preceding libraries.

Setting up Python

The steps for setting up Python are as follows:

  1. For the applications in this book, we'll be using Python 2.7.6, which we can download from https://www.python.org/downloads/.
  2. Once an appropriate installer has been downloaded, double-click on it and go ahead with the default options.
  3. Based on your operating system, select the Python installer to download, as shown in the following screenshot:
Figure 1
  1. The following screenshot shows the location where Python will be installed; make a note of this location:
Figure 2

Now, Python will be installed.

  1. The next step is to add Python's path to the Path environment variable. In the System Properties | Advanced tab, click on the Environment Variables... button.
  2. In the Environment Variables… window, go to System variables | Path and add the Python location that you made a note of in step 4 (which is C:\Python27 in our case).
  1. Now, to check whether Python works, open the Command Prompt and type in the python -- version command. You will get the following output:
Figure 3

The output shown in the preceding screenshot confirms that Python has been installed successfully.

Depending on your OS, Python might already be installed.

Setting up Graphviz

The following steps describe how to set up Graphviz:

  1. We can download the graph visualization software from https://graphviz.gitlab.io/download/.
  2. Since we are using Windows, we select the option that says Stable 2.38 Windows install packages, as shown in the following screenshot:
Figure 4

Select the .msi downloadable file, shown as follows:

Figure 5
  1. Once the Graphviz executable has downloaded, go ahead and install the file with the default options; again, make a note of the path, as shown in the following screenshot:
Figure 6
  1. Now, we will add Graphviz's bin folder to the path variable, as we did when installing Python in the previous section. Then, copy the location where Graphviz is installed and append \bin, as shown in the following screenshot:
Figure 7
  1. To validate whether this library has been installed properly, open a new Command Prompt window and type the dot -V command, and you will get the following result:
Figure 8

The output shown in the preceding screenshot confirms that Graphviz has been installed successfully.

Installing pip

The steps for installing pip are as follows:

  1. To install pip, you need to download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py, and make a note of the path where the file is located. In my case, the file is located at Documents\ai\softwares.
  2. Open the Command Prompt and go to the Documents\ai\softwares folder by using the cd command, as shown in the following screenshot:
Figure 9
  1. Use the dir command to take a look at the contents of this folder, where you will see get-pip.py, shown in the following screenshot:
Figure 10
  1. Next, we'll run the python get-pip.py command.
  2. Now, let's add Python's scripts folder to the Path environment variable.
  3. Open another Command Prompt window and test the installation of pip by typing the pip --version command. Upon successful installation, you will get the following output:
Figure 11
  1. Once pip has installed, you can install pydot by running the following command:
pip install pydot 
  1. Finally, install matplotlib by executing the following command:
pip install matplotlib  
  1. We can check whether the libraries have been installed properly by using the import command in Python's interpreter, as shown in the following screenshot:
Figure 12

Now, we're done installing the libraries that we will need in Windows for this book . In the next topic, we will look at how we can go about developing a file search application.

You have been reading a chapter from
Hands-On Artificial Intelligence for Search
Published in: Aug 2018
Publisher: Packt
ISBN-13: 9781789611151
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime