398x Filetype PDF File size 0.12 MB Source: www.physast.uga.edu
V.180114-2234
Python V. 2.7.x Installation Notes
1. High-Level Programming Languages: Python and Better Ones
Be warned: Python is, in the opinion of this author, not the most user-friendly high-level(?)
language you can find, at least as far as programming for scientific computations is concerned.
The Python language was initially developed by people who had probably neither a clue nor an
interest in numerical work. That’s why the bare Python package does not even include the most
basic numerical data types and capabilities, such as arrays and vector syntax. Consequently, it is
unfortunately not enough for you to install just the basic Python package on your computer. Python
however does contain (1) senseless constructs for binding names to values, as well as (2)
oppressive rules of indentation and function definition, to name just a few of its flawed features,
all of which are at best useless and at worst confusing and cumbersome.
To do even the most elementary array-/vector-type operations or graphics, you need to install and
then import in your Python code all sorts of additional packages, such as “NumPy”, “MatPlotLib”
and “SciPy”. These add-on packages are sort of an afterthought to the original Python language,
running on top of the basic Python installation. Installing these packages on top of your basic
Python on your computer can be a harrowing experience, depending on which of the many possible
routes you take to do it. Doing scientific computations and graphics (plotting), even with these
add-on packages, can still be cumbersome, counter-intuitive and confusing, compared to other,
high-level languages, such as Matlab, Julia, Octave or R.
One advantage of Python is that it’s free. But you get what you pay for, see above! Another
advantage is that it is now thought of by many as the greatest invention since sliced bread and thus
widely used in many applications. Hence, it looks good on your resume if you can claim to be
proficient in Python.
By contrast, the advantage of Matlab is that it has a more user-friendly, intuitive and less
cumbersome syntax which is much better suited for scientific computations. You can do a lot –
and certainly everything you need for this course – with just a basic Matlab installation, without
any of its extra add-on packages. The reason is that Matlab was specifically designed by people
who know a lot about scientific computation, for people who want to do scientific computation.
Matlab is also well-recognized in the computational science community (physics, engineering
etc.), and hence not a bad entry on your resume either. The big disadvantage of Matlab is that it
costs money; probably around $100 for a student license, including most of the add-on packages
– which you don’t need right now for this course, but could be useful for you later on.
The advantage of Julia is that it’s also more user-friendly than Python and well-suited for scientific
computations, just as Matlab. But, unlike Matlab, Julia is free! The Julia language syntax is
somewhat similar to the Matlab syntax and, just like Matlab, it provides a large, easy to use library
of functions for all kinds numerical applications, ranging from matrix / linear algebra operations
to differential equation solvers and lots, lots more. Installing any add-on packages you may need
is very easy and can be done with just a single standard command from within your basic Julia
installation. The disadvantage of Julia is that it’s been around for only a few years (since 2012?).
Hence, Julia is perhaps also not (yet) widely known or used in applications. So, it’s probably not
(yet) a big resume builder, but may well become one in a few more years. Also, its native
documentation is rather terse and often hard to follow, especially for a beginner. However, there
are good tutorials around to make up for that.
V.180114-2234
For alternative opinions on the relative merits and demerits of various high-level languages
(Python, Matlab, Julia, Octave, R) just google them. I especially recommend this one:
https://lectures.quantecon.org/about_lectures.html#python-or-julia
https://lectures.quantecon.org/about_lectures.html#how-about-other-languages
Lastly, you might be curious about comparisons of the computation speeds of these different
languages. That’s not really important for the very small calculations you do in this course, but
probably more important if you later want to do large-scale numerical work. Here are some results
from such a comparison: https://modelingguru.nasa.gov/docs/DOC-2625.
2. Python Versions
There are probably many different ways(?) to install Python on your computer – and not each of
them is available for each major operating system (OS): Windows, MacOS and Linux.
However, regardless of which OS you have, it is strongly recommended that you install one of
the older Python versions, 2.x, not the newer versions, 3.x. As you will see and noted above,
compared to other high-level languages (Matlab, Julia), Python is not a very user-friendly
language, and in the newer versions, 3.x, they seem to have made it just a bit more unfriendly. One
of the latest Python 2.x versions is 2.7.14 (at time of this writing), and that would be a good one
to install. However, some earlier versions, 2.7.9 or later, will also work just fine for your purposes
in this course. Just do not install any version that starts with 3. … !
If you have a Mac, Python may already be pre-installed with the Mac OS X, but it may not be the
version you want or may not contain all the add-on packages you want, see above. In the latter
case, you may still have to do some installation yourself, see below. The same may be true if you
have the Linux OS on your computer.
3. Checking for Already Installed Python Versions
Before you install anything, it could be helpful to check whether Python may be installed on your
computer already and, if so, which version. To find out how to check which Python version, if
any, is installed on your computer, read this:
https://edu.google.com/openonline/course-builder/docs/1.10/set-up-course-builder/check-for-python.html
This is important because you need to first uninstall any existing older version of Python on your
computer before you can install a new one. Otherwise, the new version installation may interfere
with the old one, and vice versa, and the result of that will likely be that nothing works anymore,
at all.
4. Installing Python, SciPy, NumPy, MatPlotLib, etc:
4.1. Perhaps the best place to get an overview and learn some basics about Python, about its main
numerical and graphics add-on packages, SciPy, NumPy, MatPlotLib and how to install them all,
is the SciPy website:
https://SciPy.org/.
Read and follow:
https://SciPy.org/getting-started.html,
https://SciPy.org/install.html.
The latter “Install” page gives you many different installation options, some of which may, or may
not (?), work for your computer and the OS running on your computer. The Anaconda installer
seems to be the best one of the bunch right now. It is described in more detail below.
V.180114-2234
Once you’ve installed the basic Python, you can also install the add-on packages. For using basic
array data types and array/vector syntax, you need the NumPy package, described here
http://www.NumPy.org/
For scientific computations beyond just basic linear algebra, you then the SciPy package, as
described above and installed on top of NumPy. For doing graphics (plotting) from inside your
Python code, you need MatPlotLib, described here:
https://MatPlotLib.org/
4.2. The currently recommended way to install Python (see https://SciPy.org/install.html) and,
hopefully, all the ad-on packages you need is the Anaconda installer. Go to and then follow the
instructions at:
https://www.anaconda.com/download/#windows for Windows
https://www.anaconda.com/download/#macos for Mac
https://www.anaconda.com/download/#linux for Linux.
On each of these download pages, you have the choice to download the latest Python 2.7.x version
(likely 2.7.14 at time of this writing) or the latest Python 3.x version. As noted above, you’ll
probably be better off if you install the latest version of Python 2.7, not Python 3.
Once you’ve completed the foregoing Anaconda download, follow its instructions to complete the
Python installation on your computer. Chances are that Anaconda may also provide you with an
easy way to install the add-on packages you need – or perhaps even install them for you
automatically. But, just in case that fails, and you need to learn more about installing add-on
packages, go here:
https://packaging.python.org/
https://packaging.python.org/tutorials/
https://packaging.python.org/tutorials/installing-packages/
In case Anaconda doesn’t work for you at all, try some of the other options for installing Python
and/or its add-on packages, shown on https://SciPy.org/install.html, see above.
Finally, if all the above fails, try this:
4.3. Google for other options yourself. Good queries to enter on google, depending on your OS,
are
how to install Python on mac
how to install Python on windows
how to install Python on linux
and, likewise for installing NumPy, SciPy, and MatPlotLib.
5. Getting Help:
The UGA Helpdesk is explained at
https://confluence.eits.uga.edu/display/HDSH/Help+Desk+Support+%28HDS%29+Home
Contact them via
Email: helpdesk@uga.edu
Or Phone: 706-542-3106
When you do contact them it helps them a lot to help you with your problem if you send them a
detailed description (incl. screenshots etc.) of
(1) the task you are trying to accomplish,
(2) the steps you were executing before and when you encountered the problem; and
V.180114-2234
(3) all error messages you received in the course of your actions.
The more carefully you describe your problem, the easier it is for them to help you find a solution.
no reviews yet
Please Login to review.