dsa-ou / m269-installer

Software installation script and instructions for M269
https://dsa-ou.github.io/m269-installer/
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Test on WSL #2

Closed mwermelinger closed 1 year ago

mwermelinger commented 1 year ago

The instructions need to be tested and possibly modified for Windows. As I don't have Windows, this requires input from others.

  1. Please follow the software installation instructions and make a note of anything that is unclear, missing, unexpected (behaved differently from what the instructions say) or not working, as you install the WSL and the M269 software on your Windows system.
  2. After installing the software (Section 2 of the instructions), download the book from the M269 site into the M269 folder you created. Then proceed with Section 3 of the instructions to check the software is working. Note anything that is unclear or not working.
  3. Post a comment below, indicating what Windows version you used and whether everything went fine or what problems you encountered. In particular, let us know if you put your M269 folder in WSL or in Windows (e.g. /mnt/c/Users/...).

Many thanks!

cameron-s-scott commented 1 year ago

Hi Michel,

I have begun the process of downloading the m269 software using the WSL system on Windows 11. I chose to store the M269-23j folder in WSL using cd /mnt/....

My first installation of the software seemed to finish successfully but as i moved on i realised there was an issue. I noticed there was a message prompting me to install the package python3.10-venv, so i followed the advice by entering sudo apt install python3.10-venv. I then went back to the installation steps and installed the software again which was successful.

I was then able to enter the M269 folder and the command prompt line became (m269-23j).... However, when i tried to access the notebooks using nb i received this error: ls: cannot access '/home/cameronscott/OU/M269-23j/book-r*': No such file or directory [C 20:32:48.146 NotebookApp] No such file or directory: /notebooks/M269.ipynb

I called it a day after i received that error but i plan to revisit this tonight.

I was also wondering if it would be beneficial if i were to post the specs of my PC? I will be running these tests on my laptop and desktop as they run on different Windows OS.

Thanks Cameron error-message 2045 2-6-23

DanielVernall commented 1 year ago

I was then able to enter the M269 folder and the command prompt line became (m269-23j).... However, when i tried to access the notebooks using nb i received this error: ls: cannot access '/home/cameronscott/OU/M269-23j/book-r*': No such file or directory [C 20:32:48.146 NotebookApp] No such file or directory: /notebooks/M269.ipynb

Hi Cameron,

It looks like you haven't downloaded the notebook yet. Here's the relevant bit from the instructions:

image

You should have these files/folders in the M269-23J folder:

image

To copy the book in, you can run file explorer from the WSL terminal and copy in the folder from Windows:

image
DanielVernall commented 1 year ago

After you've added the book folder run nb and you'll see this:

image

Then control+click on one of the links at the bottom (eg. http://localhost....) to open the notebooks in your browser

DanielVernall commented 1 year ago

@mwermelinger I get permissions errors when opening the notebooks, so they are read only:

image image

I believe this is to do with copying files from Windows to WSL via explorer.exe

DanielVernall commented 1 year ago

Yeah, you have to copy in the files via the WSL terminal to avoid the permissions issues:

image image

Although, to be honest, this install process on Windows actually seems more involved than the Anaconda one we used in 22J...

cameron-s-scott commented 1 year ago

I got the notebooks to work. Thank you Daniel for pointing out my obvious overlook!

Could we create a clearer instruction for putting the notebooks in the M269 folder? The instruction could be added into the installation section of the instruction guide and could look something like this:

1. To access the notebooks, you will need to download the M269 book from the resources tab on the M269 site and install it into the folder you have created.

I completed the installation process on Windows 10 and i never had the same read only issue when copying the book files into the M269 folder, although i encountered a different issue when trying to install WSL. The command prompt indicated that i did not have virtualisation enabled which seems to be the default option.

This required turning the SVM feature (i think its GVT for Intel) on in my BIOS and enabling Hyper -V in my Windows optional features, which was simple enough to do but it added length to the installation process.

mwermelinger commented 1 year ago

Cameron, Daniel, many many thanks for trying it out and all the feedback! Apologies for not replying sooner.

I'll make the instructions about installing the notebooks clearer, as an explicit step.

It seems that if we iron out these issues to make instructions for Windows clearer, then we'll have the same environment for everyone and equal to JupyterHub, at the expense that installing WSL is a bit more hassle than installing Anaconda. Thanks again.

mwermelinger commented 1 year ago

Forgot to ask: which exact Windows versions did you use? And have you run a couple of notebook cells to check if it was working?

One addendum:

I think it may be better if the M269 folder is in the Windows filesystem so that the folder can be in a cloud drive and so that the PDF and HTML versions of the book can be accessed without going through WSL. Would you agree?

cameron-s-scott commented 1 year ago

Hi Michel, apologies for the late reply i have been away on holiday!

Windows versions of the pc's i used:

I have opened the notebooks and worked through a couple of sections to make sure they were working ok. I had no issues when using the notebooks but the only issue i can see is that the nb command does not automatically open the notebooks, i had to copy the link into my browser and open them from there.

Venv issue:

NOTE: This issue only occurs on my laptop that uses Windows 11.

I had to install the venv package when trying to install the m269.sh file. I found it weird as well, i would have though python3.10 would come with it. I have done the installation process twice on Windows 11 though and had the same prompt!

Virtualisation issue

As soon as i tried to install WSL i was prompted to enable Virtualisation and Hyper -V, the steps to do so are as follows:

NOTE: This only occured on my desktop when installing on Windows 10.

Enable Virtualisation in BIOS

  1. Restart your computer, entering the BIOS access key when prompted on startup.
  2. Enter advanced mode by entering F7 or clicking on it in the bottom right corner.
  3. Navigate to the Advanced tab in this mode.
  4. Scroll down and select CPU configuration.
  5. Find the "SVM" (AMD) or "Intel Virtualisation Technologies" (Intel) feature and enable it in the drop down menu next to it.
  6. Lastly, click on Exit and OK to save the changes made.

NOTE: The nomenclature may change with different laptop/desktop models and configurations.

Enable Hyper -V which i did through Windows settings:

  1. Right click on the Windows button and select ‘Apps and Features’.
  2. Select Programs and Features on the right under related settings.
  3. Select Turn Windows Features on or off.
  4. Select Hyper-V and click OK.

image

When the installation has completed you are prompted to restart your computer.

WSL folder location

I have the M269 folder in the WSL file system and had no read only issues. Trying to install the M269 folder in the Windows file system but it seems to keep finding itself in WSL. Feeling a little bit silly and think i may be missing something! I agree that having the folder in the Windows filesystem would be the best option because it can be backed up in a cloud drive, as you said.

densnow commented 1 year ago

@cameron-s-scott , @mwermelinger on Windows 10 running WSL version 1 in virtualbox, I had the same venv issues. It seems like the default installation of Ubuntu (used by WSL) does not have this package or has an outdated version.

I would recommend either adding a new instruction for WSL users (who have a Debian based distro) to

sudo apt update
sudo apt upgrade
sudo apt install python3.10-venv

or somehow test for a Debian based distro and incorporate it into the script.

EDIT: It looks like WSL sets a WSL_DISTRO_NAME environment variable. This means it is relatively straightforward to test if user is on WSL and which distro they are using.

RE browser not automatically opening Jupyter notebooks: I was also having the same issue and managed to get around it by using wslu (link here) and setting the BROWSER environment variable. wslu is a collection of WSL utilities and is available via the standard package manager (apt) in Ubuntu. A useful thing to know would be: is it really necessary to set the BROWSER environment variable in addition to installing wslu? I did them both at the same time which worked, but then subsequently removed the environment variable and it still worked. This means I am not 100% sure it is necessary to set the environment variable to get it working.

wslu can be installed with

sudo apt install wslu

and the environment variable can be set permanently by adding

export BROWSER=wslview

To your ~/.bashrc file

If someone could try installing wslu before setting the variable and see if it still works, I think that could be useful.

mwermelinger commented 1 year ago

@cameron-s-scott @densnow Many thanks both for your detailed answers and investigations! Must have taken quite some time.

I'm starting to think, from your reports, that installing and using WSL is more hassle (and occupies more disk space) than it's worth. The main reason is that allowed -m requires pytype, which only works on Unix. However, the JupyterHub installation will be on Unix and will have pytype and allowed, so students on Windows users can always use the JupyterHub to check their TMAs. I'll open a new issue for a different kind of installation for Windows.

DanielVernall commented 1 year ago

@mwermelinger,

Sorry I've not been able to respond recently, I've been busy with a personal code project.

You may be interested in creating a docker container for M269. These can run on WSL2 on Windows.

mwermelinger commented 1 year ago

@DanielVernall Thanks, but from the link you give it seems the students would still have to install WSL before installing Docker to then install the M269 image, so I'm not sure what would be the advantage, but I may have got the wrong end of the stick.

DanielVernall commented 1 year ago

@DanielVernall Thanks, but from the link you give it seems the students would still have to install WSL before installing Docker to then install the M269 image, so I'm not sure what would be the advantage, but I may have got the wrong end of the stick.

@mwermelinger yes, it still requires WSL, but I don't think installing WSL is a big problem if you're using docker because all of the required components for the m269 software (python, pytype, etc.) would be bundled in the container image. So there won't be disparate components to install or the possibility of misconfiguration.

The installation for Windows would be:

mwermelinger commented 1 year ago

Thanks for the clarification. I don't think that the problem is with installing the Python environment, because the script does that automatically, it's installing WSL (and hypervisor and wslu...) that is the faff and adding Docker to it doesn't seem to reduce the work.

mwermelinger commented 1 year ago

Closing this as I think it's not justifiable to require WSL just to support allowed -m. Many thanks everyone for your feedback and time!