diff --git a/instructions_windows_weai_nossl_notf.pdf b/instructions_windows_weai_nossl_notf.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5eebf3b907d2a8f5c1201a639c7e907ab4776788 Binary files /dev/null and b/instructions_windows_weai_nossl_notf.pdf differ diff --git a/instructions_windows_weai_nossl_notf.tex b/instructions_windows_weai_nossl_notf.tex new file mode 100644 index 0000000000000000000000000000000000000000..0742824edc8c3d780ac2c891294d5e9ebf994010 --- /dev/null +++ b/instructions_windows_weai_nossl_notf.tex @@ -0,0 +1,164 @@ +\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 Mambaforge for Windows} +\date{September 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 + + +\noindent +\textit{Note: If you already have installed Python before, it might work for this course. You can skip to Section~\ref{sec:test} to test your installation using the attached test script. If it is not working, but it is based on conda (Anaconda, Miniconda, Miniforge, Mambaforge), you might skip to Section~\ref{sec:packages}, but add a \lstinline|--channel conda-forge| to the \lstinline|mamba create| and \lstinline|mamba install| commands. If it is not based on conda (plain Python) and you want to keep it, you could also install Mambaforge parallel to your installation. Usually it does not interfere with existing installations.} + +\section{Mambaforge} + +First, we install \textit{Mambaforge}. 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/Mambaforge-Windows-x86_64.exe} +and install Mambaforge. 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} + +The following step is special in your network. Run this command to get \textit{conda} and \textit{mamba} to ignore SSL verification. We will switch it back on later. +\begin{lstlisting}[gobble=2, basicstyle=\ttfamily\footnotesize] + #*\color{gray}(base) C:\textbackslash Users\textbackslash john>*conda config --set ssl_verify no +\end{lstlisting} +Now 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.10 spyder jupyter notebook ^ + ipympl mypy matplotlib seaborn ^ + pandas pyarrow openpyxl odfpy ^ + scikit-learn +\end{lstlisting} +You will get a list of packages and can confirm with \keyenter. Installation takes a while. \textit{If it does not work because of SSL verification, try again from your home network.} +Now set up SSL verification again: +\begin{lstlisting}[gobble=2] + #*\color{gray}(weai) C:\textbackslash Users\textbackslash john>*conda config --set ssl_verify yes +\end{lstlisting} +If you need to install further packages later on, you might have to switch it off again, temporarily. + + + +\section{IDE} +\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} +\end{minipage}% + +\noindent +The Spyder window opens now. Set the graphics backend to \textit{Automatic}, as shown here: +\vspace{-0.5ex} + +\noindent +\includegraphics[width=\linewidth]{images/spyder-backend} +\vspace{-1.5em} % due to some transparent border in the image + +Let's test the installation. Open the test script \texttt{scatterplot-matrix.py} (\textattachfile{attachments/scatterplot-matrix.py}{attachment}|\href{https://gitlab.cvh-server.de/ckaufmann/install-python-tensorflow-gym/-/raw/master/attachments/scatterplot-matrix.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/scatterplot-matrix} +\vspace{-1.5em} % due to some transparent border in the image + +\noindent +The test script will plot a scatter plot matrix in a new window. This means Python has 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}