-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path00_linux_setup.tex
More file actions
341 lines (307 loc) · 13.5 KB
/
Copy path00_linux_setup.tex
File metadata and controls
341 lines (307 loc) · 13.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
% Created 2021-08-25 Wed 11:27
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{awesomebox}
\usepackage{booktabs}
\usepackage{placeins}
\usepackage{siunitx}
\usepackage{minted}
\usepackage{hyperref}
\usepackage{csquotes}
\setminted[powershell]{fontsize=\footnotesize}
\author{\emph{Tejaswin Parthasarathy}, Mattia Gazzola}
\date{\today}
\title{Prerequisities\\\medskip
\large ME447: Comp. Design \& Dyn. of Soft Syst.}
\hypersetup{
pdfauthor={\emph{Tejaswin Parthasarathy}, Mattia Gazzola},
pdftitle={Prerequisities},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 28.0.50 (Org mode 9.3.6)},
pdflang={English}}
\begin{document}
\maketitle
To ensure that the scripts/applications that you will write in this course works
seamlessly, we need to install few applications/libraries. I have detailed ways
to do the same for different OS distributions here. The recommended way for your
OS is also marked.
\section*{Dependencies which we will install}
\label{sec:org95b54fc}
\begin{itemize}
\item A shell runnning \texttt{sh} compliant implementation (\texttt{bash/zsh/fish})
\item \texttt{Python} 3.x (preferably the latest)
\item \texttt{Jupyter} for installing notebooks. IMPORTANT: The instructions for installing
\texttt{Jupyter} are attached at the end of this guide and is OS-agnostic.
\end{itemize}
\section*{OS-agnostic method \#0 (Easiest, definitely works)}
\label{sec:org184ef39}
You can use cloud based services to create/modify/access your own \texttt{Jupyter}
notebooks. The most popular one is \href{https://colab.research.google.com/}{Google Colaboratory}, for which you need to
sign into \texttt{Google}.
\section*{OS-agnostic method \#1 (Easiest and definitely works)}
\label{sec:orge52f2f9}
Install your favorite Python IDE (Integrated Development Environment) such as
\texttt{PyCharm} or \texttt{Spyder}, to name a few. The list is non-exhaustive and an internet search
should reveal more.
\section*{OS-agnostic method \#2 (Easiest and definitely works)}
\label{sec:org8c27a09}
We can load a virtual machine in your environment---it's essentially an 'OS' that
runs inside your 'OS'.
\begin{itemize}
\item Follow the steps \href{https://andreask.cs.illinois.edu/ComputeVirtualMachineImages}{listed here} \footnote{\url{https://andreask.cs.illinois.edu/ComputeVirtualMachineImages}}. Download both:
\label{sec:org44c0792}
\begin{itemize}
\item VirtualBox
\label{sec:org3e0d38c}
\item ComputeImage
\label{sec:org14a894d}
\end{itemize}
\item You should have a working debian installation with your favorite
\label{sec:orgda63405}
\texttt{shell} and \texttt{python3} already installed
\end{itemize}
\section*{Ubuntu/Debian (and equivalent distros)}
\label{sec:orgdecab9f}
Try any one of the following methods.
\begin{itemize}
\item Method \#1 (Recommended, Easiest)
\label{sec:org4824317}
\begin{itemize}
\item Almost works off the shelf! You have access to the shell from the \texttt{Terminal} application.
\item \texttt{Python3} can be installed directly using the \texttt{Conda} distribution \footnote{\href{https://www.anaconda.com/download/\#linux}{Conda Install for Linux}}. \href{https://www.anaconda.com/download/\#linux}{Installation of the Anaconda distribution for Linux systems can be found here.}
\item Enjoy using \texttt{Python} from the \texttt{Conda} distribution on the \texttt{Terminal}.
\item To install packages in the current virtual environment (details skipped for
brevity) do
\begin{minted}[]{sh}
conda update conda
conda install -c anaconda numpy scipy matplotlib pandas
\end{minted}
\end{itemize}
\item Method \#2 (Somewhat harder, not recommended)
\label{sec:orgf05a321}
\begin{itemize}
\item Almost works off the shelf! You have access to the shell from the \texttt{Terminal} application.
\item Install the \texttt{Spyder IDE} from the Terminal using the following steps. Also
gives access to an editing environment which provides useful
syntax-highlighting, among other shiny features.
\begin{minted}[]{sh}
# Fetches up-to-date package information from
#the Ubuntu aptitude repository
sudo apt-get update
# Upgrades all packages
sudo apt-get upgrade
# Install Python3, if not already there
sudo apt-get install spyder3
\end{minted}
\item You can now use the \texttt{Spyder IDE} to launch \texttt{Python} processes.
\end{itemize}
\item Method \#3 (Recommended if you want more control)
\label{sec:org42d5371}
\begin{itemize}
\item Almost works off the shelf!
\item To ensure that all packages are up to date, and that you have the latest
\texttt{Python} installation run the following commands in your \texttt{Terminal} (type
\texttt{terminal} in the \texttt{Ubuntu} dash, and enter the following commands)
\end{itemize}
\begin{minted}[]{sh}
# Fetches up-to-date package information from the Ubuntu aptitude repository
sudo apt-get update
# Upgrades all packages
sudo apt-get upgrade
# Install Python3, if not already there
sudo apt-get install python3-pip
# See if pip3 installed successfully and is in your path
which pip3
# Install other libraries using pip
pip3 install numpy scipy matplotlib pandas
\end{minted}
\begin{itemize}
\item You can now type in \texttt{python3} in the \texttt{Terminal} app prompt and will be taken
to the \texttt{python} environment.
\end{itemize}
\item Method \#4 (Not tested and not recommended)
\label{sec:org1e0bbd4}
\begin{itemize}
\item \href{https://www.python.org/downloads/source/}{Download and build directly from the source code.} \footnote{\href{https://www.python.org/}{Python}}
\end{itemize}
\item Method \#5 (Good practice for independent external installation of software in Ubuntu)
\label{sec:org63b5946}
\begin{itemize}
\item Use an external package manager, the recommended choice being \href{https://linuxbrew.sh/}{Linuxbrew}. It
is painful to install, especially if you can't navigate your way
around the terminal. If you are just getting used to the terminal
environment, this option is not for you.
\item Follow the instructions for building Linuxbrew from their website first.
\item After successfully installing Linuxbrew, just type installation
\begin{minted}[]{sh}
brew install python3
\end{minted}
\item This should also install \texttt{pip3}, which you can use to install \texttt{Python} packages.
\end{itemize}
\end{itemize}
\section*{Windows 10}
\label{sec:org1649046}
\begin{itemize}
\item Unfortunately \texttt{Windows} environment uses a different shell interpreter, which
complicates scripting and development. However you can run a \texttt{Linux} subsystem perfectly within Windows!
\begin{itemize}
\item This needs Windows build 16215 or later for painless processing (which you
most probably have as Microsoft aggressively updates their products).
\item If you want you can check your build here. \footnote{\href{https://docs.microsoft.com/en-us/windows/wsl/troubleshooting\#check-your-build-number}{Check your Windows build here}}
\end{itemize}
\end{itemize}
\begin{itemize}
\item Enabling access to \texttt{sh} compliant shell \footnote{\href{https://docs.microsoft.com/en-us/windows/wsl/install-win10}{Install Linux on Windows}}\textsuperscript{,}\,\footnote{\href{https://docs.microsoft.com/en-us/windows/wsl/initialize-distro}{Initialize your distro}}
\label{sec:org4b3dcde}
\begin{itemize}
\item Open \texttt{PowerShell} as Administrator and run:
\end{itemize}
\begin{minted}[]{powershell}
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
\end{minted}
\begin{itemize}
\item Restart your computer when prompted.
\item Once this is done, you can install the \texttt{Linux} distro of your choice from the
Windows Store.
\begin{itemize}
\item Open the Microsoft Store and choose your favorite \texttt{Linux} distribution (say
\texttt{Ubuntu})
\item From the distro's page, select ``Get''
\end{itemize}
\item Launch the distro from the start menu, like any other app. You can find it at
\texttt{<distro\_name>} (in the case of \texttt{Ubuntu}, this will be called \texttt{Ubuntu})
\begin{itemize}
\item The first launch will take some time
\end{itemize}
\item Set the required \texttt{Linux} username and password (this can be different than you
\texttt{Windows} user name and password)
\item You are now running a \texttt{sh} compliant shell. Type in the following to update
the repository information.
\begin{minted}[]{sh}
# Fetches up-to-date package information
#from the Ubuntu aptitude repository
sudo apt-get update
# Upgrades all packages
sudo apt-get upgrade
\end{minted}
\end{itemize}
\item Installing Python
\label{sec:orgb3b2780}
\begin{itemize}
\item To get a working installation of \texttt{Python} within your \texttt{Linux} subsystem, follow
the steps listed in \hyperref[sec:org42d5371]{Method \#3 (Recommended if you want more control)} for the
\texttt{Linux} distros. This will give you everything within your Linux environment.
\item If you need a \texttt{Python} installation in your Windows environment, you can use
Anaconda. \href{https://www.anaconda.com/download/\#windows}{Installation of the Anaconda distribution for Windows systems can be found here.}
\begin{itemize}
\item You can then use \texttt{Python} from the \texttt{Anaconda prompt} application.
\item To install packages in the current virtual environment (details skipped for
brevity) do
\begin{minted}[]{sh}
conda update conda
conda install -c anaconda numpy scipy matplotlib pandas
\end{minted}
\end{itemize}
\item \href{https://www.python.org/downloads/windows/}{Alternatively you can also download the official Python installer from the source}. I
didn't test this option out.
\end{itemize}
\end{itemize}
\section*{MacOS}
\label{sec:org00af4d8}
Try any one of the following methods.
\begin{itemize}
\item Method \#1 (Recommended, Easiest)
\label{sec:org19909df}
\begin{itemize}
\item Once again, \texttt{Python3} can be installed directly using the \texttt{Conda} distribution. \href{https://www.anaconda.com/download/\#macos}{Installation of the Anaconda distribution for systems running MacOS can be found here.}
\item Enjoy using \texttt{Python} from the \texttt{Conda} distribution on the \texttt{Terminal}.
\item To install packages in the current virtual environment (details skipped for
brevity) do
\begin{minted}[]{sh}
conda update conda
conda install -c anaconda numpy scipy matplotlib pandas
\end{minted}
\end{itemize}
\item Method \#2
\label{sec:org4a5a52d}
\begin{itemize}
\item \href{https://www.python.org/downloads/mac-osx/}{Alternatively, download the Python installer}. I do not recommend this
option.
\end{itemize}
\item Method \#3 (Use a package manager)
\label{sec:org155ca14}
\begin{itemize}
\item MacOS sorely misses a package manager for installation of binaries. So you
can install the \texttt{Homebrew} package manager found \href{https://brew.sh/}{here}.
\item The installation might seem long drawn (I have listed the time needed
below), but will usually proceed without difficulty. You can consult the
reference \footnote{\href{https://docs.python-guide.org/starting/install3/osx/}{The Hitchhiker's guide to Python}} if you face any issues. The steps are given below:
\begin{itemize}
\item You need to install \texttt{Command Line Tools} of \texttt{Xcode}. Type in the
following in the terminal to see if you have already installed it
\begin{minted}[]{sh}
xcode-select -p
\end{minted}
If the output is non-null, you can safely skip to the next step. If not,
type in the following in your terminal:
\begin{minted}[]{sh}
xcode-select --install
\end{minted}
This usually pops up a display window like \href{https://railsapps.github.io/images/installing-mavericks-popup.png}{this}. The instructions in the
alert box are confusing. You don’t need to ``Get Xcode'' from the App
Store. Just click ``Install'' for the Xcode Command Line Tools. If you have
a slow Internet connection, this step may take many minutes. After the
installation repeat the \texttt{xcode-select -p} command and this time you will
see the path of installation of \texttt{Command Line Tools} in your terminal prompt.
\item Now we can install \texttt{Homebrew} by typing in the following commands
\begin{minted}[]{powershell}
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
\end{minted}
Quoting Hitchhiker's guide to \texttt{Python},
``The script will explain what changes it will make and prompt you before the installation begins.''
\item You should then be able to type in
\begin{minted}[]{sh}
brew install python3
\end{minted}
and \texttt{Python3}, along with \texttt{pip} should be installed.
\end{itemize}
\end{itemize}
\end{itemize}
\section*{Jupyter notebooks}
\label{sec:org315c6fd}
\begin{itemize}
\item \textbf{Note}: \texttt{Python3} is a prerequisite to install \texttt{Jupyter}. You can find all the
relevant information in Jupyter's home page \footnote{\url{https://jupyter.org/install}}.
\item If you have your \texttt{Python} installation done via \texttt{Conda}, you should also have
jupyter-notebook installed. To verify this type
\begin{minted}[]{sh}
jupyter notebook
\end{minted}
in your terminal to see the \texttt{Jupyter} console up and running in your browser.
\item Alternatively, you can also install \texttt{Jupyter} quickly via \texttt{pip}. Just type
\begin{minted}[]{sh}
#Upgrades pip repository information
pip3 install --upgrade pip
pip3 install jupyter
\end{minted}
in your terminal prompt. You can verify successful installation by typing in
your terminal:
\begin{minted}[]{sh}
jupyter notebook
\end{minted}
\end{itemize}
\end{document}