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.

 

Scoring Your JavaScript Library

Choosing a library for your Web application can be difficult. Both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies emphasize the need to choose libraries with care. There are all sorts of considerations, such as whether the library enjoys popular support and has a good upgrade policy. You also need to know whether the library is secure and performs all the tasks you require of it in the manner you want them performed. These books do a great job of helping you understand the requirements for choosing a library.

At the time I wrote these books, jQuery was the most popular library available. In fact, both books emphasize use of jQuery for programming needs. It turns out that jQuery is still the most popular library around and for good reason, the producers of jQuery have done just about everything right, so developers continue to support them. If you need general interface and low level programming support, jQuery and jQuery UI are good places to start. What it really comes down to is reducing costs and getting work done faster. Money drives everything on the Internet, including your next project.

Two libraries simply can’t meet every need. Developers often use a wide variety of libraries to get the job done. Choosing the right library can be difficult. There are literally hundreds of them, all purporting to do the job faster, better, and for less money (when money is directly involved in the equation). Choosing the wrong library can incur huge penalties. That’s why a site such as Libscore is so important. You can use Libscore to find the top:

  • JavaScript Library
  • Script
  • Site Using JavaScript

The last option is the most important because it tells you what the top sites are and which libraries they use to achieve their goals. By viewing the site and seeing how it uses a library, you can make intelligent decisions for your own site. Exploring Libscore doesn’t take long, but can net you huge gains in productivity that translate into reduced costs and fewer errors.

I receive more than a few e-mails each week about JavaScript, HTML5, and CSS3. Readers really do want to know my opinion about this library or that. Unfortunately, my ability to test every library out there is limited. In fact, let’s be practical—even if I were to attempt to perform the task full time, I still wouldn’t have time as an individual to test all the options. So, using a site such as Libscore is the best option that I can offer you. I’d love to hear your opinions about Libscore or any other site offering the same functionality at John@JohnMuellerBooks.com. If you send me information about another library scoring site, please make sure it actually works with JavaScript or another viable Web technology.

 

Python Community Support

There are many issues to consider when choosing a programming language. Python is no exception. Just because I feel it’s the right tool to meet some of my needs doesn’t mean it will work well for you. That’s why the Understanding Why Python is So Cool section of Chapter 1 in Beginning Programming with Python For Dummies is so important. This section tells you why I see Python as an important programming language and why you might want to use it too. I break the problem into three parts: what Python can do for your application needs, how Python can benefit you personally, and which organizations are using Python for specific tasks. (Another blog post, Python as a Learning Tool, augments the Chapter 1 information.) Between the three sections, you can make an intelligent decision as to whether Python will actually serve your particular needs. I really don’t want you to take my word for it—I would rather know that you selected Python based on your own research.

No matter how interesting a language is, no matter how many features it provides, and no matter how much you personally like it—you can’t typically support a language that lacks broad community support. If no one else is using the language and contributing to it in some major way, the language will eventually die. Fortunately, Python doesn’t have this problem. Chapter 20 of my book discusses ten essential libraries for Python, none of which come with the language when you download it. In fact, the introduction to this chapter lists a number of places where you can find even more libraries to use.

The thing is that Python keeps attracting ever more attention. A recent InfoWorld article, “Hidden gems: 10 Python tools too good to overlook“, provides you with access to still more libraries. The point about libraries is that they represent an essential form of community support. As people use a language, they start to build places where others can discuss it with them. However, that’s only one form of community support. Libraries represent a significant increase in support because creating, debugging, and supporting a library requires time and effort that most developers don’t have in abundance. Someone really has to believe in a language to provide this sort of language support.

The fact is that Python is poised to become the next “must learn” language. It has great community support, provides a broad range of functionality through libraries, and is fully supported by the academic community. Even though other languages have had these advantages and eventually failed, the chances are far less likely that Python will experience problems. In fact, many rankings sites show Python as being the 4th to 8th most popular language out there right now.

Community support is an essential determinant of programming language popularity. How do you rank Python in your toolbox and why? Let me know at John@JohnMuellerBooks.com. Tell me about your favorite Python library and how you use it as well. I’m interested in discovering just what makes some languages so incredibly popular (Python being one of the most popular).

 

The Ongoing Evolution of Libraries

I read a news story this weekend that confirms some of the things I’ve been saying about the future of libraries. The story, Texas library offers glimpse of bookless future, describes a new library in Texas, Bexar County’s BiblioTech, that doesn’t actually contain any books. This library contains computers and e-book readers that people use to work with content electronically. The article states that a lot of people are looking at this library to see how successful it becomes because the cost of maintaining such a library is significantly less than a traditional library. In fact, advances in technology will continue to make it possible to further reduce the cost of maintaining this particular kind of library.

However, I’ve been exploring a question for a while now about the future viability of libraries as physical entities. I first described this particular issue in my A New Emphasis On Libraries post. For 3 ½ years now I’ve tried to expand on the theme discussed in the Future of Libraries? post. The problem with a library that serves up only electronic media is that it’s overkill. Eventually, such libraries will disappear because people will be able to find the content online. A national library that’s based on the Internet will eventually take hold and that will be the death knell for the local library.

Something that the article brings up is that this library serves a neighborhood where few people have the hardware required to read electronic books and there is no Wireless Fidelity (WiFi) connection in the area for them to use. At one time rural areas didn’t have telephones because it was too expensive to service them. Now rural areas have good satellite or Digital Subscriber Line (DSL) connections. It won’t be long before rural and less serviced areas in cities have WiFi connectivity. So, the first problem this library solves won’t be a long term condition. We’re in a transitional phase.

The devices used to read books electronically will continue to evolve and become less expensive. At some point, the government will figure out that it’s less expensive to simply issue a device to those in need, rather than build physical libraries. At that point, a virtual national library will become feasible and probably appear on the scene. Paper books will eventually be relegated to the niche market—sold to those who have the money required to buy such products.

I’m one of the few, I’m sure, who will miss the paper book when this change happens. Using e-books for technical reading really is quite nice, but the feel of paper when I read fiction just can’t be overcome by the convenience of using an e-book reader. At one time I predicted that paper would continue to be available and preferred to meet my fiction needs, but things have changed faster than I could have ever predicted. It may very well be that the transition to e-book as the only viable media will happen within the next few years—only time will tell.

What do you feel about the transition to e-books and virtual libraries? If you like the idea of being able to find any book and check it out using a virtual library, let me know how you envision this system working. More importantly, how will such a system compensate authors for the time and effort spent putting the books together? Send me your ideas to John@JohnMuellerBooks.com.

 

A New Emphasis On Libraries

I’ve been talking with a friend about libraries recently. He had noted that the only people he had seen using libraries lately were older; that children had no desire whatsoever to even enter a library. Of course, this bodes ill for the institution because the youth of today will be the supporters of libraries tomorrow. However, his observations don’t match my own. Our local libraries seem to be packed with children. In fact, I saw three children standing outside our local library the other day while waiting for the doors to open. The difference in these two observations has me quite curious.

The way in which people use libraries has always interested me because these public warehouses of knowledge are essential to a functioning society. People require some method of accessing exotic or expensive texts—especially people who have limited means. The way in which libraries present information to the public will change in the future, but I have no doubt they will remain. In fact, I’ve touched on this topic before in my “Future of Libraries?” post. Before a future kind of library can take shape, however, the children of today must be engaged in the materials that a library can provide and see these materials as useful.

The two of us are still discussing the topic of libraries because the differences in our observations provide good fodder for discourse on the topic. My thought is that the differences in our observations could come from a number of sources:

 

  • A difference in the community (small town versus large city)
  • Differences in the society (such as, beach community versus Midwest farming community)
  • Times of observation
  • Motivation level of the librarians manning the library
  • Perceived value of the library’s content


Our local library is blessed with a great librarian and strong support from volunteers who truly care that we have a library. For example, we actually host events at our library to get people engaged and to enter the building so they can see what the library has to offer. The state has also been running ads to help support the local libraries and those ads may be boosting the number of people the library sees. Whatever the difference, I’m truly happy to see children waiting for the doors to open at our community library.

Of course, I always want to hear your opinion. What level of participation do you see at your local library? Who goes there and what seems to interest them most? What do you see as factors that affect participation in your local library? Let me know your thoughts at John@JohnMuellerBooks.com

 

Future of Libraries?

I was talking with a friend the other day about the direction that libraries are taking. Both of us are experiencing the joys and consternation of a new library project in our respective neighborhoods and both of us have noted a significant increase in the emphasis on e-learning. In fact, I don’t actually visit my library to view the stock of books anymore. All I need to do is go to the library’s site online, look for the book I want by anything that comes to mind, and then order the book. I physically go to the library to pick the physical book up later, but I see this as a fading technology designed to make the older among us feel a bit more comfortable. The future, as described by devices such as the Kindle, is electronic.

I had touched on this topic a little in my “Paper or e-Book?” post, but didn’t take the discussion to a logical conclusion at that point. What will happen when the library becomes completely electronic? It could happenprobably not within my lifetime, but definitely within the lifetime of the next generation. It could eventually happen that you’ll receive a device that connects to a worldwide library and delivers only electronic media. There are a number of advantages to this arrangement:

  • A book would be at your disposal 24/7 without much effort on your part at all.
  • There is no limit to the number of people who could view a book.
  • Rare or exotic books could be scanned and made available electronically.
  • Reading would become a do anywhere sort of activity that might actually benefit children who don’t currently read nearly enough.
  • Money would no longer define access to knowledge.

This future world has a few problems, of course. The people who put creative talent into materials of all sorts are already under attack today. Many people feel no need to pay for the materials they usethe information should be free in their minds. Barriers still exist to some degree and most people realize that people with creative talent require compensation in order to live, but the library of the future will make such barriers non-existent. How will someone who writes, draws, sings, or does anything else creative survive in a world where free electronic forms of everything exist?

I imagine that artists of all sorts will need to find some other means of support in the future. Perhaps that government will step in and provide compensation to artists from library fees or taxes. Certainly, the current system of copyright is breaking down already. I read about copyright issues almost daily online in articles such as this one on ComputerWorld. However, legislating morality has never worked in the history of the world and I doubt very much it will work now, especially considering what I see happening in government funded agencies such as libraries. Change is inevitable, if not always good. Then again, I can’t see this particular change as necessarily bad (despite not necessarily wanting to live it myselfcall me attached to the physical book or simply outdated).

What sorts of changes are you seeing in your local library? Where do you feel these changes will end? How will people of a creative bent be compensated in the future? I’d love to hear your views on any or all of these questions at John@JohnMuellerBooks.com.