Alternate IDEs/Installations (only for advanced students)
Below are some alternate IDEs/installations. We provide some minimal notes on how you can get these working here but note that lecturers and tutors are not in general able to provide technical support for any of these. If you are new to Python programming, we recommend you just use the Anaconda distribution and its included Spyder IDE.
VSCode#
Visual Studio Code is a lightweight yet powerful source code editor which runs on your personal computer and is available for Windows, macOS and Linux. Although it does not come with built-in support for Python, one can leverage the so-called extensions to enable support for Python in VSCode. Although, there are several Python extensions for VSCode, each with different features, we highly recommend the one developed by Microsoft, available here. The extension comes with very useful features such as IntelliSense (Pylance), linting, debugging, code navigation, code formatting, refactoring, variable explorer, test explorer, and more! Another extension that can be very helpful to increase the interactive experience with VSCode is the Jupyter Notebook extension. The CSIT labs come along with VSCode+such extension. Installation instructions for your local computer are as follows (we assume that you already have a supported Python installation in your system):
- Download & Install VS Code for your platform: https://code.visualstudio.com/download At the end of this step you should be able to start VS Code.
- Install Microsoft Python extension for VSCode.
To this end, follow these steps:
- Start VS Code.
- Inside VS Code, go to the extensions view either by
executing the
View: Show Extensions
command (click View->Command Palette…) or by clicking on the extension icon on the left side of the VS Code window. - In the extensions view, simply search for the term
python
in the marketplace search box, then select the extension namedPython
and click the blue install button on the bottom-right hand side of the box corresponding to the extension. - Restart (i.e. close and re-open) VS Code after this step.
- Install the Jupyter Notebook extension
- Start VS Code.
- Inside VS Code, go to the extensions view either by
executing the
View: Show Extensions
command (click View->Command Palette…) or by clicking on the extension icon on the left side of the VS Code window. - In the extensions view, simply search for the term
jupyter
in the marketplace search box, then select the extension namedJupyter
and click the blue install button on the bottom-right hand side of the box corresponding to the extension. - Restart (i.e. close and re-open) VS Code after this step.
- Set up
Shift+Enter
as the combination of keys to send selected code from the text editing window to the jupyter interactive window. See here for detailed instructions.
Usage instructions for the extensions can be found here and here. An step-by-step tutorial with first steps with VSCode can be found here.
PyCharm#
The PyCharm IDE is available for download (not installed on CSIT environment). Like Spyder, it provides a split-window layout, with an editor, a python shell, and other tools. Note that PyCharm does not open a python shell on start-up, but only when you run a program. Before you can run a program in PyCharm, you will need to set the python interpreter. Click on the “Configure Python Interpreter” link:
and select (or type in if it’s not available as a choice)
/usr/local/anaconda3/bin/python3
.
The IDE that is used in the lectures is Spyder, VSCode or PyCharm.
Installing core Python (not recommended as first option)#
Instead of Anaconda Spyder, you can also install the core Python implementation, available from python.org. We do not recommend this as your first option, however. Why you ask?
- The core installation does not provide all packages that we will be using, since… well it is the core distribution.
- Thus, you will be required to (painfully) install these packages by yourself, one at a time.
- The core python distribution comes with the IDLE IDE, which is (by many) considered inferior to other IDEs, such as Spyder.
If you are still keen to it take on, the most important modules which constitute the scientific Python core are:
numpy
defines the fundamental data structures (so called ndarrays, N-dimensional arrays), fast mathematical operations on these arrays, and other routines which are used in numerical computations (linear algebra and matrix operations, Fourier transform, random number generators etc).scipy
defines scientific computing routines (essentially, it is a Python port of classic routines, like Linpack, which were first developed for use with the Fortran programming language and are now regarded as a gold standard of numerical software);scipy
fundamentally relies onnumpy
for the representation of core data structures (arrays).matplotlib
is a 2D (and some 3D) plotting (and some animation) library; it has a packagepyplot
which simplifies its usage.ipython/jupyter
is a advanced shell (command-line environment) for quick Python development, which can be executed in a stand-alone shell, like QtConsole, or run from within the Terminal system shell window. IPython/Jupyter can also be run in a browser, so called IPython/Jupyter notebooks; in which you can type in and execute code (Python statements), but also insert text and media (images, movies, audio). Latest notebooks can also incorporate programmable element called widgets, which provide an enhanced control over code execution (these widgets emulate features available in a commercial system Mathematica). IPython notebooks are often used as a format for presentation of research work, lecture course materials and even textbooks and monographs. Visit the web site A gallery of interesting IPython Notebooks, to see the tremendous ranges of available resources. An IPython notebook is stored in a file with.ipynb
suffix; it can be open in a web browser (you need to launch the IPythone/Jupyter kernel first).sympy
is the package for symbolic computation (and also high-precision mathematics); it emulates the functionality of commercial products like Mathematica and Maple (and the open source Sage).pandas
provides high-performance, easy-to-use data structures and data analysis tools.scikit-image
,scikit-learn
andstatsmodels
are three most widely used packages from a large set of Scikits, a collection of add-on packages for SciPy (they are hosted and developed separately from the main SciPy distribution).
You can install each of them in addition to your standard Python
distribution by running the pip3
command on the command-line interface:
% pip3 install pkgname
To install a package on the system globally (for other users), it needs to be run with the administrator privileges:
% sudo pip3 install pkgname
Alternatively (to avoid unnecessary duplication of Python
installations), you can start with installing Miniconda (like its
“big cousin” Anaconda, it is available for all major OS platforms.
The Miniconda distro contains only the standard Python
plus the Conda manager). Once installed,
conda
tool can be used to install packages which you
need: eg:
% conda install numpy
IDLE#
IDLE is the default IDE for python, and comes with most python distributions. It is more simplistic (some would say it is just bad), but some students may find it sufficient. You can find “Idle3 Anaconda” on the CSIT computers. On the InfoCommons Windows or Mac computers, you will have to use the search function on the start menu and search for “IDLE” or “python IDLE”. There is more than one version available, so check after you have started it that you have the right one (it should show a message like the one above). In particular, make sure it is running python 3.
IDLE has a separate window for the python shell, and one window for each file you edit. To run a program in IDLE, you can select “Run Module” from the menu in the editor window, or press F5.
Other Advanced IDEs#
If you are not using the Spyder IDE (that comes with Anaconda), you should install and learn to use some modern programming editor, for example:
- Sublime Text 3 is also multi-platform
- TextMate 2 is an excellent Mac programming editor