Integrated Development Environments (IDEs)#
The teaching contents for programming in this eBook require so-called Application Programming Interfaces APIs) and Integrated Development Environments (IDEs).
An API represents a computing interface that enables interactions between multiple software intermediaries. Modular programming becomes easy with an API because it systematically hides complex information that is not necessarily needed to write code according to industry standards. For instance, an API can define the interface between an application (such as Python or Word) and an Operating System (OS) such as Windows, Linux, or macOS (also referred to as platform).
An IDE enables the definition of a project to use, for example, a specific Python environment, and it enables robust coding by pointing out issues directly in the code, even before it runs for the first time. Powerful IDEs go even further and assist in documenting code with markdown (.md files) and directly pipe into git (see the Version Control : git).
Which IDE to choose?
The answer to this question depends on the platform you are using (e.g., Windows or Linux), your personal preferences, and your goals.
For writing Python software itself, PyCharm is a powerful solution. In addition, Jupyter is a great tool for writing word-office-like documents with functional code examples. To test and run Python code (software) locally, for Windows users, the installation of Anaconda is almost indispensable. Linux users will be mostly fine with their system setup without the need to install Anaconda.
For code documentation, examples, and the best learning experience in the Python courses featured in this eBook, consider installing JupyterLab locally. Windows users find instructions in the Jupyter on Windows section. Linux users find instructions in the Jupyter on Linux section.
Once you have an IDE installed, carefully read the instructions for installing Python.
Anaconda is a powerful tool for managing Python environments on Windows. Linux users better use virtual environments (read more in the chapter on installing Python).
Anaconda may cause large environments that require several gigabytes of storage. To install lightweight environments, use Miniconda. Miniconda does not include Anaconda Navigator and to enable working with Jupyter notebooks (in Windows):
Click on Start.
Anaconda Promptand hit enter (use Miniconda3). A Terminal window (black background) opens.
In Anaconda prompt type
conda install jupyterand confirm with
ywhen the Terminal asks
To work with Jupyter notebooks (open, create, or modify), type
jupyter lab (or
jupyter notebook) in Anaconda Prompt (Miniconda3) and hit Enter. The JupyterLab application will open in the default web browser.
Jetbrains PyCharm is a powerful but proprietary IDE. Its usage is still free for non-commercial use in education. Alternatives are Spyder IDE (for Python) or RStudio (R and Python). However, before launching any project in an IDE, the installation of an interpreter (e.g., Python or R) is necessary (see chapter on Python installation).
Get PyCharm from the developer’s website or use it through Anaconda. For the educative training purposes provided in this eBook, you may be eligible to use the free education license. To use PyCharm with Anaconda, visit https://docs.anaconda.com.
Working with Jupyter
Get familiar with JupyterLab, by creating files, adding new Markdown or Python cells, and running cells. The essentials of markdown are explained in the Markdown section (short read). Learning Python is more than a short read and the Python Basics chapter provides some insights (takes time).
Jupyter on Windows#
Anaconda Navigator alternatively provides the application Jupyter Notebook. However, JupyterLab is the Project Jupyter’s next-generation user interface, which is more flexible and powerful. This is why this website refers to JupyterLab rather than the Jupyter Notebook app. The following sections explain how to install it on your Windows computer, either by using the graphical user interface of Anaconda Navigator, or the conda prompt command line (recommended).
Via Anaconda Prompt (Recommended)#
Open Anaconda Prompt, which represents a Terminal window with a black background and a blinking cursor.
If you are working with Miniconda, install the Jupyter Notebook app by typing
conda install jupyter and confirm with
y when Anaconda Prompt asks
To start JupyterLab and open, create, or modify Jupyter notebooks, type:
If the command fails, try either
jupyter-lab or start Jupyter notebook by typing
jupyter notebook. The Jupyter Notebook application will open in the default webbrowser.
Extensions and Spellchecker#
Many additional features for JupyterLab are available through nbextensions, which can be installed through Anaconda Prompt:
conda install -c conda-forge jupyter_contrib_nbextensions
When reading through the Python tutorials on this website, you will probably find one or another spelling mistake (please report mistakes!). In particular, the Python sections may be affected because they were created with JupyterLab, where there is no spell checker pre-installed. To avoid at least the most unpleasant errors you can install a spellchecker in Jupyter. One solution is to install @ijmbbarrs spellchecker, which requires installing nodejs (through Anaconda Prompt and in addition to nbextensions):
conda install -c conda-forge nodejs
jupyter labextension install @ijmbarr/jupyterlab_spellchecker
In the case that several warning messages occur when starting JupyterLab (such as
[W 18:49:22.283 NotebookApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: template_file, template_name, template_paths?), downgrade Jupyter Notebook from version 6.x to 5.6.1 (there is currently an issue with the
conda install "nbconvert=5.6.1"
Jupyter on Linux#
To install JupyterLab on Linux, open Terminal and make sure that
pip3 is installed:
sudo apt install python3 python3-pip python3-venv
Export the user-level
bin to the
PATH environment and install JupyterLab in the user space with the following commands:
pip install --user jupyterlab
It might be necessary to replace
pip3 (depending on the Linux distribution).
To start JupyterLab tap:
jupyter-lab starts a localhost server that runs JupyterLab, which will open up in a web browser like an interactive website.
Closing Terminal will also terminate the localhost that runs JupyterLab. Thus, do not close Terminal as long as you are working with JupyterLab, in particular, when there are unsaved books.
A Debugger for Jupyter#
To better understand and troubleshoot code crashes, a debugger represents a great relief. Unfortunately, debugging in Jupyter can cause some headache in the absence of an inherent debugging tool. To get a debugger working with Jupyter, check out this blog entry from Jupyter Project.
Sublime is one of the most popular editors for multiple (computer) languages. However, it is commercial software that is only free to use during an evaluation period without time limit. Read more about it at sublimetext.com.
To install it on Debian Linux platforms, open Terminal and tap (source: https://www.sublimetext.com/docs):
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/sublimehq-archive.gpg
Then select the stable channel (the dev channel has more features but also more bugs):
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
apt and install Sublime:
sudo apt update
sudo apt install sublime-text
If an error message occurs, make sure
apt works with
sudo apt install apt-transport-https
When working with sublime, consider using an advanced spell check package, such as LanguageTool. More useful packages for sublime can be found at packagecontrol.io. Packages can also be found by hitting the
P keys (in Sublime) to open Package Control. Then, type
install and enter the name of the package you are looking for in the box.
To enable modification of user settings, go to Preferences (top menu bar) > Settings and save the opening settings file either as
~./config/sublime-text/Packages/Default/Preferences.sublime-settings (recommended for first-time saving) or
~./config/sublime-text/Packages/User/Preferences.sublime-settings. Then, edit the desired settings: for instance, look for
spell_check and set it to
true to default-enable spell checking. Save the
.sublime-settings file to apply changes.