Select Git revision
arrays-pointers-3.c
instructions_windows_weai.tex 7.36 KiB
\RequirePackage{luatex85}
\documentclass[12pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,
escapeinside={\#*}{*}, % escape to LaTeX
columns=flexible, % allow copying
keepspaces=true,
}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\newcommand*\keystroke[1]{%
\begin{tikzpicture}[baseline=(key.base), very thin, line cap=round, black, rounded corners=0pt]%
\node [draw, fill=white, fill opacity=1, rectangle, rounded corners=2pt, inner sep=1pt, minimum size=0.8em, font=\scriptsize\sffamily] (key) {#1};
\begin{scope}[on background layer]
\draw [rounded corners=1pt, fill=white] ($ (key.north west) + (-2pt, 2pt) $) rectangle ($ (key.south east) + (2pt, -2pt) $);
\fill [gray!60] ($ (key.south west) + (2pt, 0.1pt) $) -- ($ (key.south west) + (-1pt, -2pt) $)
-- ($ (key.south east) + (1pt, -2pt) $) -- ($ (key.south east) + (-2pt, 0.1pt) $) -- cycle;
\fill [gray!60] ($ (key.south east) + (-0.1pt, 2pt) $) -- ($ (key.south east) + (2pt, -1pt) $)
-- ($ (key.north east) + (2pt, 1pt) $) -- ($ (key.north east) + (-0.1pt, -2pt) $) -- cycle;
\end{scope}
\draw ($ (key.north west) + (0.1pt, -2pt) $) -- ($ (key.north west) + (-2pt, 1pt) $);
\draw ($ (key.north west) + (2pt, -0.1pt) $) -- ($ (key.north west) + (-1pt, 2pt) $);
\draw ($ (key.north east) + (-0.1pt, -2pt) $) -- ($ (key.north east) + (2pt, 1pt) $);
\draw ($ (key.north east) + (-2pt, -0.1pt) $) -- ($ (key.north east) + (1pt, 2pt) $);
\draw ($ (key.south west) + (0.1pt, 2pt) $) -- ($ (key.south west) + (-2pt, -1pt) $);
\draw ($ (key.south west) + (2pt, 0.1pt) $) -- ($ (key.south west) + (-1pt, -2pt) $);
\draw ($ (key.south east) + (-0.1pt, 2pt) $) -- ($ (key.south east) + (2pt, -1pt) $);
\draw ($ (key.south east) + (-2pt, 0.1pt) $) -- ($ (key.south east) + (1pt, -2pt) $);
\end{tikzpicture}%
}
\newcommand{\keyenter}{\keystroke{Enter\,\tikz [baseline=-2mm, rounded corners=0pt] \draw [semithick, -{Triangle[length=1mm, width=1mm]}] (0, 0) -- ++(down:1mm) -- ++(left:2mm);}}
\usepackage[colorlinks=true,urlcolor=blue,unicode=true,pdfusetitle]{hyperref}
\usepackage[color=blue, author={Christof Kaufmann}]{attachfile2} % load after hyperref to avoid option clash from unicode=true
\title{Installation of Python via Miniforge for Windows}
\date{May 2023}
\author{Christof Kaufmann}
% one infinite page, https://tex.stackexchange.com/a/19241/115883
\usepackage[paperheight=\maxdimen]{geometry}
\usepackage[active,tightpage]{preview}
\renewcommand{\PreviewBorder}{1ex}
\edef\myindent{\the\parindent}% store parindent value
% preserve parindent, https://tex.stackexchange.com/a/98214
\usepackage{etoolbox}
\edef\keptparindent{\the\parindent}
\patchcmd{\preview}
{\ignorespaces} %%% \preview ends with \ignorespaces
{\parindent\keptparindent\ignorespaces}
{}{}
\begin{document}
\begin{preview}
\vspace*{-3em}
\maketitle
\section{Miniforge}
First, we install \textit{Miniforge}. It is a package manager for conda packages and by default set up to use the \texttt{conda-forge} repository. Download the installer from here
\url{https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe}
and install Miniforge. We recommend to leave the default settings especially to install Miniforge just for your user (\textit{Just Me}). This does not require admin rights. When the installation has finished, close the window and continue on command line.
\smallskip
\noindent
\begin{minipage}{0.6\linewidth}
% \setlength{\parindent}{\myindent}
For that start \textit{Miniforge Prompt} from the start menu.
In the prompt the \texttt{base} environment should be activated, which looks like this for a user \textit{john}:
\end{minipage}%
\hfill%
\begin{minipage}{0.37\linewidth}
\includegraphics[width=\linewidth]{images/mambaforge-start-menu-prompt}
\end{minipage}%
\begin{lstlisting}[gobble=2]
#*\color{gray}(base) C:\textbackslash Users\textbackslash john>*
\end{lstlisting}
Now we are ready to install the packages we need.
\section{Packages}
\label{sec:packages}
Let's create a new environment called \textit{weai} and add the packages we need to it (copy \& paste black text lines):
\begin{lstlisting}[gobble=2, basicstyle=\ttfamily\footnotesize]
#*\color{gray}(base) C:\textbackslash Users\textbackslash john>*mamba create -n weai python=3.9 astunparse matplotlib ^
ipympl mypy jupyter notebook spyder ^
scikit-learn seaborn openpyxl odfpy ^
pyarrow pandas
\end{lstlisting}
You will get a list of packages and can confirm with \keyenter. Installation takes a while. Since \lstinline|tensorflow| is not yet available for Windows on \texttt{conda-forge}, we need to install it from \textit{PyPI} using \lstinline|pip| into the \textit{weai} environment:
\begin{lstlisting}[gobble=2]
#*\color{gray}(base) C:\textbackslash Users\textbackslash john>*mamba activate weai
#*\color{gray}(weai) C:\textbackslash Users\textbackslash john>*pip install tensorflow==2.10.1
\end{lstlisting}
If you have an NVIDIA GPU and want to activate support for it, install the following packages:
\begin{lstlisting}[gobble=2]
#*\color{gray}(weai) C:\textbackslash Users\textbackslash john>*mamba install cudatoolkit cudnn
\end{lstlisting}
and optionally (not required for Spyder) also add the path to the corresponding libraries (e.\,g.\ \textit{cudnn64\_8.dll}) in your user environment variable \lstinline|Path|, for example:
\begin{lstlisting}[gobble=2, basicstyle=\ttfamily\footnotesize]
C:\Users\john\miniforge\envs\ml\Library\bin
\end{lstlisting}
\section{Test}
\label{sec:test}
\begin{minipage}{0.6\linewidth}
Next, we start Spyder from the start menu. The entry is named \textit{Spyder (weai)}, since we installed Spyder into the \textit{weai} environment.
\end{minipage}%
\hfill%
\begin{minipage}{0.37\linewidth}
\vspace{-3em}
\includegraphics[width=\linewidth]{images/mambaforge-start-menu-spyder-weai}
\end{minipage}%
\noindent
The Spyder window opens now. Open the test script \texttt{mnistKeras.py} (\textattachfile{attachments/mnistKeras.py}{attachment}|\href{https://gitlab.cvh-server.de/ckaufmann/install-python-tensorflow-gym/-/raw/master/attachments/mnistKeras.py?inline=false}{web}) and run it by pressing \keystroke{F5} or clicking on the green play button or by using the menu \textit{Run} $\rightarrow$ \textit{Run} and confirm with \textit{Run}.
\vspace{-1ex}
\noindent
\includegraphics[width=\linewidth]{images/spyder-linux}
\vspace{-1.5em} % due to some transparent border in the image
\noindent
The test script will output the TensorFlow version, e.\,g.:
\begin{lstlisting}
=========================
Tensorflow Version 2.10.1
=========================
\end{lstlisting}
Then TensorFlow will download the required data set once and train a neural network. The progress will be printed in the console. Finally the accuracy on the test set will be shown and some sample images will be plotted in the \textit{Plots} pane. This means Python and TensorFlow have been installed successfully.
\end{preview}
\end{document}
% \begin{verbbox}
% conda install -c anaconda tensorflow mypy pystan swig geopandas descartes tqdm ffmpeg
% \end{verbbox}
% \resizebox{\linewidth}{!}{\theverbbox}