Getting a Good Anaconda Install

Some people may have misinterpreted the content at the beginning of Chapter 3 in Python for Data Science for Dummies. It isn’t necessary to install the products listed in the Considering the Off-the-Shelf Cross-Platform Scientific Distributions section starting on Page 39. These products are for those of you who would like to try a development environment other than the one used in the book, which is Anaconda 2.1.0. However, unless you’re an advanced user, it’s far better to install Anaconda 2.1.0 so that you can follow the exercises in the book without problem. Installing all of the products listed in Chapter 3 will result in a setup that won’t work at all because the various products will conflict with each other.

Because Continuum has upgraded Anaconda, you need to download the 2.1.0 version from the archive at https://repo.continuum.io/archive/.There are separate downloads for Windows, Mac OS X, and Linux.  The chapter tells you precisely which file to download.  For example, for Windows you’d download Anaconda-2.1.0-Windows-x86_64.exe. The point is to use the same version of Anaconda as you find in the book. You can find the installation instructions on Page 41 if you have a Windows system, Page 45 if you have a Linux system, or Page 46 if you have a Mac OS X system.  Make sure you download the databases for the book by using the procedures that start on page 47.

Following this process is the best way to ensure you get a good installation for Python for Data Science for Dummies. Luca and I want to make certain that you can use the book to discover the wonders of data science without having to jump through a lot of hoops to do it. Please feel free to contact me at John@JohnMuellerBooks.com if you have any questions about the installation process.

 

Installing Python Packages (Part 2)

In the Installing Python Packages (Part 1) post, you discovered the easiest method of installing new packages when working with Beginning Programming with Python For Dummies, Python for Data Science for Dummies, and Machine Learning for Dummies. Using the pip command is both fast and easy. However, it doesn’t provide much in the way of feedback when things go wrong. To overcome this issue, you can use the conda command in place of pip when you have Anaconda installed on your system. Like pip, conda supports a wide variety of commands. You can find a listing of these commands at http://conda.pydata.org/docs/using/pkgs.html.

You need to know a few things about working with conda. The first is that you need to open an Anaconda prompt to use it. For example, when working with Windows, you use the Start ⇒ All Programs ⇒ Anaconda<Version> ⇒ Anaconda Prompt command to open a window like the one shown here where you can enter commands. (Your Anaconda Prompt may look different than the one shown based on the platform you use and the version of Anaconda you have installed.)

Use the Anaconda Prompt to gain access to the conda command.
The Anaconda Prompt

You can easily discover the features the conda command supports by typing conda -h and pressing Enter. You see a list of command line switches similar to the ones shown here:

Use the conda command line switches to perform various tasks.
A Listing of Conda Switches

As you can see, there are quite a few tasks you can perform. To determine whether you have a package installed, use the Conda search <package name> command.  For example, if you want to determine if you have Pandas installed, you type Conda search Pandas and press Enter.  You see a list of Pandas versions installed, assuming that Pandas is installed, like this:

Use the search switch to locate a particular package installation.
A Listing of Pandas Information

The information you get from conda is far more in depth than pip provides. To determine what you have installed, just go down the list and determine whether you have the version of Pandas that you need.  If you don’t, then type Conda update pandas and press Enter (notice the case used).  On the other hand, let’s say you want to install BeautifulSoup.  Well, the first time through, try typing Conda install BeautifulSoup and pressing Enter.  You see an error message that tells you what to type like this:

The conda command provides you with helpful error information.
Using Error Information

Since you want to install the latest BeautifulSoup, type Conda install beautiful-soup and press Enter.  After searching for the required update information, conda will ask if you want to proceed.  Type y and press Enter.  You’ll see a whole bunch of activity take place, but eventually, you have a new version of BeautifulSoup, plus all the supporting functionality, installed correctly in the correct locations.  Here’s how things looked on my system:

Conda provides detailed information about the installation process.
Viewing the Result of an Installation

At this point, you have BeautifulSoup installed. Installing other packages follows the same path. Using conda does require a little more expertise than using pip, but you also gain additional flexibility and garner more information. When everything goes well, either tool does an equally good job of getting the installation or update task done, but conda excels in helping you past troublesome installations. Let me know your thoughts about using conda to install the packages required by my books at John@JohnMuellerBooks.com.

 

Installing Python Packages (Part 1)

My Python-related books, Beginning Programming with Python For Dummies, Python for Data Science for Dummies, and Machine Learning for Dummies use various libraries to perform book-specific tasks. The books do provide instructions as needed, but, based on reader input, sometimes these instructions aren’t as clear as necessary, located in precisely the right location, or possibly as specific as needed. This post will help you get the packages containing the libraries you need installed in order to get more from the books.

It’s essential to remember that Beginning Programming with Python for Dummies relies on the 3.3.4 version of Python. The other two books rely on Python 2.7.x versions. The reason for using the older version of Python in these two books is that these books rely on libraries that Python 3.x doesn’t support. If you try to install these libraries on Python 3.x, you’ll get an error message of somewhat dubious usefulness.

In most cases, the easiest way to install a package is to open a command prompt with Administrator privileges and rely on the pip (for Python 2.x) or pip3 (for Python 3.x) command to perform the installation. For example, to install BeautifulSoup, you can type pip install beautifulsoup4 and press Enter. Installing any other package follows about the same route.

The only problem with the pip utility is that you don’t get it with every version of Python. When using an older version of Python, such as 3.3.4, you actually need to install the pip utility to use it. Fortunately, the installation instructions at https://pip.pypa.io/en/latest/installing/ aren’t difficult to use and you’ll be up and running in a few minutes.

Some readers have also complained that pip doesn’t provide much information when it comes to errors. The lack of information can prove problematic when an installation doesn’t go as planned. Next week I plan to cover the conda utility that comes with Anaconda. This utility isn’t as easy to use in some respects as pip, but it does provide considerably more information. If you have any questions about using the pip utility with my books, please contact me at John@JohnMuellerBooks.com.

 

Mac Gatekeeper Error

A number of my books, such as C++ All-In-One for Dummies, 3rd EditionBeginning Programming with Python For Dummies, Python for Data Science for Dummies, and Machine Learning for Dummies ask readers to download an IDE or other code and install it on their Mac systems. The problem is that the Mac system won’t always cooperate. For example, you might see an error dialog like the one shown for Code::Blocks:

The Gatekeeper error tells you that it won't allow you to install software from unknown publishers.
Your Mac won’t let you install software.

The problem is one of permissions. The default permissions set for newer Mac systems restrict you to getting your apps from the Mac App Store or from vendors who have signed their files. Fortunately, you can overcome this problem either temporarily or permanently, depending on how you want to use your Mac. The Fix the “App can’t be opened because it is from an unidentified developer” Error in Mac OS X blog post provides you with illustrated, step-by-step directions to perform the task using either method. Let me know if you encounter any other problems getting your Mac to install the software required to use my books at John@JohnMuellerBooks.com.

 

Getting CodeBlocks to Work – An Update

Quite a while ago, at least in computer technology terms, I wrote the Getting CodeBlocks to Work post to make it easier for readers to obtain a good copy of CodeBlocks to use with C++ All-In-One Desk Reference For Dummies. It seems that some of the information I provided at that time has become outdated.

While the http://www.codeblocks.org/downloads/5 link still works fine, some of the other links may not. A reader recently pointed out that the automated installer location has changed. When you go to the original automated installer site, you now see a number of links, including one listed as Download mingw-get-inst-20111118.exe (591.9 kb ).

Clicking the new link will automatically start a download of the latest automated installer. When the download is complete, you can install your copy of CodeBlocks. Another link to the same download is http://sourceforge.net/projects/mingw/. The point is that there is a download that will work with your system, no matter what system you’re using.

If anyone encounters a problem with these latest downloads, please let me know at John@JohnMuellerBooks.com. I want to be certain that you have a great learning experience when working with my books.

 

Using CodeBlocks 10.05 – Part 1

The content of C++ All-In-One Desk Reference For Dummies is currently designed around CodeBlocks 8.02, which is actually the next to the last version released (it’s not that oldthere doesn’t appear to be a version 9.0 product to download). Many of you have noticed that CodeBlocks 10.05 has been released recently and wonder if you can use it for the book. Of course, that’s a loaded question answered by two simple words, “It depends…” What it mostly depends upon is your skill as a developer and as a reader. If you’re an absolute novice, I highly recommend that you continue using the 8.02 release that you can obtain using the procedure found in my Getting CodeBlocks to Work post. If you’re working with a Mac, please use the procedure found in my CodeBlocks on a Macintosh post instead.

If you’ve worked with other languages and have more than a passing familiarity with your computer, you can probably use CodeBlocks 10.05 with this book. You can obtain the latest version at http://www.codeblocks.org/downloads/26. Make sure you download the proper version for your platform. For the PC, that means downloading the codeblocks-10.05mingw-setup.exe file from the site and installing it on your system. Macintosh users will require the codeblocks-10.05-p1-mac.dmg file. In addition, you’ll need to download the Xcode tools from Apple as described in the CodeBlocks on a Macintosh – Part 2 post.

There are certain differences you’ll notice immediately. For one thing, the screenshots in the book won’t precisely match what you see on screen. The next several posts for this book will examine the new CodeBlocks 10.05 and how it differs from its predecessor. These posts won’t replace a complete book, so you can’t assume that this is any sort of update for C++ All-in-One Desk Reference for Dummiesview them more as heads up articles on what you should expect.

In order to gather this material, I decided to perform a default installation of CodeBlocks 10.05. So, if you’ve decided to perform a full install or add some special features, you may still see some differences on your screen than you see in these posts. The best advice I can offer is to perform the default install and then work up to those special features later.

One of the first differences you’ll notice with the 10.05 installation is that the installer makes it obvious that it either did or didn’t detect your favorite compiler. This was a problem with the 8.02 version and I’ve had more than a few e-mails about it. Here’s the detection screen you should see after you complete the installation.

CodeBlocks10_05Part1_1

Notice that it has detected the GNU GCC compiler. This is the compiler you need for the book. If you don’t see this detection notice, it means that something has gone wrong with the installation. This is especially true on the Mac where you need to install the Xcode developer tools before you attempt the CodeBlocks installation.

The process for creating a new project is precisely the same as the 8.02 release. You still choose File > New > Project. However, you’ll notice that CodeBlocks 10.05 provides a significant number of new templates as shown here.

CodeBlocks10_05Part1_2

You won’t find any of these new templates in C++ All-in-One Desk Reference for Dummies, but I’d love to hear about any template that you consider essential for the success of a book update. Creating a console project appears to work the same as described in the book. So, you should be able to go through these early chapters without any problem. Please do let me know about any differences you see so that I can discuss them in another post.

One big difference that I noted while working with the book’s source code is that if you try to open a project by double clicking the .CBP file (such as SayHello.cbp for the first project in the book), you’ll get an error message saying that there is already an instance running and that you can’t open another instance of CodeBlocks. If you see this message, simply close the current copy of CodeBlocks and try again. As an alternative, you can use the File > Open command in CodeBlocks to open the second project.

If you simply want to see the example run, choose Build > Run to start it. You can also press Ctrl+F10 or click Run on the Compiler toolbar to get the same result. The output will look similar to the screenshots shown in the book. The debugger does work a little differently and I intend to discuss it in a future post.

So far I haven’t found any examples in the book that won’t run with the new compiler. However, I haven’t fully tested all of the examples yet, so you might find something that doesn’t work as advertised. If you find any examples that fail to work, please be sure to let me know at John@JohnMuellerBooks.com. Remember that the screenshots could look different than those you see in the book and there isn’t much I can do to fix this problem at the moment.

 

CodeBlocks on a Macintosh – Part 2

In an earlier post I had provided what I had hoped were great instructions for getting CodeBlocks to work on a Macintosh so that you can work through the examples in C++ All-In-One Desk Reference For Dummies. The instructions do, in fact, work for most people, but they don’t work for everyone. So, part of the reason for this post is to ask for your input. If you’re a Mac user who has encountered problems getting CodeBlocks to work, but solved the issue in a way that differs from my previous post, please let me know all the details about your technique (including the symptoms and step-by-step solution) at John@JohnMuellerBooks.com.

In the meantime, I have discovered a few new pieces of information. For one thing, you can verify that you have the GNU GCC compiler installed by opening a terminal, typing gcc -v, and pressing Enter.  If GNU GCC is installed, you should see some version information along with some compiler instructions. A failure message will look something like this:

My-MacBook-Pro:~ someone$ gcc -v
-bash: gcc: command not found

If you don’t have the GNU GCC installed, there seems to be all sorts of conflicting information online on how to resolve the problem. Most of the advice suggests a rather lengthy download and installation process because apparently GNU GCC isn’t shipped with all versions of the Mac (I’m of the opinion right now that it definitely didn’t ship with any Mac OS X version prior to 10.4, which is why the download at http://www.codeblocks.org/downloads/5 won’t work in this instance and doing things like resetting the compiler will also result in failure.)

One of the best pieces of advice I can offer is to check the CodeBlocks Wiki for Mac-specific information. The current advice is to download the Xcode developer tools from http://developer.apple.com/technologies/tools/, which apparently is a large downloadin excess of 4 GBso be prepared to do something else while you wait. I found similar advice on sites such as Tech-Recipes and the nixCraft forum. If you have a better solution, please let me know and I’ll be all too happy to share it here on my blog.

As a final note, if someone could let me know the actual installation directory for GNU GCC on the Mac, I’d really appreciate it. I understand that the installation directory is probably /usr/bin/gcc, but I’d like to be sure.

 

CodeBlocks on a Macintosh

You probably read the post entitled, “Getting CodeBlocks to Work” regarding my book, “C++ All-In-One Desk Reference For Dummies“, and immediately thought it didn’t apply because you have a Macintosh. Rather than write a single confusing post, I decided to write a second post just for Macintosh developers.  Here are the instructions for the Macintosh:

  1. Go to this page: http://www.codeblocks.org/downloads/5 .
  2. Download the Macintosh version of the compiler, codeblocks-8.02-p2-mac.zip. That contains the compiler.
  3. Double click the file once the download is complete and follow the instructions to install the compiler.
  4. At this point, start the CodeBlocks compiler.  Once it has started up, select Settings -> Compiler and Debugger. In the Compiler and Debugger Settings dialog box, click the “Selected Compiler” drop down and choose the GNU GCC Compiler option.  You should be good to go at this point.


I wrote these instructions with the help of a friend with a Macintosh. While the examples in the book work just fine on a Macintosh, I don’t have a lot of Mac experience. If this fix doesn’t work, we may have to work together a bit to come up with a solution.  This solution did work for two other Macintosh readers, so I’m hoping it also works for you, but I’m more than happy to work with you to make sure you get a working setup. Feel free to write me at John@JohnMuellerBooks.com with your ideas and suggestions for a better procedure. You must have a copy of Mac OS X 10.4 or later to use CodeBlocks!

Getting CodeBlocks to Work

One of the most common e-mails I receive about C++ All-In-One Desk Reference For Dummies is that people are receiving an error message about the compiler when they try to compile the examples. A common error message is:

SayHello2 – Debug uses an invalid compiler. Probably the toolchain path within the compiler options is not set up correctly?! Skipping … Nothing to be done.

The reason you’re having trouble is due to an error on the CD.  It turns out that our production folks made a mistake in putting the book’s CD together. The product that we have on the CD is the IDE only and does not include the compiler.  There is a quick solution to the problem should you wish to use it:

  1. Go to this page: http://www.codeblocks.org/downloads/5.
  2. Download the second item on the list, codeblocks-8.02mingw-setup.exe. That contains the compiler.
  3. Double click the file once the download is complete and follow the instructions to install the compiler.


If you’re using Windows Vista or Windows 7, the version of the MinGW compiler that comes with CodeBlocks might not work.  (It does work on my copy of 64-bit Windows 7 and many other people have used it successfully, but a few people do run into problems.)  In this case, you’ll need to go to http://www.mingw.org/
to download the latest version of the MinGW compiler as they suggest on the CodeBlocks Web site.  You can also get the latest version of the compiler from http://sourceforge.net/projects/mingw/files/Automated MinGW Installer/.  My writing partner, Jeff, suggests that you install:

  • MinGWbaseTools
  • g++ compiler
  • MinGW Make


into
C:\MinGW to make the compiler easier for CodeBlocks to find.  At this point, start the CodeBlocks compiler.  Once it has started up, select Settings -> Compiler and Debugger. In the Compiler and Debugger Settings dialog box, click the “Selected Compiler” dropdown and choose the GNU GCC Compiler option.  You should be good to go at this point.  Please let me know if you experience any other problems at John@JohnMuellerBooks.com.