Installing osbpy into your existing Python environment is a cinch! However, there are additional packages known as dependencies that osbpy relies on. This chapter will act as a guide to help install these dependencies and ensure that your setup for Python is also spotless and ready for development.
If you have no clue what you’re doing and this is your first foray into Python and programming, then it’s likely better to first learn how to use Python and the general work flow process for developing and running a script. For learning the language, a site like codeacademy can be incredibly useful as it’s highly interactive, while take a read here to get started installing it on your own computer.
Whether you have Python already installed on your computer or you’re looking into downloading Python, you may be wondering what version will work best with osbpy, as the official Python website offers downloads for both Python 2 and Python 3. While Python 3 is the way of the eventual future, certain libraries may only be supported on Python 2, or vice-versa. Due to this, the answer depends, but generally, it doesn’t matter which version of Python you use, as the requirements for osbpy and osbpy itself are compatible with both versions. For most general purposes, working with Python 3 is likely the better bet, unless a library you need is only in Python 2 (a probably rare situation).
What’s more important after installation is ensuring you have all the proper development tools with Python on your computer. The Hitchhiker’s Guide to Python, the essential primer for writing awesome Python, details a very useful guide here that contains three incredibly important enhnacements to do after installation. They are:
The Hitchhiker’s Guide should help ensure that you have all of these setup, so it’s best to read the guide for whichever OS and version is relevant for you:
There also exists the Python distribution Anaconda, which contains the full SciPy stack that’s needed for osbpy to thrive. You may want to consider installing the Anaconda distribution of Python and then adding the PATH environment variable to the install location there. If you do use Anaconda, then manually installing the dependencies is no longer necessary, and you are free to read from adding osbpy to your project next.
The next step will be to install all of osbpy’s dependencies.
At this point, you can install these dependencies on either your main build of Python, or to install them in a virtual environment to separate installed modules from potentially messing with each other. Since the requirements for osbpy are generally broad, it’s not only easier to just install it in the main build of Python, it suffices for the general user. However, if you’d like to install it in a virtual environment, then follow virtualenv’s guide in setting up a virtual environment, and activate it. If it works, your console should have the name of the virtual environment to the left of the input token.
For Windows PowerShell users of virtualenv, activation of the virtual environment is, by default, blocked due to system permissions. You can follow the workaround given in virtualenv’s guide here, or simply use the command prompt instead, which doesn’t have these permission problems. Remember that for Windows machines, activating a virtual environment is done through
scripts\activate.bat, and not
Keep in mind that when using a virtual environment, compilation of the script must occur within the virtual environment, as only that environment contains the necessary packages. If you find yourself often having to work on and off your project and needing to enter the virtual environment continuously, consider using an IDE like PyCharm instead.
Whether installing from the main Python build or through a virtual environment, the next step would be to simply install all the packages through pip. pip is the package management system for Python that hosts a wealth of extensions and libraries to enhance your Python development. If installed and set up correctly (i.e. for Windows machines, the Scripts folder is also in the PATH variable), then you can see if pip works by typing a quick version check, such as:
$ pip -V "pip 9.0.1 from /sample_dir/local/lib/python2.7/site-packages (python 2.7)"
Confident that pip is installed, you can then install the necessary packages for osbpy. They are:
Fortunately, pip allows multiple installations in one line. For OSX and Linux machines, typing the following command should work just fine:
pip install numpy-mkl matplotlib scipy
For Windows machines, the packages may not be as cleanly installable from PyPI, the package index that pip relies on. In this case, downloading the .whl files (the compiled packages ready for pip installation) from a webpage such as Christoph Gohlke’s, will be the better bet. Simply select the version you want, the version of Python you’re using (as denoted in the
cp-## section), and finally, whether your computer runs on 32 or 64-bit. For example, an installation of the three packages may look like the following for a 64-bit computer using Python 2.7:
pip install "numpy-1.12.1+mkl-cp27-cp27m-win_amd64.whl" "matplotlib-2.0.2-cp27-cp27m-win_amd64.whl" "scipy-0.19.0-cp27-cp27m-win_amd64.whl"
The links to each of the required .whl files are:
You can verify a successful installation by typing the command
pip freeze, which displays all installed libraries within the environment. The only thing left is simply integrating osbpy!
At this point, the only thing needed to be done now is to retrieve the
osbpy.py file from the Github repostiory and simply leave it in the same folder as the intended storyboard project. The file can be directly accessed and saved by visiting its raw page here or by using the terminal and saving the file directly via curl, as shown:
curl -O https://raw.githubusercontent.com/KawaiiWafu/osbpy/master/osbpy.py
Python is a lot like the Zen philosophy in its simplicity and minimalism. Therefore, it may feel very counter-intuitive to consider using an IDE (Integrated Development Editor), which can often feel overwhelming and unwieldy to use. This section outlines a few editors of choice that can ease work with Python.
Python is, at its essence, simple scripts that can be quickly run through the terminal. In that case, there may really be no need to get all the additional bloat of a robust, full editor. After all, if you’re storyboarding something simple and quick, why bother setting up an entire project for it? Here are a few recommended text editors to use when working with Python – note that all the text editors mentioned include conveniences such as syntax highlighting, some form of Intellisense (auto-completion), and local in-editor compilation without much of a hassle (through plug-ins).
At the end of the day, it all really comes down to preferences. It’s recommended to try out various editors until you find a match suitable for you. Text editors and IDEs are also not mutually exclusive. A versatile text editor can go a long way for not only the programming enthusiast, but also the power user.
For large-scale storyboard projects or ones requiring more complicated logic, using an IDE will likely help encourage productivity and speedy development. While typical Python installation packages come with IDLE, the editor is rather limited in its scope. The best development editor for Python currently is JetBrains’ editor PyCharm. For programmers familiar with other JetBrains editors such as IntelliJ, Android Studio, and PHPStorm, PyCharm is a seamless transition. Included are an interactive Python console, code completion, PEP formatting compliance, error handling, and automatic code refactoring and navigation capabilities. It is also highly customizable as well.
While the Community Edition is free for all users, students whether in high school or college can take advantage of JetBrains’ student licenses and download all of their editors for free. Access the student license portal here and follow the steps in the application process.
With all the installation out of the way, it’s finally time to begin storyboarding in Python! How exciting. The next sections will detail getting started in using osbpy and then some tips in maximizing your storyboarding experience in Python.