Course preparation: Difference between revisions

From 22113
Jump to navigation Jump to search
Line 22: Line 22:
[https://teaching.healthtech.dtu.dk/material/22113/22113_01-AnacondaInstall.ppt Anaconda install] for WSL2 and Linux
[https://teaching.healthtech.dtu.dk/material/22113/22113_01-AnacondaInstall.ppt Anaconda install] for WSL2 and Linux


The rest here is just other guide, which may help you if stuff does not work out for you.
The rest here is just other guides, which may help you if stuff does not work out for you.


[https://learn.microsoft.com/en-us/windows/wsl/install Official Windows guide to installing WSL2]. [https://www.omgubuntu.co.uk/how-to-install-wsl2-on-windows-10 Another guide].<br>
[https://learn.microsoft.com/en-us/windows/wsl/install Official Windows guide to installing WSL2]. [https://www.omgubuntu.co.uk/how-to-install-wsl2-on-windows-10 Another guide].<br>

Revision as of 18:02, 2 September 2024

Before you meet up on the first day of the course, you will have to be able to start a terminal in a unix environment, and to edit files in the same environment with a text editor. Here is how and what you should do on various Operation Systems (OS). Anything mentioned here is free software.

General remarks about programming environments, IDE's

Some people have discovered tools like Spyder, Jupyter or PyCharm, which creates an environment for making and running programs. The use of these tools is somewhat discouraged in this course. Part of what the course/teacher wishes to teach is how to confidently and with experience use Unix as a working environment, which means how to work with the Unix file system, the shell, using text editors to write programs and the Unix commands to test/execute them. Using an IDE removes this element of the course.
Why is Unix as a work environment important?

  • Servers (big computers) do not always offer an IDE.
  • When starting to use big data, the IDE will hamper you - even prevent you from succeeding.
  • Unix is the de-facto work environment in Life Science.

If you already know how to work with Unix (i.e. years of experience), then you can use an IDE as you please.

Windows

There are a number of solutions for Windows, but you should really go for the first one described, WSL2. Otherwise you are on your own.

WSL/WSL2, Windows Subsystem for Linux

You should really choose to install WSL2 using this guide (video guide) for a better experience. If you already have WSL (the old version), then it will work, too.

I have made a rather comprehensive guide for WSL2: Guide for WSL2 and Linux

Now install the Anaconda Python in your WSL2. The WSL2 linux you installed already has a Python, but we need some more libraries later in the course.
Anaconda install for WSL2 and Linux

The rest here is just other guides, which may help you if stuff does not work out for you.

Official Windows guide to installing WSL2. Another guide.
I have seen some update on newer systems. If in trouble, See here.

When successfully done, follow these two guides, to make life convenient (first one is mandatory).
Video: Sharing files between Ubuntu (WSL2) and Windows
Video: Making X11 (Linux graphics) work on WSL2

MobaXterm, not really recommended

Download MobaXterm. Warning: You are likely to get problem with Python and/or libraries.
Install MobaXterm - it will put itself in the windows program folder. This location differs depending on the version of windows you have, but it is "findable". Some places would be: Computer -> C: -> Programs -> Mobatek -> MobaXterm Home Edition. Instead of Programs it could be; Programmer, Programs (x86) or other. The point of knowing this location is that you should drag and drop (move) the plugins you downloaded to this folder from your download folder. That act will make the plugin available. Windows will ask if you want to do this - yes, you do. Windows Firewall will block some features of MobaXterm and ask if they should be allowed. Just block - it does not matter for what we do.

A problem with MobaXterm is that part of the installation is put in a folder that is on OneDrive, if you have OneDrive enabled. This means that MobaXterm only works when you have an internet connection and is slow also because part of it is loaded from OneDrive.

The first time MobaXterm starts takes a while - get coffee - be patient.
If MobaXterm does not want run properly - it is likely NOT an installation problem and re-installing won't help. Instead delete the "MobaXterm" folder in your standard "Documents" folder. This is where files and settings are stored.

Virtual Box, Visualizing Linux, not recommended for the course

VirtualBox from Oracle is a wonderful tool. It installs a package that will allow you to run one or more virtual machines on your computer. On these virtual machines you can install any OS you want, see Linux or Windows. Examples: You have a Mac, you want to run Windows - use VirtualBox and you can run Windows in a Mac application window. You run Windows, but would like to run linux for some specific purpose - same answer. If you don't need your virtual machine (VM) anymore - throw it away and release the disk space for some other purpose. A virtual machine does not need much disk space (5-10 GB), since it can access the disk on the native machine. You can simply share files between your host machine and virtual machine. You can even copy/paste between them, once you have installed the VBoxGuest additions. There is approximately a 10% performance loss when running virtual, but it is worth it for the ease of use. There are other free virtualizing softwares, like VMware Player (one of the first softwares on that market and still very strong), but VirtualBox has proved itself to be small package that is very easy to use and install. No support from CBS will be available on anything but VirtualBox.
Download VirtualBox for Windows, Mac and Linux versions.
Installation: Do a standard install. There will be several warnings from Windows about using drivers that has not gone through a Microsoft approval step - these can safely (and must) be ignored - just click Continue. When creating a new virtual machine, you must first decide what to install as a guest OS. The recommended choice is 32 bit Ubuntu linux. In any case you should probably go for 32 bit OSes. Secondly, you must decide how large a disk you should use - the default 8 GB is fine. You must also decide how much memory you should allocate to the VM; if you only have 2 GB RAM on your "real" machine, then allocate 768 MB, if you have more real RAM then allocate 1024-1536 MB. Before you launch your new WM, you must insert the installation image for the OS (Ubuntu) you downloaded into the VM's CD-rom drive. This is done under 'Storage' for the VM - it can be a bit tricky to find the small icon for the CD-drive, but when the standard "choose file" menu opens, then you hit it right. After installation of your virtual OS, you must also install the 'Guest additions'. These can be found under 'Devices' when your guest OS is running. It will give you much better screen control (resizing), faster screen updates, the ability to cut/paste text and share folders between your host OS and guest OS.

Mac

A Mac has a BSD Unix underneath all the fancy graphics. This means you are mostly ready for the course once you figure out how to use it. Here is a very basic video in how to find the terminal, through which we access the Unix operating system. Watch and test on your MAC.

If you took course 22101/22161 you are done. Otherwise you must install Anaconda.
My guide for windows, but very similar.
Official Anaconda guide.

Linux, any flavour

You are already set and ready for the course. You should be able to find the terminal; Term, Xterm, Console, as this is a basic integrated part of linux.
There are many editors you can use; gedit, jedit, nedit, emacs, vim and a dozen more, also see later.
Python is also built-in, but you must install the Anaconda version to get the libraries used in this course if you did not take course 22101.
Youtube: Installing Anaconda on Ubuntu
Powerpoint: Installing Jupyter/Anaconda - made for windows but strong similarities

Editors

It is vitally important that you have a good programming editor on your system. You should REALLY pick one of the 2 top choices.

Sublime Text

Extremely popular multi platform editor. Download at https://www.sublimetext.com/download.
Documentation and Youtube tutorials.

VScode

Extremely popular multi platform editor. Download at https://code.visualstudio.com/download.
Documentation.

Nano/Pico

The nano and the pico editors only work in the Unix terminal window. They are very basic, but fairly intuitive - at least compared to other terminal text editors on Unix. They are good to know and use, if you just want to do something small, or are on a bad/slow network connection. They are very similar and usually only one is installed. To find which one is present, just type:

nano myfile.txt
pico somefile.txt

Other editors

These can be found via Google and downloaded for free.

  • PSpad (Windows)
  • Notepad++ (Windows)
  • Jedit (Multi platform, requires Java)
  • Komodo Edit (Multi platform)
  • Unix GUI editors: gedit, nedit, kate