In this module, we will explore how to install libraries or packages to Python on your computer.
Python comes installed with many features, but from time to time we need specialized tools that must be downloaded separately. These are called libraries or packages. Some common Python libraries include numpy, matplotlib, and pandas. Lots of Linewaves modules use a library for musical analysis called music21.
Most libraries can be installed using the package installer for Python, or pip. In most cases, you can go to the terminal or command line on your computer and enter “pip”, “install”, and the name of the library.
On a Mac, the command line is accessible via Applications / Utilities / Terminal.
On Windows, you can access the command line by selecting Command Prompt from the Start menu or using the Run prompt (Windows key + R) and typing “cmd” (no quotes) and enter. For more on accessing the command line, see this page.
If you are using Python 3 (you probably are), you usually want to specify the Python 3 version of pip. So, for example, to install numpy, you would type:
pip3 install numpy
pip install numpy
For some libraries, such as Orange, you need to specify the version number of the library as well. So for Python 3 you would install the library via:
pip3 install orange3
Normally the package instructions will tell you exactly what you need to enter. And of course, if a package is required for a Linewaves module, the installation instructions will always be included as part of the module.
For more on this topic, see this reference page.