Tidying instructions - online edit of handbook/computing/wsllaptop.html [PosixPath('/home/philip/expo/expoweb/handbook/computing/wsllaptop.html')]

This commit is contained in:
Philip Sargent 2024-12-15 00:02:33 +00:00
parent dba988f690
commit 8c100935c8

View File

@ -79,7 +79,7 @@ Now finally you can use all the usual command line tools at your wsl command lin
<h3 id="pain">Python on WSL</h3> <h3 id="pain">Python on WSL</h3>
<p>WSL installs python by default, but it may be a rather old python (depending on the history of your laptop, phase of moon etc.) and if you want development speed you want python3.13. [NB check what version of python is running on the server. It was 3.11.2 in December 2024.]. <p>WSL installs python by default, but it may be a rather old python (depending on the history of your laptop, phase of moon etc.) and if you want development speed you want python3.13. [NB check what version of python is running on the server. It was 3.11.2 in December 2024.].
<p>We used to have lengthy instructions fo installing python using "deadsnakes" but since December 2024 we just use the <var>uv</var> utility for everything. <p>We used to have lengthy instructions fo installing python using "deadsnakes" but since December 2024 we just use the <var>uv</var> utility for everything, see <a href="troglaptop.html">&#9874; troggle development machine</a>
<!-- <!--
<p>To install python3.11 and pip follow <a href="https://www.linuxcapable.com/how-to-install-python-3-11-on-ubuntu-linux/">these instructions</a> to the letter. But that's not enough, you need to configure pip to work properly with python3.11 (this is because it's a bit bleeding edge as yet), so you ALSO then need to re-install the latest with: <p>To install python3.11 and pip follow <a href="https://www.linuxcapable.com/how-to-install-python-3-11-on-ubuntu-linux/">these instructions</a> to the letter. But that's not enough, you need to configure pip to work properly with python3.11 (this is because it's a bit bleeding edge as yet), so you ALSO then need to re-install the latest with:
</p> </p>
@ -93,29 +93,30 @@ python3.11 -m pip --version
<p>The error you are trying to get rid of when attempting to use pip looks like this:<br /> <p>The error you are trying to get rid of when attempting to use pip looks like this:<br />
<var>ImportError: cannot import name 'html5lib' from ...</var> <var>ImportError: cannot import name 'html5lib' from ...</var>
--> -->
<h3>WSL1 Historic problems</h3> <h2>WSL1 Historic problems</h2>
<a href="https://learn.microsoft.com/en-us/windows/wsl/compare-versions?source=recommendations">WSL2 is now noticeably even slower</a> for NTFS files mounted as /mnt/c or /mnt/d, so now it is only really useable if you move all the troggle code into your Linux filespace on <var>\\wsl.localhost\Ubuntu-22.04\home</var> which means that those files will only be accesible from Linux. Buggeration. <p>Do not use WSL1. And with WSL2, put all your development files into the <var>ext4</var> filesystem on <var>\\wsl.localhost\Ubuntu\home\username\expo\</var>. In 2024 the hassles of working with NTFS files under WSL are not worth it. If your Windows laptop can't install WSL2, install a Xubuntu dual-boot system on a separate disc partition or SD card.
<p>
<a href="https://learn.microsoft.com/en-us/windows/wsl/compare-versions?source=recommendations">WSL2 is now noticeably even slower</a> for NTFS files mounted as /mnt/c or /mnt/d, so now it is only really useable if you move all the troggle code into your Linux filespace on <var>\\wsl.localhost\Ubuntu\home</var> which means that those files will only be accesible from Linux.
<h3>WSL1 and WSL2</h3> <h3>WSL1 and WSL2</h3>
<p>WSL now installs as WSL2 by default, but older machines (mostly laptops) may not have the Hyper-V Virtualization hardware and may have to run WSL1. <p>WSL now installs as WSL2 by default, but older machines (mostly laptops) may not have the Hyper-V Virtualization hardware and may have to run WSL1.
This may be fine: the behaviour is nearly identical so far as an expo laptop is concerned, where you just want to use rsync and scp. An old 2011-era PC had This may be fine: the behaviour is nearly identical so far as an expo laptop is concerned, where you just want to use rsync and scp. An old 2011-era PC had
been doing troggle development happily using WSL1. However time is clearly running out for WSL1, and the file handling is now very noticably slower. If your laptop won't run WSL2 then you are advised to get rid of Windows completely and install Xubuntu as a dual boot system. been doing troggle development happily using WSL1. However time is clearly running out for WSL1, and the file handling is now very noticably slower. If your laptop won't run WSL2 then you are advised to get rid of Windows completely and install Xubuntu as a dual boot system.
<p>For some laptops though, WSL1 does not install properly and you have to use WSL2. The symptom is two error messages when you run <var>dmesg</var> in
the Linux bash terminal window. However, if all you want to use it for is rsync, this may still be fine.
<h3>WSL2 - things to watch for</h3> <h3>WSL2 - things to watch for</h3>
<p>On some Windows 10 laptops WSL1 fails to install properly and <p>On some Windows 10 laptops WSL1 fails to install properly and
<a href="https://learn.microsoft.com/en-us/windows/wsl/compare-versions?source=recommendations">you have to use WSL2</a>. <a href="https://learn.microsoft.com/en-us/windows/wsl/compare-versions?source=recommendations">you have to use WSL2</a>.
<p>You should <a href="https://learn.microsoft.com/en-us/windows/wsl/wsl-config#wslconf">check that the configuration files</a> do what you want. <p>You should <a href="https://learn.microsoft.com/en-us/windows/wsl/wsl-config#wslconf">check that the configuration files</a> do what you want.
<p>When running a full troggle development laptop (see separate <a href="../troggle/troglaptop.html">troggle documentation</a>) <p>When running a full troggle development laptop (see separate <a href="../troggle/troglaptop.html">troggle documentation</a>)
you will want to use <var>python venv</var>. This barfs untidily if you have the code on NTFS, e.g. if mounted on <var>/mnt/c/</var>. You almost you will want to use a virtual environment (python venv or uv). This barfs untidily if you have the code on NTFS, e.g. if mounted on <var>/mnt/c/</var>. You almost
certainly have to move all your code to the internal network share e.g. <var>\\wsl$\Ubuntu\home\expo\troggle\</var> which certainly have to move all your code to the internal network share e.g. <var>\\wsl$\Ubuntu\home\expo\troggle\</var> which
is how it looks when you are browing from Windows. is how it looks when you are browing from Windows.
(No, don't try to be cute and keep it on <var>/mnt/c/</var> and just put a soft link in <var>/home/expo/</var>. That doesn't work either.) (No, don't try to be cute and keep it on <var>/mnt/c/</var> and just put a soft link in <var>/home/expo/</var>. That doesn't work either.)
This means that the code is actually living on a Linux <var>ext4</var> filesystem hidden away on your disc where you can only see it using the This means that the code is actually living on a Linux <var>ext4</var> filesystem hidden away on your disc where you can only see it using the
'network' method <var>\\wsl$\Ubuntu-20.04\home\expo\troggle\</var>. This means that file access is noticably faster too. You will need to make sure that your backup/archive methods access this filesystem though. 'network' method <var>\\wsl$\Ubuntu\home\expo\troggle\</var>. This means that file access is noticably faster too. You will need to make sure that your backup/archive methods access this filesystem though.
<p>NB rsync doesn't work with NTFS partitions the way that WSL1 does. <p>NB rsync doesn't work with NTFS partitions the way that WSL1 does.
@ -135,8 +136,8 @@ in the \\wsl$\ ext4 filesystem (WSL2 only, not WSL1).
<h3 id="permissions">Permissions, permissions..</h3> <h3 id="permissions">Permissions, permissions..</h3>
<p>Having happily used WSL1 in this manner for a couple of years, it was a rude awakening to try this with a new laptop with a small <p>Having happily used WSL1 for a couple of years since 2020, it was a rude awakening to try this with a new laptop with a small
hard-drive, so all the expo code was re-mounted on a plugged-in SD card. The problem of permissions that seemed to be a WSL2 issue reappeared with hard-drive, so all the expo code was re-mounted on a plugged-in SD card. The problem of permissions that seemed to be purely a WSL2 issue reappeared with
a vengence on WSL1. a vengence on WSL1.
<p>The recommended WSL procedure (Jan.2021) said to mount the drive using <p>The recommended WSL procedure (Jan.2021) said to mount the drive using
<a href="https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/">a new 'metadata' setting</a>: <a href="https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/">a new 'metadata' setting</a>: