<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>The Cloistered Monkey</title><link>https://necromuralist.github.io/</link><description>A common place.</description><atom:link href="https://necromuralist.github.io/rss.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:cloisteredmonkey.jmark@slmail.me"&gt;Cloistered Monkey&lt;/a&gt; 
&lt;div id="license"xmlns:cc="http://creativecommons.org/ns#" &gt;This work is licensed under
&lt;a href="http://creativecommons.org/licenses/by/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;"&gt;CC BY 4.0
&lt;img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1"&gt;
&lt;img src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1"&gt;&lt;/a&gt;
&lt;/div&gt;
</copyright><lastBuildDate>Wed, 01 Apr 2026 19:59:36 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Fixing NVidia With Wayland on Ubuntu 24.04 (Noble Numbat)</title><link>https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#org99559d1"&gt;The Problem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#orgbce7d85"&gt;The Problems&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#org4cbaae8"&gt;WayDroid and X11&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#org99d1384"&gt;The Next Problem - Sleep and Logging out&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#org5e2c9d7"&gt;No Settings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#orgf624236"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/#org1ca5bfb"&gt;Links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org99559d1" class="outline-2"&gt;
&lt;h2 id="org99559d1"&gt;The Problem&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org99559d1"&gt;
&lt;p&gt;
Switching from X11 to Wayland (on &lt;b&gt;&lt;b&gt;Ubuntu 24.04 (Noble Numbat)&lt;/b&gt;&lt;/b&gt;) initially prevented launching the Settings so I went on a hunt to fix it (and here are my notes).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgbce7d85" class="outline-2"&gt;
&lt;h2 id="orgbce7d85"&gt;The Problems&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgbce7d85"&gt;
&lt;/div&gt;
&lt;div id="outline-container-org4cbaae8" class="outline-3"&gt;
&lt;h3 id="org4cbaae8"&gt;WayDroid and X11&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org4cbaae8"&gt;
&lt;p&gt;
I was poking around and saw that there was a project to run Android on PCs (among other things) called &lt;a href="https://waydro.id/"&gt;Waydroid&lt;/a&gt; so I installed it, but whenever I tried to enter the Waydroid shell
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo waydroid shell
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
I got an error saying  that the &lt;i&gt;waydroid session is stopped&lt;/i&gt;. This isn't a post about waydroid so I'll skip the troubleshooting I did, but ultimately I found an &lt;i&gt;AskUbuntu&lt;/i&gt; post from someone who ran into the same problem and found from one of &lt;a href="https://askubuntu.com/questions/1475593/how-do-i-resolve-the-waydroid-session-is-stopped-problem/#comment2597386_1478124"&gt;the comments&lt;/a&gt; that:
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;
it turns out that waydroid is not compatible with X11.
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
Maybe it's called &lt;i&gt;Waydroid&lt;/i&gt; because it needs &lt;i&gt;Wayland&lt;/i&gt;? Anyway I checked if I was using &lt;i&gt;Wayland&lt;/i&gt;:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$XDG_SESSION_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Which didn't show that I was (I can't remember if it showed X11 or was just empty, but it wasn't anything like "Wayland" anyway). It turned out I had chosen "Ubuntu" at the login screen, not "Ubuntu Wayland" so I logged out, switched to Wayland and then logged in. This seemed to fix the initial WayDroid problem (I got the GUI running but I still haven't finished the installation) but then another problem came up.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org99d1384" class="outline-3"&gt;
&lt;h3 id="org99d1384"&gt;The Next Problem - Sleep and Logging out&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org99d1384"&gt;
&lt;p&gt;
Having switched to Wayland I decided I needed a break. While I was away my computer went to the lock screen, as it usually does, but when I opened it back up I found that instead of just locking the screen it had actually logged me out, killing all the applications I left open and closing an encrypted mount point I had open. More searching ensued.
&lt;/p&gt;

&lt;p&gt;
Once again, someone posted a question on &lt;a href="https://askubuntu.com/questions/1482786/ubuntu-23-04-logs-me-out-arbitrarily-while-going-to-sleep-mode"&gt;&lt;i&gt;AskUbuntu&lt;/i&gt;&lt;/a&gt; that seemed to be about the same problem, the suggested answer being to disable the Screen Lock, which didn't really seem to be a good answer, but it was &lt;i&gt;an&lt;/i&gt; answer, which was one more than I started with so I decided to give it a try. But then the next problem appeared.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org5e2c9d7" class="outline-3"&gt;
&lt;h3 id="org5e2c9d7"&gt;No Settings&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org5e2c9d7"&gt;
&lt;p&gt;
When I tried to launch the settings an icon came up in the launcher like normal but the settings wouldn't come up. Okay. I'm skipping some of the intermediate searches but eventually I tried running the settings in the terminal to look for the errors.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;gnome-control-center 
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This gave an error which included "failed to create dri2 screen" so I went on a search again and found &lt;a href="https://askubuntu.com/questions/1514352/ubuntu-24-04-with-nvidia-driver-libegl-warning-egl-failed-to-create-dri2-scre"&gt;another AskUbuntu post&lt;/a&gt; with &lt;a href="https://askubuntu.com/a/1516567"&gt;a suggested answer&lt;/a&gt; - install a package:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo apt install libnvidia-egl-wayland1
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
After logging out and logging back in the settings worked &lt;i&gt;and&lt;/i&gt; the lock screen no longer logged me out so this seems to have been the fix (for these problems, there's still some weird things going on but nothing I can't live with yet.)
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgf624236" class="outline-2"&gt;
&lt;h2 id="orgf624236"&gt;Conclusion&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgf624236"&gt;
&lt;p&gt;
There's an &lt;a href="https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-535/+bug/2063827"&gt;open bug on Launchpad&lt;/a&gt; (&lt;i&gt;Gnome apps segfault in Nvidia (535) Wayland sessions on Noble, but 550 works&lt;/i&gt;) which looks like it might be related to the problem I ran into. It says that upgrading the NVidia driver to 550 fixes the Gnome Settings problem but the upgrade then introduces some other errors so installing &lt;code&gt;libnvidia-egl-wayland1&lt;/code&gt; looks like the right fix. The bug was opened on April 26, 2024 so I would imagine it would effect more people, making this a high priority. Perhaps Wayland isn't widely used, at least not among nvidia users. I'm typing this in emacs and portions of the buffer are messed up, making it dangerous to use (insofar as I can't tell if the text actually exists in the document in the same place where it appears on the screen) so I'll probably go back to X11 until they get this stuff worked out, but at least it's working a little better than it was this morning.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org1ca5bfb" class="outline-2"&gt;
&lt;h2 id="org1ca5bfb"&gt;Links&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org1ca5bfb"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://waydro.id/"&gt;Waydroid&lt;/a&gt; : The start of the problem&lt;/li&gt;
&lt;li&gt;&lt;a href="https://askubuntu.com/questions/1475593/how-do-i-resolve-the-waydroid-session-is-stopped-problem/"&gt;Ask Ubuntu - how do I resolve the "waydroid session is stopped" problem?&lt;/a&gt;: The First Problem&lt;/li&gt;
&lt;li&gt;&lt;a href="https://askubuntu.com/questions/1482786/ubuntu-23-04-logs-me-out-arbitrarily-while-going-to-sleep-mode"&gt;Ask Ubuntu - "Ubuntu 23.04 logs me out arbitrarily while going to sleep mode"&lt;/a&gt;: The second problem.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://askubuntu.com/questions/1514352/ubuntu-24-04-with-nvidia-driver-libegl-warning-egl-failed-to-create-dri2-scre"&gt;Ask Ubuntu- Ubuntu 24.04 with Nvidia driver "libEGL warning: egl: failed to create dri2 screen"&lt;/a&gt;: The solution post.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-535/+bug/2063827"&gt;Launchpad - Gnome apps segfault in Nvidia (535) Wayland sessions on Noble, but 550 works &lt;/a&gt; : Possibly related bug.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/1999AZZAR/5c881fdaeb841fc4476259bfcc69b98c"&gt;GitHub Gist - waydroid on x11.md&lt;/a&gt; : Possible way around Wayland for Waydroid. Also has other useful notes for Waydroid.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>nvidia</category><category>ubuntu</category><category>wayland</category><guid>https://necromuralist.github.io/posts/gnome-settings-with-nvidia-and-wayland/</guid><pubDate>Sat, 03 May 2025 16:48:54 GMT</pubDate></item><item><title>ProtonPass: Finding the Suggested Password</title><link>https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#orge653992"&gt;What This Is About&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#org28b6016"&gt;The Start Of the Trouble&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#orga396372"&gt;Getting It Out Of Proton Pass&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#orgf2853ff"&gt;The Firefox Extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#org121dba2"&gt;Add New Item&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#orgcd61c34"&gt;Password Generator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#org721e1a4"&gt;Password History&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/#orgdc4229c"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orge653992" class="outline-2"&gt;
&lt;h2 id="orge653992"&gt;What This Is About&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orge653992"&gt;
&lt;p&gt;
I'm using &lt;a href="https://proton.me/pass"&gt;Proton Pass&lt;/a&gt; as one of my password managers and noticed today that it thought my &lt;a href="https://www.hoopladigital.com/"&gt;Hoopla&lt;/a&gt; password was weak so I decided to change it. While I was changing my password ProtonPass stepped in and gave me a suggested password to use so I figured I'd try it out. Unfortunately their implementation is unintuitive to me and I spent a little while thinking I had just locked myself out of my account and was going to have to go through a password reset. Hoopla's password reset process isn't particularly hard, but it seemed like a good idea to figure out what was going on before I locked myself out of a more critical site, so here's my notes for getting the password from ProtonPass.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org28b6016" class="outline-2"&gt;
&lt;h2 id="org28b6016"&gt;The Start Of the Trouble&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org28b6016"&gt;
&lt;p&gt;
When I went to change my password on Hoopla ProtonPass popped up a prompt giving me a new random password like in the screenshot below.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/hoopla-change-password.avif" alt="nil" loading="lazy"&gt;
&lt;/p&gt;

&lt;p&gt;
I usually ignore it but for some reason I tried it out this time, clicking on the box to enter the password and then saving it (I took this screenshot later so that isn't my password, in case you're wondering). I confirmed that my old password no longer worked, but when I tried to use Proton Pass to fill in the new password it turned out that it hadn't updated its record with the new one it gave me so it appeared that I had changed my password and then thrown the new one away.
&lt;/p&gt;

&lt;p&gt;
This seemed like an illogical thing to do so I did a little search on the web and found &lt;a href="https://www.reddit.com/r/ProtonPass/comments/158arja/comment/jtcrvvx/?utm_source=share&amp;amp;utm_medium=web3x&amp;amp;utm_name=web3xcss&amp;amp;utm_term=1&amp;amp;utm_content=share_button"&gt;this response&lt;/a&gt; to a &lt;a href="https://www.reddit.com/r/ProtonPass/comments/158arja/suggest_but_not_save_password/"&gt;Reddit post&lt;/a&gt; confirming that this is, in fact, the way Proton Pass works, but that you can get the new password after the fact from the Firefox extension.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orga396372" class="outline-2"&gt;
&lt;h2 id="orga396372"&gt;Getting It Out Of Proton Pass&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orga396372"&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgf2853ff" class="outline-3"&gt;
&lt;h3 id="orgf2853ff"&gt;The Firefox Extension&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgf2853ff"&gt;
&lt;p&gt;
I'm using Firefox (on Ubuntu) and the ProtonPass extension, so I clicked on the little purple diamond to bring it up.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/proton-pass-00-firefox-toolbar.avif" alt="nil" loading="lazy"&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org121dba2" class="outline-3"&gt;
&lt;h3 id="org121dba2"&gt;Add New Item&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org121dba2"&gt;
&lt;p&gt;
This is what the extension showed (with some of my information blocked out). To get to the password you have to (rather unintuitively) click on the purple "+" symbol next to the search box which is the "Add New Item" button. 
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/proton-pass-01.avif" alt="nil" loading="lazy"&gt;
&lt;/p&gt;

&lt;p&gt;
This brings up a menu, the last item of which is the "Password" option that we want.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/proton-pass-02-menu.avif" alt="nil" loading="lazy"&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgcd61c34" class="outline-3"&gt;
&lt;h3 id="orgcd61c34"&gt;Password Generator&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgcd61c34"&gt;
&lt;p&gt;
Clicking on "Password" brings up a dialog that generates new passwords for you (here it's offering us &lt;i&gt;Joylessly9-Disjoin8-Dynasty4-Delegator0-Mobilize5&lt;/i&gt; - a supposedly memorable one for us to use). At the bottom of that screen, underneath the "Advanced Options" button, is the "Password history" button that we want.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/proton-pass-03-password-dialog.avif" alt="nil" loading="lazy"&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org721e1a4" class="outline-3"&gt;
&lt;h3 id="org721e1a4"&gt;Password History&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org721e1a4"&gt;
&lt;p&gt;
This shows us the passwords we've generated in the last two weeks (I never generated one before this case so there's only the one entry). Oddly, &lt;a href="https://www.reddit.com/r/ProtonPass/comments/14ywai9/comment/jsaq15y/?utm_source=share&amp;amp;utm_medium=web3x&amp;amp;utm_name=web3xcss&amp;amp;utm_term=1&amp;amp;utm_content=share_button"&gt;the post on Reddit&lt;/a&gt; from the "ProtonSupportTeam" says that they are deleted after 1 day, not two weeks. It also says that they are working on "improving the auto-save behavior," but the post is two years old (as of this writing) so I guess they decided that lengthening the time to deletion was the improvement we needed.
&lt;/p&gt;

&lt;p&gt;
Clicking on the icon for "hoopladigital.com" copied the password I generated for that site to the clipboard which I then used to update the Proton Pass entry for Hoopla so that I could get back into the site.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/proton-pass-04-password-history.avif" alt="nil" loading="lazy"&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgdc4229c" class="outline-2"&gt;
&lt;h2 id="orgdc4229c"&gt;Conclusion&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgdc4229c"&gt;
&lt;p&gt;
Updating the password isn't fantastically difficult, once you know what you have to do, but I don't imagine I'd have figured it out for myself. Hopefully even if I forget how to do it next time I'll at least remember that I wrote down what to do.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>howto</category><category>proton</category><guid>https://necromuralist.github.io/posts/protonpass-finding-the-suggested-password/</guid><pubDate>Sat, 19 Apr 2025 22:57:25 GMT</pubDate></item><item><title>Noble Numbat and the Broken Virtual Environments</title><link>https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org40429aa"&gt;What is this about?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org052aae9"&gt;What Happened&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org63adcfe"&gt;Short Version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org46a1c07"&gt;The First Hint (pipx)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org16f65f6"&gt;The Broken Virtual Environments&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org6dab3cd"&gt;Then a Nikola Error&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#orgf9d15a8"&gt;An Ape-Iron Problem (no distutils)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/#org5b4d613"&gt;Links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org40429aa" class="outline-2"&gt;
&lt;h2 id="org40429aa"&gt;What is this about?&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org40429aa"&gt;
&lt;p&gt;
These are notes I made when I was fixing some errors that occurred after updating Ubuntu to 24.04. It's been over a year so I don't really remember writing this, but, here it is. The fixes are specific to &lt;a href="https://github.com/justinmayer/virtualfish"&gt;virtualfish&lt;/a&gt;, &lt;a href="https://github.com/pypa/pipx"&gt;pipx&lt;/a&gt;, and &lt;a href="https://getnikola.com/"&gt;nikola&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org052aae9" class="outline-2"&gt;
&lt;h2 id="org052aae9"&gt;What Happened&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org052aae9"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;I updated Ubuntu&lt;/li&gt;
&lt;li&gt;Something raised an obscure error when I changed into one of my git repositories&lt;/li&gt;
&lt;li&gt;It turned out that the upgrade broke the python virtual environment&lt;/li&gt;
&lt;li&gt;Re-setting-up using the newer version of python that came with the upgrade fixed things.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org63adcfe" class="outline-2"&gt;
&lt;h2 id="org63adcfe"&gt;Short Version&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org63adcfe"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Upgrading to Ubuntu 24.04 made python changes that broke all my virtual enviroments&lt;/li&gt;
&lt;li&gt;Reinstalled &lt;code&gt;pipx&lt;/code&gt; using apt&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vf ls --details&lt;/code&gt; shows the python versions for all (virtualfish created) virtual environments (and which are broken)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vf upgrade --rebuild&lt;/code&gt; will upgrade the currently active virtual environment (may take more than one run to get past errors)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pipx reinstall-all&lt;/code&gt; fixed the missing &lt;code&gt;nikola&lt;/code&gt; and &lt;code&gt;pygmentize&lt;/code&gt; errors (and probably others)&lt;/li&gt;
&lt;li&gt;fixing &lt;code&gt;pygments&lt;/code&gt; doesn't fix the errors in posts that were alread built so do a &lt;code&gt;nikola clean&lt;/code&gt; and &lt;code&gt;nikola build&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pip install setuptools --upgrade&lt;/code&gt; in the environment re-setup &lt;code&gt;distutils&lt;/code&gt; which was removed from python 3.12 (which Ubuntu Installed)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org46a1c07" class="outline-2"&gt;
&lt;h2 id="org46a1c07"&gt;The First Hint (pipx)&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org46a1c07"&gt;
&lt;p&gt;
I don't remember exactly what cued me in to what was going wrong, but somewhere in trying to figure out what was wrong I found that running &lt;a href="https://github.com/frostming/legit"&gt;legit&lt;/a&gt; after updating to Ubuntu 24.04 returned an error saying that &lt;code&gt;legit&lt;/code&gt; wasn't found. It took a while to figure out where &lt;code&gt;legit&lt;/code&gt; was supposed to be coming from, but it turned out I had installed it with &lt;a href="https://pipx.pypa.io/latest/installation/"&gt;pipx&lt;/a&gt; and had to re-install it to get it working.
&lt;/p&gt;

&lt;p&gt;
I don't remember exactly what I did anymore, but based on the command history it looks like:
&lt;/p&gt;

&lt;ol class="org-ol"&gt;
&lt;li&gt;Re-install &lt;code&gt;pipx&lt;/code&gt; (I purged the original installation that had been installed using &lt;code&gt;pip&lt;/code&gt; and instead used &lt;code&gt;apt&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Re-install &lt;code&gt;legit&lt;/code&gt; using the updated &lt;code&gt;pipx&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
So, was &lt;code&gt;pipx&lt;/code&gt; the problem? Well, partly.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org16f65f6" class="outline-2"&gt;
&lt;h2 id="org16f65f6"&gt;The Broken Virtual Environments&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org16f65f6"&gt;
&lt;p&gt;
The next problem came when I tried to build the HTML for this site.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nikola build
&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Traceback&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="s2"&gt;"/home/hades/.virtualenvs/necromuralist.github.io/bin/nikola"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;nikola.__main__&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;span class="ne"&gt;ModuleNotFoundError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;No&lt;/span&gt; &lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;named&lt;/span&gt; &lt;span class="s1"&gt;'nikola'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
For some reason the &lt;code&gt;nikola&lt;/code&gt; executable was missing. Since I was in a virtual environment I tried to re-install nikola but using &lt;code&gt;pip&lt;/code&gt; gave another error.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pip --version
&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Traceback&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="s2"&gt;"/home/hades/.virtualenvs/necromuralist.github.io/bin/pip"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;pip._internal.cli.main&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;span class="ne"&gt;ModuleNotFoundError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;No&lt;/span&gt; &lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;named&lt;/span&gt; &lt;span class="s1"&gt;'pip'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
So, not only was &lt;code&gt;nikola&lt;/code&gt; missing but so was &lt;code&gt;pip&lt;/code&gt;, which I thought was a part of the python installation… I looked at what was in the virtualenvironment -
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ls ~/.virtualenvs/necromuralist.github.io/lib
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And saw that it had this python version:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;python3.11/
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
But when I checked the version of the python I was using it gave this.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;python --version
&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Python 3.12.3
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
So it looked like the ubuntu update created a bit of a mismatch. It turns out that &lt;a href="https://virtualfish.readthedocs.io/en/latest/"&gt;virtualfish&lt;/a&gt; has a command to list what virtual environments you have set up (&lt;code&gt;vf ls&lt;/code&gt;) and if you pass it the &lt;code&gt;--details=&lt;/code&gt; option it will show you the python version the environment is using.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;vf ls --details
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
It listed all my environments but in particular it showed this for the environment for this site's repository.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;necromuralist.github.io &lt;span class="o"&gt;(&lt;/span&gt;broken&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
&lt;code&gt;virtualfish&lt;/code&gt; also has a command to upgrade the currently active environment so I tried running it.
&lt;/p&gt;

&lt;p&gt;
Running this with the &lt;i&gt;necromuralist&lt;/i&gt; environment active:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;vf upgrade --rebuild
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Gave this error.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Collecting &lt;span class="nv"&gt;PyYAML&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;6.0
  Downloading PyYAML-6.0.tar.gz &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="m"&gt;124&lt;/span&gt; kB&lt;span class="o"&gt;)&lt;/span&gt;
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 3.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did &lt;span class="k"&gt;not&lt;/span&gt; run successfully.
  │ &lt;span class="k"&gt;exit&lt;/span&gt; code: 1
  ╰─&amp;gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="m"&gt;54&lt;/span&gt; lines of output&lt;span class="o"&gt;]&lt;/span&gt;
      running egg_info
      writing lib/PyYAML.egg-info/PKG-INFO
      writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
      writing top-level names to lib/PyYAML.egg-info/top_level.txt
      Traceback &lt;span class="o"&gt;(&lt;/span&gt;most recent call last&lt;span class="o"&gt;)&lt;/span&gt;:
        File &lt;span class="s2"&gt;"/home/hades/.virtualenvs/necromuralist.github.io/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py"&lt;/span&gt;, line 353, &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&amp;gt;
          main&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/home/hades/.virtualenvs/necromuralist.github.io/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py"&lt;/span&gt;, line 335, &lt;span class="k"&gt;in&lt;/span&gt; main
          json_out&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'return_val'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; hook&lt;span class="o"&gt;(&lt;/span&gt;**hook_input&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'kwargs'&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt;
                                   &lt;span class="o"&gt;^^^^^^^^^^^^^^^^^^^^^^^^^^^^&lt;/span&gt;
        File &lt;span class="s2"&gt;"/home/hades/.virtualenvs/necromuralist.github.io/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py"&lt;/span&gt;, line 118, &lt;span class="k"&gt;in&lt;/span&gt; get_requires_for_build_wheel
          &lt;span class="k"&gt;return&lt;/span&gt; hook&lt;span class="o"&gt;(&lt;/span&gt;config_settings&lt;span class="o"&gt;)&lt;/span&gt;
                 &lt;span class="o"&gt;^^^^^^^^^^^^^^^^^^^^^&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/build_meta.py"&lt;/span&gt;, line 325, &lt;span class="k"&gt;in&lt;/span&gt; get_requires_for_build_wheel
          &lt;span class="k"&gt;return&lt;/span&gt; self._get_build_requires&lt;span class="o"&gt;(&lt;/span&gt;config_settings, &lt;span class="nv"&gt;requirements&lt;/span&gt;&lt;span class="o"&gt;=[&lt;/span&gt;&lt;span class="s1"&gt;'wheel'&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt;
                 &lt;span class="o"&gt;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/build_meta.py"&lt;/span&gt;, line 295, &lt;span class="k"&gt;in&lt;/span&gt; _get_build_requires
          self.run_setup&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/build_meta.py"&lt;/span&gt;, line 311, &lt;span class="k"&gt;in&lt;/span&gt; run_setup
          &lt;span class="nb"&gt;exec&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;code, locals&lt;span class="o"&gt;())&lt;/span&gt;
        File &lt;span class="s2"&gt;"&amp;lt;string&amp;gt;"&lt;/span&gt;, line 288, &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&amp;gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/__init__.py"&lt;/span&gt;, line 103, &lt;span class="k"&gt;in&lt;/span&gt; setup
          &lt;span class="k"&gt;return&lt;/span&gt; distutils.core.setup&lt;span class="o"&gt;(&lt;/span&gt;**attrs&lt;span class="o"&gt;)&lt;/span&gt;
                 &lt;span class="o"&gt;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py"&lt;/span&gt;, line 184, &lt;span class="k"&gt;in&lt;/span&gt; setup
          &lt;span class="k"&gt;return&lt;/span&gt; run_commands&lt;span class="o"&gt;(&lt;/span&gt;dist&lt;span class="o"&gt;)&lt;/span&gt;
                 &lt;span class="o"&gt;^^^^^^^^^^^^^^^^^^&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py"&lt;/span&gt;, line 200, &lt;span class="k"&gt;in&lt;/span&gt; run_commands
          dist.run_commands&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py"&lt;/span&gt;, line 969, &lt;span class="k"&gt;in&lt;/span&gt; run_commands
          self.run_command&lt;span class="o"&gt;(&lt;/span&gt;cmd&lt;span class="o"&gt;)&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/dist.py"&lt;/span&gt;, line 968, &lt;span class="k"&gt;in&lt;/span&gt; run_command
          super&lt;span class="o"&gt;()&lt;/span&gt;.run_command&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;command&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py"&lt;/span&gt;, line 988, &lt;span class="k"&gt;in&lt;/span&gt; run_command
          cmd_obj.run&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py"&lt;/span&gt;, line 321, &lt;span class="k"&gt;in&lt;/span&gt; run
          self.find_sources&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py"&lt;/span&gt;, line 329, &lt;span class="k"&gt;in&lt;/span&gt; find_sources
          mm.run&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py"&lt;/span&gt;, line 550, &lt;span class="k"&gt;in&lt;/span&gt; run
          self.add_defaults&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py"&lt;/span&gt;, line 588, &lt;span class="k"&gt;in&lt;/span&gt; add_defaults
          sdist.add_defaults&lt;span class="o"&gt;(&lt;/span&gt;self&lt;span class="o"&gt;)&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/command/sdist.py"&lt;/span&gt;, line 102, &lt;span class="k"&gt;in&lt;/span&gt; add_defaults
          super&lt;span class="o"&gt;()&lt;/span&gt;.add_defaults&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py"&lt;/span&gt;, line 250, &lt;span class="k"&gt;in&lt;/span&gt; add_defaults
          self._add_defaults_ext&lt;span class="o"&gt;()&lt;/span&gt;
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py"&lt;/span&gt;, line 335, &lt;span class="k"&gt;in&lt;/span&gt; _add_defaults_ext
          self.filelist.extend&lt;span class="o"&gt;(&lt;/span&gt;build_ext.get_source_files&lt;span class="o"&gt;())&lt;/span&gt;
                               &lt;span class="o"&gt;^^^^^^^^^^^^^^^^^^^^^^^^^^^^&lt;/span&gt;
        File &lt;span class="s2"&gt;"&amp;lt;string&amp;gt;"&lt;/span&gt;, line 204, &lt;span class="k"&gt;in&lt;/span&gt; get_source_files
        File &lt;span class="s2"&gt;"/tmp/pip-build-env-1ai8jd66/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py"&lt;/span&gt;, line 107, &lt;span class="k"&gt;in&lt;/span&gt; __getattr__
          raise AttributeError&lt;span class="o"&gt;(&lt;/span&gt;attr&lt;span class="o"&gt;)&lt;/span&gt;
      AttributeError: cython_sources
      &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="k"&gt;end&lt;/span&gt; of output&lt;span class="o"&gt;]&lt;/span&gt;

  note: This error originates from a subprocess, &lt;span class="k"&gt;and&lt;/span&gt; is likely &lt;span class="k"&gt;not&lt;/span&gt; a problem with pip.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Which looked like I was in trouble, but it turned out that re-running the upgrade fixed it. One of those magic fixes that would be scary if this was a critical site, I suppose, but which is instead, just another bit of python mystery.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org6dab3cd" class="outline-2"&gt;
&lt;h2 id="org6dab3cd"&gt;Then a Nikola Error&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org6dab3cd"&gt;
&lt;p&gt;
So, with the virtual environment updated to the current python, I waded back into building the site.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nikola build
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
First this produced a &lt;code&gt;nikola&lt;/code&gt; not found error (updating the virtual environment apparently doesn't fix everything). But since the environment itself was fixed pip was now working so I installed it again, but then building the site produced a different error.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;DependencyError - taskid:render_posts:cache/posts/2ac-updating-a-nikola-shortcode-plugin.html  
ERROR: Task &lt;span class="s1"&gt;'render_posts:cache/posts/2ac-updating-a-nikola-shortcode-plugin.html'&lt;/span&gt; saving success: Dependent file &lt;span class="s1"&gt;'/home/hades/.virtualenvs/necromuralist.github.io/lib/python3.11/site-packa&lt;/span&gt;
&lt;span class="s1"&gt;ges/nikola/data/shortcodes/mako/raw.tmpl'&lt;/span&gt; does &lt;span class="k"&gt;not&lt;/span&gt; exist.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Re-reinstalling nikola and re-running the build made the error go away, but in the output I noticed some disturbing messages that looked like these.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;.  render_pages:output/posts/destroying-tags-with-beautiful-soup/index.html
line &lt;span class="m"&gt;135&lt;/span&gt; column &lt;span class="m"&gt;56&lt;/span&gt; - Error: &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&amp;gt; is &lt;span class="k"&gt;not&lt;/span&gt; recognized!
line &lt;span class="m"&gt;144&lt;/span&gt; column &lt;span class="m"&gt;56&lt;/span&gt; - Error: &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&amp;gt; is &lt;span class="k"&gt;not&lt;/span&gt; recognized!
line &lt;span class="m"&gt;154&lt;/span&gt; column &lt;span class="m"&gt;56&lt;/span&gt; - Error: &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&amp;gt; is &lt;span class="k"&gt;not&lt;/span&gt; recognized!
This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
There were are a lot of these errors (which didn't cause nikola to quit so I wouldn't have seen them if I wasn't watching the build messages).
&lt;/p&gt;

&lt;p&gt;
This turned out to be because nikola was encountering errors, trapping them and not failing and then embedding the python error messages into the HTML (and the error messages were causing HTML tidy to fail and then raise a different error message).
&lt;/p&gt;

&lt;p&gt;
This is an example of an error message embedded in the HTML nikola created:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Traceback&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="s2"&gt;"/home/hades/.local/bin/pygmentize"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;pygments.cmdline&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;span class="ne"&gt;ModuleNotFoundError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;No&lt;/span&gt; &lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;named&lt;/span&gt; &lt;span class="s1"&gt;'pygments'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
The cause for this one was a little more mysterious, but it turned out that I had installed &lt;code&gt;pygmentize&lt;/code&gt; using &lt;code&gt;pipx&lt;/code&gt; so it needed to be updated separately. I decided to use &lt;code&gt;pipx reinstall-all&lt;/code&gt; to get everything updated.
&lt;/p&gt;

&lt;p&gt;
Unfortunately, there were a lot of posts with the &lt;code&gt;pygmentize&lt;/code&gt; errors, and since they aren't registered as errors by nikola, just building the site didn't fix them so I wiped it first and then re-built it.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nikola clean
nikola build
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And since there weren't anymore errors I decided to cross my fingers and move on.
&lt;/p&gt;

&lt;div class="notecard" id="org9ea6956"&gt;
&lt;p&gt;
&lt;b&gt;&lt;b&gt;Note to future self:&lt;/b&gt;&lt;/b&gt; This happened again with the update to Ubuntu 25.04 (Plucky Puffin) and the error messages from not cleaning the old build were confusing/misleading enough to cause me to waste time troubleshooting them. A clean build is a &lt;i&gt;really&lt;/i&gt; good idea.
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgf9d15a8" class="outline-2"&gt;
&lt;h2 id="orgf9d15a8"&gt;An Ape-Iron Problem (no distutils)&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgf9d15a8"&gt;
&lt;p&gt;
The &lt;code&gt;vf ls --details&lt;/code&gt; command I used to check on the virtual environment for this site also showed that all my other virtual environments were broken so I decided to try and fix the &lt;code&gt;Ape-Iron&lt;/code&gt; repository while it was fresh on my mind. First I rebuilt the environment.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;vf upgrade --rebuild Ape-Iron
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And of course, it gave me errors.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Collecting &lt;span class="nv"&gt;numpy&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;1.24.3
  Downloading numpy-1.24.3.tar.gz &lt;span class="o"&gt;(&lt;/span&gt;10.9 MB&lt;span class="o"&gt;)&lt;/span&gt;
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 7.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
ERROR: Exception:
Traceback &lt;span class="o"&gt;(&lt;/span&gt;most recent call last&lt;span class="o"&gt;)&lt;/span&gt;:
  File &lt;span class="s2"&gt;"/home/hades/.virtualenvs/Ape-Iron/lib/python3.12/site-packages/pip/_internal/cli/base_command.py"&lt;/span&gt;, line 180, &lt;span class="k"&gt;in&lt;/span&gt; exc_logging_wrapper
&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;File &lt;span class="s2"&gt;"/tmp/pip-build-env-f7h7lvcc/overlay/lib/python3.12/site-packages/setuptools/__init__.py"&lt;/span&gt;, line 10, &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&amp;gt;
    import distutils.core
ModuleNotFoundError: No module named &lt;span class="s1"&gt;'distutils'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
According to &lt;a href="https://stackoverflow.com/a/77233866"&gt;this answer&lt;/a&gt; to a question on &lt;i&gt;StackOverflow&lt;/i&gt; &lt;code&gt;distutils&lt;/code&gt; was removed from python 3.12, which is the default with &lt;i&gt;noble-numbat&lt;/i&gt;. The answer suggests installing &lt;a href="https://github.com/pypa/setuptools"&gt;&lt;code&gt;setuptools&lt;/code&gt;&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
So, I tried that.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pip install setuptools --upgrade
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Amazingly, the upgrade of Ape-Iron seemed to work.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;vf upgrade --rebuild Ape-Iron
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
At this point I think I just called it a day.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org5b4d613" class="outline-2"&gt;
&lt;h2 id="org5b4d613"&gt;Links&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org5b4d613"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://virtualfish.readthedocs.io/en/latest/usage.html#upgrading-virtual-environments"&gt;Upgrading Virtual Environments&lt;/a&gt;: Virtualfish Documentation&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/yaml/pyyaml/issues/601"&gt;AttributeError: cython_sources&lt;/a&gt;: A PyYAML bug report that looks related to the error.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>pipx</category><category>ubuntu</category><category>upgrading</category><category>virtualfish</category><guid>https://necromuralist.github.io/posts/noble-numbat-and-the-broken-virtual-environments/</guid><pubDate>Mon, 27 May 2024 23:21:26 GMT</pubDate></item><item><title>Fish Links</title><link>https://necromuralist.github.io/posts/fish-links/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://github.com/jorgebucaran/awsm.fish"&gt;awsm.fish&lt;/a&gt;: a github readme with links to fish-related things&lt;/li&gt;
&lt;/ul&gt;</description><category>fish</category><category>links</category><guid>https://necromuralist.github.io/posts/fish-links/</guid><pubDate>Sat, 17 Jun 2023 21:30:02 GMT</pubDate></item><item><title>Apt-Fast In Sparky Linux</title><link>https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org019f34a"&gt;Background&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#orga8b9bdc"&gt;The Intructions&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#orgc3f29f5"&gt;Create An Apt Entry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org5b5b6f8"&gt;Add the Keyring and Install&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org45d4e48"&gt;The apt-key Solution&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org9ce6a08"&gt;The Start of the Solution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#orgb048e49"&gt;Getting the GPG File&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#orgabd5047"&gt;Now Back to Setting it Up&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org5a37367"&gt;Update and Install&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org21606e2"&gt;And Now, Another Problem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org75c815e"&gt;What Have We Learned Today Children?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/#org42b613d"&gt;Links Collected&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org019f34a" class="outline-2"&gt;
&lt;h2 id="org019f34a"&gt;Background&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org019f34a"&gt;
&lt;p&gt;
I have an old eeePC netbook that I thought I'd revive by loading &lt;a href="https://sparkylinux.org/"&gt;Sparky Linux&lt;/a&gt; onto it. One of the things I set up on it is &lt;a href="https://github.com/ilikenwf/apt-fast"&gt;apt-fast&lt;/a&gt;, which the README on the github repository describes like this:
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;
apt-fast is a shellscript wrapper for apt-get and aptitude that can drastically improve apt download times by downloading packages in parallel, with multiple connections per package.
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
I've used it for a while on ubuntu but Sparky Linux didn't have it in the repositories. The apt-fast documentation has instructions for &lt;a href="https://github.com/ilikenwf/apt-fast#debian-and-derivates"&gt;installing it on debian (and derivatives)&lt;/a&gt; and since Sparky Linux is based on debian (the current version, SparkyLinux 6.7 (Po-Tolo) is based on debian bullseye) I decided to try that. Ultimately I got it working, but as is often the case, it wasn't quite so straightforward as I would like for it to have been.
&lt;/p&gt;

&lt;p&gt;
Unusual Ingredients List:
&lt;/p&gt;

&lt;ul class="org-ul"&gt;
&lt;li&gt;SparkyLinux 6.7 (Po-Tolo)&lt;/li&gt;
&lt;li&gt;fish shell&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orga8b9bdc" class="outline-2"&gt;
&lt;h2 id="orga8b9bdc"&gt;The Intructions&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orga8b9bdc"&gt;
&lt;p&gt;
Although the PPA system is built for Ubuntu, the recommendation from apt-fast is to use it with debian-based systems too (apt-fast is just a shell-script that runs &lt;code&gt;aria2&lt;/code&gt; and &lt;code&gt;apt&lt;/code&gt; (or &lt;code&gt;apt-get&lt;/code&gt;, etc.) so it's not like there's a lot of dependencies that might conflict). This is what they say to do.
&lt;/p&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgc3f29f5" class="outline-3"&gt;
&lt;h3 id="orgc3f29f5"&gt;Create An Apt Entry&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgc3f29f5"&gt;
&lt;p&gt;
First I created a file for the sources at &lt;code&gt;/etc/apt/sources.list.d/apt-fast.list&lt;/code&gt; and put these lines in it.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;deb http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main 
deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Bionic came out in 2018 so they maybe haven't updated the instructions in a while.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org5b5b6f8" class="outline-3"&gt;
&lt;h3 id="org5b5b6f8"&gt;Add the Keyring and Install&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org5b5b6f8"&gt;
&lt;p&gt;
Once the file was in place I ran the commands.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
apt-get update
apt-get install apt-fast
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
The first output I saw was a warning:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Warning: apt-key is deprecated. Manage keyring files &lt;span class="k"&gt;in&lt;/span&gt; trusted.gpg.d instead &lt;span class="o"&gt;(&lt;/span&gt;see apt-key&lt;span class="o"&gt;(&lt;/span&gt;8&lt;span class="o"&gt;))&lt;/span&gt;.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This is something I've seen on ubuntu as well so fixing it seemed like a useful thing to do, especially since at the end of the regular output I got an error.
&lt;/p&gt;

&lt;p&gt;
Between the warning and the final error there was the usual output that I've seen:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Executing: /tmp/apt-key-gpghome.YL04bWmGAF/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
gpg: key 1EE2FF37CA8DA16B: public key &lt;span class="s2"&gt;"Launchpad PPA for apt-fast"&lt;/span&gt; imported
gpg: Total number processed: 1
gpg:               imported: 1
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then came this, the error I mentioned, which is not what I usually see:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;gpg: no writable keyring found: Not found
gpg: error reading &lt;span class="s1"&gt;'[stdin]'&lt;/span&gt;: General error
gpg: import from &lt;span class="s1"&gt;'[stdin]'&lt;/span&gt; failed: General error
gpg: Total number processed: 0
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
I don't know if this is a debian problem or a sparky linux problem, but since you're not supposed to be using this method anyway, I went looking for a different solution.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org45d4e48" class="outline-2"&gt;
&lt;h2 id="org45d4e48"&gt;The apt-key Solution&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org45d4e48"&gt;
&lt;/div&gt;
&lt;div id="outline-container-org9ce6a08" class="outline-3"&gt;
&lt;h3 id="org9ce6a08"&gt;The Start of the Solution&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org9ce6a08"&gt;
&lt;p&gt;
The first part of the solution was pointed to by &lt;a href="https://stackoverflow.com/a/71384057"&gt;this Stack Overflow Answer&lt;/a&gt;. There was a problem with the answer, though, in that the person asking the question was using a URL that pointed to a gpg file, so the answers all assumed you could download it with curl, wget, etc. (all the answers that I could understand, anyway). So now that I had the answer I had a new problem - how do you get the file from the keyserver?
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgb048e49" class="outline-3"&gt;
&lt;h3 id="orgb048e49"&gt;Getting the GPG File&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgb048e49"&gt;
&lt;p&gt;
Once again to the web, this time &lt;a href="https://superuser.com/a/1643115"&gt;this answer from SuperUser&lt;/a&gt; seemed to work.
&lt;/p&gt;

&lt;p&gt;
First, I made a temporary directory and pointed &lt;code&gt;GNUPGHOME&lt;/code&gt; to it so that I wasn't adding anything to my actual gpg setup (this is fish-shell syntax).
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;set&lt;/span&gt; -x GNUPGHOME &lt;span class="nv"&gt;$(&lt;/span&gt;mktemp -d&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
&lt;code&gt;echo $GNUPGHOME&lt;/code&gt; showed that this created a file at &lt;code&gt;/tmp/tmp.dUDUEgFQ0x&lt;/code&gt; (but I didn't actually need to know that, I'm just mentioning it).
&lt;/p&gt;

&lt;p&gt;
Taking the &lt;code&gt;--recv-keys&lt;/code&gt; argument from the instructions above (&lt;code&gt;apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B&lt;/code&gt;) I added the key.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;gpg --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Next I made a place to put the gpg file.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo mkdir /etc/apt/keyrings
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then I output the file in my home directory (the &lt;code&gt;GNUPGHOME&lt;/code&gt;  environment variable is only available to my user, so I put the file somewhere that I didn't need to be root, i.e. my home directory).
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;gpg -o A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg --export A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then I moved the file into the directory I created for it.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo mv A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg /etc/apt/keyrings/
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
The SuperUser answer I linked to used &lt;code&gt;gpg -ao&lt;/code&gt; but the &lt;code&gt;a&lt;/code&gt; option makes it an "armored" file, and part of the Stack Overflow answer for setting up the key is about de-armoring it so I just left that option out.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgabd5047" class="outline-3"&gt;
&lt;h3 id="orgabd5047"&gt;Now Back to Setting it Up&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgabd5047"&gt;
&lt;p&gt;
So now that we have the keyring we need to edit the &lt;code&gt;/etc/apt/sources.list.d/apt-fast.list&lt;/code&gt; file that we created at the beginning of this.
&lt;/p&gt;

&lt;p&gt;
This is what I started with.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;deb http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main 
deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And I changed it to refer to the gpg file that I created.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;deb &lt;span class="o"&gt;[&lt;/span&gt;signed-by&lt;span class="o"&gt;=&lt;/span&gt;/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg&lt;span class="o"&gt;]&lt;/span&gt; http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
deb-src  &lt;span class="o"&gt;[&lt;/span&gt;signed-by&lt;span class="o"&gt;=&lt;/span&gt;/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg&lt;span class="o"&gt;]&lt;/span&gt;  http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org5a37367" class="outline-3"&gt;
&lt;h3 id="org5a37367"&gt;Update and Install&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org5a37367"&gt;
&lt;p&gt;
So then I updated apt and installed it.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo apt update
sudo apt install apt-fast
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And it worked.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org21606e2" class="outline-2"&gt;
&lt;h2 id="org21606e2"&gt;And Now, Another Problem&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org21606e2"&gt;
&lt;p&gt;
This got me to a working &lt;code&gt;apt-fast&lt;/code&gt; installation but the fact that I was using &lt;code&gt;bionic&lt;/code&gt; seemed off to me so I decided to update the &lt;code&gt;apt-fast.list&lt;/code&gt;. Under the instructions for adding the PPA is this note.
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;
Note that the PPA version bionic might need to be updated with the recent Ubuntu LTS codename to stay up-to-date.
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
So I went and looked up the &lt;a href="https://ubuntu.com/about/release-cycle"&gt;Ubuntu Release Cycle&lt;/a&gt; and saw that "jammy" is the most recent version so I updated the &lt;code&gt;apt-fast.list&lt;/code&gt; file to match.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;deb &lt;span class="o"&gt;[&lt;/span&gt;signed-by&lt;span class="o"&gt;=&lt;/span&gt;/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg&lt;span class="o"&gt;]&lt;/span&gt; http://ppa.launchpad.net/apt-fast/stable/ubuntu jammy main
deb-src  &lt;span class="o"&gt;[&lt;/span&gt;signed-by&lt;span class="o"&gt;=&lt;/span&gt;/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg&lt;span class="o"&gt;]&lt;/span&gt;  http://ppa.launchpad.net/apt-fast/stable/ubuntu jammy main
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And then I installed the newer version.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo apt update
sudo apt install apt-fast
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And I got a nice long stack-trace and error message at the bottom of which was this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;dpkg-deb: error: archive &lt;span class="s1"&gt;'/var/cache/apt/archives/apt-fast_1.9.12-1~ubuntu22.04.1_all.deb'&lt;/span&gt; uses unknown compression &lt;span class="k"&gt;for&lt;/span&gt; member &lt;span class="s1"&gt;'control.tar.zst'&lt;/span&gt;, giving up
dpkg: error processing archive /var/cache/apt/archives/apt-fast_1.9.12-1~ubuntu22.04.1_all.deb &lt;span class="o"&gt;(&lt;/span&gt;--unpack&lt;span class="o"&gt;)&lt;/span&gt;:
 dpkg-deb --control subprocess returned error &lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="nb"&gt;status &lt;/span&gt;2
Errors were encountered &lt;span class="k"&gt;while&lt;/span&gt; processing:
 /var/cache/apt/archives/apt-fast_1.9.12-1~ubuntu22.04.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code &lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
The part of it that seemed like it might matter the most was the fragment:
&lt;/p&gt;

&lt;pre class="example" id="orga8c1fed"&gt;
uses unknown compression for member 'control.tar.zst', giving up~
&lt;/pre&gt;

&lt;p&gt;
What is a &lt;code&gt;zst&lt;/code&gt; file? &lt;a href="https://en.wikipedia.org/wiki/Zstd?useskin=vector"&gt;According to wikipedia&lt;/a&gt; it's a "Zstandard" file and Debian and Ubuntu added support for using it to compress &lt;code&gt;deb&lt;/code&gt; packages back in 2018. There is a package listed in &lt;code&gt;apt&lt;/code&gt; called &lt;code&gt;zstd&lt;/code&gt; that it says supports &lt;code&gt;zst&lt;/code&gt; compression so I installed it but the error remained.
&lt;/p&gt;

&lt;p&gt;
Once again, someone ran into this and asked about it on &lt;a href="https://unix.stackexchange.com/questions/669004/zst-compression-not-supported-by-apt-dpkg"&gt;Stack Exchange&lt;/a&gt;. &lt;a href="https://unix.stackexchange.com/a/669008"&gt;One of the answers&lt;/a&gt; said:
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;
Debian’s dpkg package didn’t support zstd compression prior to version 1.21.18. Support was added just in time for Debian 12.
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
Since the SparkyLinux install is based on Debian 11 that seemed like it might be the problem. I checked the dpkg-version and got back:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Debian&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'dpkg'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;package&lt;span class="w"&gt; &lt;/span&gt;management&lt;span class="w"&gt; &lt;/span&gt;program&lt;span class="w"&gt; &lt;/span&gt;version&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;.20.12&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;i386&lt;span class="o"&gt;)&lt;/span&gt;.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
So that seemed like the likely culprit. The ubuntu release dates page noted that there was a LTS version between "bionic" and "jammy" called "focal" so I edited the &lt;code&gt;apt-fast.list&lt;/code&gt; file again, replacing "jammy" with "focal" and re-ran the installation and so far… it works.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org75c815e" class="outline-2"&gt;
&lt;h2 id="org75c815e"&gt;What Have We Learned Today Children?&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org75c815e"&gt;
&lt;p&gt;
Further down in the installation instructions it says that you can just download the files and install them along with the &lt;code&gt;aria2&lt;/code&gt; package, so going through this whole thing was kind of unnecessary, but getting around the apt-key problem was something that I'd wondered about before, so it might be useful in the future, if PPA creators keep using it and they don't come up with an automatic fix for it.
&lt;/p&gt;

&lt;p&gt;
I guess the main thing I learned is that I should have read to the end of the instructions and picked the easy way out instead of trying to force the old familiar way to work.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org42b613d" class="outline-2"&gt;
&lt;h2 id="org42b613d"&gt;Links Collected&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org42b613d"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;FWDekker. Answer to “Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead” [Internet]. Stack Overflow. 2022 [cited 2023 Jun 16]. Available from: &lt;a href="https://stackoverflow.com/a/71384057"&gt;https://stackoverflow.com/a/71384057&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kitt S. Answer to “zst compression not supported by apt/dpkg” [Internet]. Unix &amp;amp; Linux Stack Exchange. 2021 [cited 2023 Jun 16]. Available from: &lt;a href="https://unix.stackexchange.com/a/669008"&gt;https://unix.stackexchange.com/a/669008&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;fuzzydrawrings. Answer to “gpg: only download a key from a keyserver” [Internet]. Super User. 2021 [cited 2023 Jun 16]. Available from: &lt;a href="https://superuser.com/a/1643115"&gt;https://superuser.com/a/1643115&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;ilikenwf/apt-fast: apt-fast: A shellscript wrapper for apt that speeds up downloading of packages. [Internet]. [cited 2023 Jun 16]. Available from: &lt;a href="https://github.com/ilikenwf/apt-fast"&gt;https://github.com/ilikenwf/apt-fast&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;zstd. In: Wikipedia [Internet]. 2023 [cited 2023 Jun 16]. Available from: &lt;a href="https://en.wikipedia.org/w/index.php?title=Zstd&amp;amp;oldid=1157564498"&gt;https://en.wikipedia.org/w/index.php?title=Zstd&amp;amp;oldid=1157564498&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>apt</category><category>debian</category><category>howto</category><category>ubuntu</category><guid>https://necromuralist.github.io/posts/apt-fast-in-sparky-linux/</guid><pubDate>Fri, 16 Jun 2023 20:15:45 GMT</pubDate></item><item><title>Fish, Mocha, Chai - A Local Global Installation In Ubuntu</title><link>https://necromuralist.github.io/posts/fish-mocha-chai-a-local-global-installation-in-ubuntu/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="outline-container-org3976c6b" class="outline-2"&gt;
&lt;h2 id="org3976c6b"&gt;What This Is About&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org3976c6b"&gt;
&lt;p&gt;
I've been getting back into &lt;a href="https://p5.js.org"&gt;p5.js&lt;/a&gt; lately and thought that I should add some testing so I went to their site and found that they had a tutorial page called &lt;a href="https://p5js.org/learn/tdd.html"&gt;"Unit Testing and Test Driven Development"&lt;/a&gt; which I decided to follow along with to get re-acquainted with testing javascript but then I ran into a problem running &lt;a href="https://mochajs.org/"&gt;mocha&lt;/a&gt;, or more specifically, running mocha crashed because it couldn't find &lt;a href="https://www.chaijs.com/"&gt;chai&lt;/a&gt; even though I'd followed the instructions to install it. So here goes what I did to fix it.
&lt;/p&gt;

&lt;p&gt;
This is another case where you can basically find the answer online if you look at the right page - but there seems to be more pages with the unhelpful answers and I use the fish shell and ubuntu so it's a little different from the stuff I found that did work.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgf39b5ea" class="outline-2"&gt;
&lt;h2 id="orgf39b5ea"&gt;The Tutorial's Installation&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgf39b5ea"&gt;
&lt;p&gt;
This is how they tell you to install mocha and chai.
&lt;/p&gt;

&lt;p&gt;
First, update npm (assuming you've already installed it somehow).
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo npm install npm@latest -g
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then install mocha and chai using npm.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;npm install mocha -g
npm install chai -g
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This right here is actually where the trouble starts. If you try to install things globally, you need to run it as root, thus the use of &lt;code&gt;sudo&lt;/code&gt; when updating &lt;code&gt;npm&lt;/code&gt;. But their instructions on installing &lt;code&gt;mocha&lt;/code&gt; and &lt;code&gt;chai&lt;/code&gt; don't say to use &lt;code&gt;sudo&lt;/code&gt;, which will result in a permission error, so did they forget to run it as root, or did they not mean to install it globally? I decided to  re-run their instructions as root.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo npm install mocha -g
sudo npm install chai -g
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This seemed to work, but when I ran &lt;code&gt;mocha&lt;/code&gt; on the folder where I put the code given in the tutorial:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;mocha color_unit_tests/
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
It gave me an error.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Error: Cannot find module &lt;span class="s1"&gt;'chai'&lt;/span&gt;
Require stack:
- /home/hades/projects/ape-iron/p5tests/color_unit_tests/test.js
    at Module._resolveFilename &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:1097:15&lt;span class="o"&gt;)&lt;/span&gt;
    at Module._load &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:942:27&lt;span class="o"&gt;)&lt;/span&gt;
    at Module.require &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:1163:19&lt;span class="o"&gt;)&lt;/span&gt;
    at require &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/helpers:110:18&lt;span class="o"&gt;)&lt;/span&gt;
    at Object.&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;anonymous&amp;gt; &lt;span class="o"&gt;(&lt;/span&gt;/home/hades/projects/ape-iron/p5tests/color_unit_tests/test.js:5:16
&lt;span class="o"&gt;)&lt;/span&gt;
    at Module._compile &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:1276:14&lt;span class="o"&gt;)&lt;/span&gt;
    at Module._extensions..js &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:1330:10&lt;span class="o"&gt;)&lt;/span&gt;
    at Module.load &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:1139:32&lt;span class="o"&gt;)&lt;/span&gt;
    at Module._load &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/cjs/loader:980:12&lt;span class="o"&gt;)&lt;/span&gt;
    at ModuleWrap.&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;anonymous&amp;gt; &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/esm/translators:169:29&lt;span class="o"&gt;)&lt;/span&gt;
    at ModuleJob.run &lt;span class="o"&gt;(&lt;/span&gt;node:internal/modules/esm/module_job:194:25&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
So, maybe that wasn't the answer.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org5def699" class="outline-2"&gt;
&lt;h2 id="org5def699"&gt;This Might Be the Wrong Way&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org5def699"&gt;
&lt;p&gt;
I found a &lt;a href="https://stackoverflow.com/questions/43156635/chai-mocha-global-local"&gt;Stack Overflow&lt;/a&gt; question that described the exact problem I had, but one of the comments had this to say:
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;
Mocha can be installed either locally or globally, but Chai can only be installed locally. Has to do with the way it is applied (i.e., to the specific app instance). – 
Steve Carey
May 30, 2020 at 21:11
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
I don't know who "Steve Carey" is and whether what he is saying is true, but the &lt;a href="https://www.chaijs.com/guide/installatio"&gt;chai installation instructions&lt;/a&gt; do tell you to install it locally, rather than globally, but when you do this for every project you end up with &lt;code&gt;node_modules&lt;/code&gt; and &lt;code&gt;package.json&lt;/code&gt; files all over the place. I suppose there's a reason for this, maybe to couple the version of chai you're using with the project, but I decided to try another way.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgf582407" class="outline-2"&gt;
&lt;h2 id="orgf582407"&gt;The Local Global&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgf582407"&gt;
&lt;p&gt;
&lt;a href="https://stackoverflow.com/a/13021677"&gt;This answer&lt;/a&gt; on Stack Overflow describes how to install npm-packages into your home directory as your global directory. It assumes you're using bash, though, so I had to change it up a little bit.
&lt;/p&gt;
&lt;/div&gt;

&lt;div id="outline-container-org3dc0c70" class="outline-3"&gt;
&lt;h3 id="org3dc0c70"&gt;Make a local package directory&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org3dc0c70"&gt;
&lt;p&gt;
First I made a local package directory.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;mkdir ~/.npm-packages
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then I created a file called &lt;code&gt;~/.npmrc&lt;/code&gt; that had one line in it.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;prefix&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; /home/hades/.npm-packages
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
With &lt;code&gt;/home/hades/&lt;/code&gt; being my home-directory.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgbeb6c5c" class="outline-3"&gt;
&lt;h3 id="orgbeb6c5c"&gt;Edit the Fish Configuration&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgbeb6c5c"&gt;
&lt;p&gt;
At the bottom of the &lt;code&gt;~/.config/fish/config.fish&lt;/code&gt; file I added these lines.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;set&lt;/span&gt; -x NPM_PACKAGES &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.npm-packages
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This is where &lt;code&gt;npm&lt;/code&gt; will install stuff if you tell it to install files globally once we're done. The folder can be named anything, I imagine, but it will need to match what's in the &lt;code&gt;.npmrc&lt;/code&gt; file.
&lt;/p&gt;

&lt;p&gt;
When &lt;code&gt;npm&lt;/code&gt; installs packages some of them will be executable commands (like &lt;code&gt;mocha&lt;/code&gt;) and so I had to update the fish &lt;code&gt;PATH&lt;/code&gt;.
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;fish_add_path &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.npm-packages/bin
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Although this will make &lt;code&gt;mocha&lt;/code&gt; available, &lt;code&gt;chai&lt;/code&gt; isn't an executable so you have to set the &lt;code&gt;NODE_PATH&lt;/code&gt; variable so that node will no where to look for modules to import.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;set&lt;/span&gt; --export NODE_PATH &lt;span class="nv"&gt;$NPM_PACKAGES&lt;/span&gt;/lib/node_modules
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
I was originally appending the current contents of &lt;code&gt;NODE_PATH&lt;/code&gt; to the end, like you would with a regular path variable (&lt;code&gt;$NPM_PACKAGES/lib/node_modules:$NODE_PATH&lt;/code&gt;) but for some reason this breaks something and the variable doesn't get set. Or at least it was always empty when I tried to run &lt;code&gt;mocha&lt;/code&gt;. So the solution for me was to always clobber the entire path (the variable was empty before I started using it anyway).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgc20996d" class="outline-2"&gt;
&lt;h2 id="orgc20996d"&gt;And Now&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgc20996d"&gt;
&lt;p&gt;
Running the tests again:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;mocha ../../ape-iron/p5tests/color_unit_tests/
&lt;/pre&gt;&lt;/div&gt;

&lt;pre class="example"&gt;


these are my first tests for p5js
  ✔ should be a string
  ✔ should be equal to awesome


2 passing (5ms)

&lt;/pre&gt;


&lt;p&gt;
The path is different because I'm writing this post in a different repository, but, anyway, it looks like it works.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org77f33ec" class="outline-2"&gt;
&lt;h2 id="org77f33ec"&gt;Sources&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org77f33ec"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Drechsel E. Install NPM into home directory with distribution nodejs package (Ubuntu) [Internet]. Stack Overflow. 2019 [cited 2023 Jun 8]. Available from: &lt;a href="https://stackoverflow.com/q/10081293"&gt;https://stackoverflow.com/q/10081293&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Unit Testing and Test Driven Development | p5.js [Internet]. [cited 2023 Jun 8]. Available from: &lt;a href="https://p5js.org/learn/tdd.html"&gt;https://p5js.org/learn/tdd.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>fish</category><category>howto</category><category>node</category><category>ubuntu</category><guid>https://necromuralist.github.io/posts/fish-mocha-chai-a-local-global-installation-in-ubuntu/</guid><pubDate>Thu, 08 Jun 2023 23:29:32 GMT</pubDate></item><item><title>Ubuntu 22.04, Python 3.11 and the "emacs-jupyter Symbol's variable is void" Error</title><link>https://necromuralist.github.io/posts/python-311-and-emacs-jupyter-symbols-variable-is-void-error/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="outline-container-orgf87be14" class="outline-2"&gt;
&lt;h2 id="orgf87be14"&gt;What This Is About&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgf87be14"&gt;
&lt;p&gt;
Ubuntu 22.04 no longer let's you install python packages globally using pip by default (you can override it but they warn you not to). This has caused a cascade of broken parts on my system, since I use python so much. This particular case started with me trying to start the &lt;a href="https://docs.jupyter.org/en/latest/projects/kernels.html"&gt;&lt;code&gt;jupyter kernel&lt;/code&gt;&lt;/a&gt; so that I could run some python code in org-mode and getting (what looked like) an error and fixing it ended up uncovering the fact that working with the new policy for pip broke my emacs setup a little too, so this is a dump of how I got it back up and running again. I recorded it as I was fixing things so there might be a better way, but this is the first pass I took.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org1c0defd" class="outline-2"&gt;
&lt;h2 id="org1c0defd"&gt;The Jupyter Kernel Warning&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org1c0defd"&gt;
&lt;p&gt;
This is what happened when I tried to start the jupyter kernel.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;Ape-Iron&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;hades@erebus&lt;span class="w"&gt; &lt;/span&gt;~&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;jupyter&lt;span class="w"&gt; &lt;/span&gt;kernel
&lt;span class="o"&gt;[&lt;/span&gt;KernelApp&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Starting&lt;span class="w"&gt; &lt;/span&gt;kernel&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'python3'&lt;/span&gt;
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;Debugger&lt;span class="w"&gt; &lt;/span&gt;warning:&lt;span class="w"&gt; &lt;/span&gt;It&lt;span class="w"&gt; &lt;/span&gt;seems&lt;span class="w"&gt; &lt;/span&gt;that&lt;span class="w"&gt; &lt;/span&gt;frozen&lt;span class="w"&gt; &lt;/span&gt;modules&lt;span class="w"&gt; &lt;/span&gt;are&lt;span class="w"&gt; &lt;/span&gt;being&lt;span class="w"&gt; &lt;/span&gt;used,&lt;span class="w"&gt; &lt;/span&gt;which&lt;span class="w"&gt; &lt;/span&gt;may
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;make&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;debugger&lt;span class="w"&gt; &lt;/span&gt;miss&lt;span class="w"&gt; &lt;/span&gt;breakpoints.&lt;span class="w"&gt; &lt;/span&gt;Please&lt;span class="w"&gt; &lt;/span&gt;pass&lt;span class="w"&gt; &lt;/span&gt;-Xfrozen_modules&lt;span class="o"&gt;=&lt;/span&gt;off
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;python&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;disable&lt;span class="w"&gt; &lt;/span&gt;frozen&lt;span class="w"&gt; &lt;/span&gt;modules.
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;Note:&lt;span class="w"&gt; &lt;/span&gt;Debugging&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;proceed.&lt;span class="w"&gt; &lt;/span&gt;Set&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;PYDEVD_DISABLE_FILE_VALIDATION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;disable&lt;span class="w"&gt; &lt;/span&gt;this&lt;span class="w"&gt; &lt;/span&gt;val
idation.
&lt;span class="o"&gt;[&lt;/span&gt;KernelApp&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Connection&lt;span class="w"&gt; &lt;/span&gt;file:&lt;span class="w"&gt; &lt;/span&gt;/home/hades/.local/share/jupyter/runtime/kernel-a57a8231-bfea-468
&lt;span class="m"&gt;0&lt;/span&gt;-9f8b-6bf1b1e3a7ac.json
&lt;span class="o"&gt;[&lt;/span&gt;KernelApp&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;To&lt;span class="w"&gt; &lt;/span&gt;connect&lt;span class="w"&gt; &lt;/span&gt;a&lt;span class="w"&gt; &lt;/span&gt;client:&lt;span class="w"&gt; &lt;/span&gt;--existing&lt;span class="w"&gt; &lt;/span&gt;kernel-a57a8231-bfea-4680-9f8b-6bf1b1e3a7ac.json
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;Debugger&lt;span class="w"&gt; &lt;/span&gt;warning:&lt;span class="w"&gt; &lt;/span&gt;It&lt;span class="w"&gt; &lt;/span&gt;seems&lt;span class="w"&gt; &lt;/span&gt;that&lt;span class="w"&gt; &lt;/span&gt;frozen&lt;span class="w"&gt; &lt;/span&gt;modules&lt;span class="w"&gt; &lt;/span&gt;are&lt;span class="w"&gt; &lt;/span&gt;being&lt;span class="w"&gt; &lt;/span&gt;used,&lt;span class="w"&gt; &lt;/span&gt;which&lt;span class="w"&gt; &lt;/span&gt;may
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;make&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;debugger&lt;span class="w"&gt; &lt;/span&gt;miss&lt;span class="w"&gt; &lt;/span&gt;breakpoints.&lt;span class="w"&gt; &lt;/span&gt;Please&lt;span class="w"&gt; &lt;/span&gt;pass&lt;span class="w"&gt; &lt;/span&gt;-Xfrozen_modules&lt;span class="o"&gt;=&lt;/span&gt;off
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;python&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;disable&lt;span class="w"&gt; &lt;/span&gt;frozen&lt;span class="w"&gt; &lt;/span&gt;modules.
&lt;span class="m"&gt;0&lt;/span&gt;.00s&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;Note:&lt;span class="w"&gt; &lt;/span&gt;Debugging&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;proceed.&lt;span class="w"&gt; &lt;/span&gt;Set&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;PYDEVD_DISABLE_FILE_VALIDATION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;disable&lt;span class="w"&gt; &lt;/span&gt;this&lt;span class="w"&gt; &lt;/span&gt;validation.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
According to &lt;a href="https://stackoverflow.com/questions/75114841/debugger-warning-from-ipython-frozen-modules"&gt;this Stack Overflow post&lt;/a&gt; the output, though scary-looking, is only a warning, and you should be able to ignore it. It's happening because python 3.11 uses a "frozen" version of python with code objects for some of the built-in python modules that get loaded when the interpreter starts up already pre-allocated in order to reduce their load time during python's start up (i.e. they set it up to start faster), and their doing this means that the debugger might not work correctly - but since I'm not using the debugger, it shouldn't matter.
&lt;/p&gt;

&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/whatsnew/3.11.html#faster-startup"&gt;Python Note on their freezing the modules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.python.org/moin/Freeze"&gt;Python documentation of "freezing"&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Ah, but there's always a problem lurking behind the advice to ignore "harmless warnings". Even with the kernel running, I couldn't get python/jupyter to work in my org-babel source blocks, so there was more to do.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org962b1db" class="outline-2"&gt;
&lt;h2 id="org962b1db"&gt;Getting emacs-jupyter Working&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org962b1db"&gt;
&lt;/div&gt;
&lt;div id="outline-container-org4c60c2f" class="outline-3"&gt;
&lt;h3 id="org4c60c2f"&gt;The Problem&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org4c60c2f"&gt;
&lt;p&gt;
The first clue as to what might be happing was this line in emacs' startup messages.
&lt;/p&gt;

&lt;pre class="example" id="org16b2cb1"&gt;
Symbol’s function definition is void: org-babel-execute:jupyter-python
&lt;/pre&gt;

&lt;p&gt;
It looked like &lt;a href="https://github.com/emacs-jupyter/jupyter"&gt;emacs-jupyter&lt;/a&gt; wasn't loading properly. There was also this message in the output:
&lt;/p&gt;

&lt;pre class="example" id="orga915c96"&gt;
Error retrieving kernelspecs: (json-number-format 5)
&lt;/pre&gt;

&lt;p&gt;
Searching for that error-message brought up this bug-report on github:
&lt;/p&gt;

&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://github.com/emacs-jupyter/jupyter/issues/436"&gt;https://github.com/emacs-jupyter/jupyter/issues/436&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Wherein the author of the bug-report mentions that loading emacs-jupyter is failing because it's trying to parse the output of jupyter and the warnings I was seeing causes it to fail (the bug-report references a different jupyter command, but the problematic output is the same).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org0113c1a" class="outline-3"&gt;
&lt;h3 id="org0113c1a"&gt;Testing Turning Off the Warning&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org0113c1a"&gt;
&lt;p&gt;
The first thing I tried was to follow the directions in the output and supress the warnings by setting an environment variable.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;--universal&lt;span class="w"&gt; &lt;/span&gt;--export&lt;span class="w"&gt; &lt;/span&gt;PYDEVD_DISABLE_FILE_VALIDATION&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
&lt;b&gt;Note:&lt;/b&gt; This is fish-shell syntax.
&lt;/p&gt;

&lt;p&gt;
I restarted the jupyter kernel and the warnings had gone away, so this much worked.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;div id="outline-container-orgc3bd71f" class="outline-3"&gt;
&lt;h3 id="orgc3bd71f"&gt;Really Turning Off the Warning&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgc3bd71f"&gt;
&lt;p&gt;
Setting the environment variable at the command-line changes the environment for my user, but I'm running &lt;a href="https://www.emacswiki.org/emacs/EmacsAsDaemon"&gt;emacs as a daemon&lt;/a&gt; so I needed to edit the &lt;code&gt;systemctl&lt;/code&gt; file for my emacs service. I opened up the &lt;code&gt;~/.config/systemd/user/emacs.service&lt;/code&gt; file in emacs and added the line to set the environment variable for the emacs daemon.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;Environment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"PYDEVD_DISABLE_FILE_VALIDATION=1"&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then I restarted the service.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;restart&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;emacs
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Which gave me a warning that my changes to the configuration have to be re-loaded before restarting the service.
&lt;/p&gt;

&lt;pre class="example" id="org08299bb"&gt;
Warning: The unit file, source configuration file or drop-ins of emacs.service changed on disk
. Run 'systemctl --user daemon-reload' to reload units.
&lt;/pre&gt;

&lt;p&gt;
Oops.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;daemon-reload
systemctl&lt;span class="w"&gt; &lt;/span&gt;restart&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;emacs
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This time the emacs startup messages didn't have the jupyter errors so it looked like things were fixed.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org5bf600e" class="outline-2"&gt;
&lt;h2 id="org5bf600e"&gt;Swapping a Virtual Environment For pipx&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org5bf600e"&gt;
&lt;p&gt;
Suppressing the warnings &lt;i&gt;pretty much&lt;/i&gt; solved the problem, but while I was getting this fixed I was also trying to set up a USB Windows installer using &lt;a href="https://github.com/WoeUSB/WoeUSB"&gt;WoeUSB&lt;/a&gt; and found that pipx couldn't install it because of a dependency error. Pipx is good at installing some standalone python commands but it won't install things that are just libraries and it seems to sometimes also have problems installing dependencies for the commands that it &lt;i&gt;will&lt;/i&gt; install. This has come up for me before, and the old solution was just for me to install the dependencies separately  using &lt;code&gt;pip&lt;/code&gt; before trying to install whatever it was that I was installing with pipx. Now, though, since ubuntu is trying to keep you from installing python modules globally, installing the dependencies means they either have to be available through &lt;code&gt;apt&lt;/code&gt; or you have to set up a virtual environment and install them there (when I say &lt;i&gt;have to&lt;/i&gt; I mean that since that's the way I know how to do it, that's the way I have to do it, not that there aren't other ways to do it that I just don't know about).
&lt;/p&gt;

&lt;p&gt;
Doing it this way is easy enough, since I use python virtual environments a lot anyway, but then I ran into another problem which was that once I got the virtual environment set up I found out I had to run woeUSB as root, which then bypasses the whole virtual environment setup. The solution to that was to pass the full path to the virtual environment's woeUSB launcher to &lt;code&gt;sudo&lt;/code&gt;, but it took enough time experimenting with other ways to do it before I got to that step that I decided I should minimalize how much I use pipx as much as possible - and in particular I should avoid using it with my emacs setup, since emacs will sometimss just quietly fail if there's a python-based error and it's only when things don't work that I'll realize there's a problem. So I decided to go with a dedicated virtual environment instead of installing jupyter with pipx.
&lt;/p&gt;

&lt;p&gt;
This, once again was not a big deal in hindsight, but it took enough experimenting with other options before coming to the conclusion that this was the way to go that I thought I should make a note to my future self about it. To get jupyter working with jupyter-emacs:
&lt;/p&gt;

&lt;ul class="org-ul"&gt;
&lt;li&gt;create a virtual environment (&lt;code&gt;python3 -m venv emacs-environment&lt;/code&gt;) in the &lt;code&gt;.virtualenvs&lt;/code&gt; folder&lt;/li&gt;
&lt;li&gt;activate it, then use pip to install &lt;code&gt;wheels&lt;/code&gt; and &lt;code&gt;jupyter&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
In the &lt;code&gt;/.emacs.d/init.el&lt;/code&gt; file, activate the virtual environment &lt;i&gt;before&lt;/i&gt; you load emacs-jupyter or anything else that needs python:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;'pyvenv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;pyvenv-activate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;"~/.virtualenvs/emacs-environment"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then restart emacs. So far this seems to have fixed it.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org27b8e2a" class="outline-2"&gt;
&lt;h2 id="org27b8e2a"&gt;Other Links&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org27b8e2a"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;EmacsWiki: Emacs As Daemon [Internet]. [cited 2023 May 28]. Available from: &lt;a href="https://www.emacswiki.org/emacs/EmacsAsDaemon#h5o-2"&gt;https://www.emacswiki.org/emacs/EmacsAsDaemon#h5o-2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Schäfer J. pyvenv.el, Python virtual environment support for Emacs [Internet]. 2023 [cited 2023 May 28]. Available from: &lt;a href="https://github.com/jorgenschaefer/pyvenv"&gt;https://github.com/jorgenschaefer/pyvenv&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>emacs</category><category>jupyter</category><category>python</category><category>troubleshooting</category><category>ubuntu</category><guid>https://necromuralist.github.io/posts/python-311-and-emacs-jupyter-symbols-variable-is-void-error/</guid><pubDate>Thu, 25 May 2023 23:12:27 GMT</pubDate></item><item><title>Kernel Panic At the Lunar Lobster</title><link>https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/#orgcada2e4"&gt;What Is This About?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/#org837a1de"&gt;First Get It Working&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/#org07f2575"&gt;Not a Solution But A Finger Pointing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/#org3fe35bb"&gt;Blame It On the Drivers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/#org42d9bab"&gt;From Nouveau To Nvidia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/#orgb63145e"&gt;And the End&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgcada2e4" class="outline-2"&gt;
&lt;h2 id="orgcada2e4"&gt;What Is This About?&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgcada2e4"&gt;
&lt;p&gt;
I got a notification yesterday (May 3, 2023) that there's a new version of Ubuntu out (&lt;i&gt;Lunar Lobster - 23.04&lt;/i&gt;) so I ran &lt;code&gt;do-release-upgrade&lt;/code&gt; while watching a video (&lt;a href="https://en.wikipedia.org/wiki/An_Honest_Liar?useskin=vector"&gt;An Honest Liar&lt;/a&gt;) about James Randi. At the end of the upgrade there was some kind of error message about not being able to configure the Linux headers, which in retrospect should have worried me, but I was distracted so I just dismissed it. Then today when I booted up the computer I got an error message saying &lt;code&gt;Kernel Panic - Not syncing: VFS: Unable to mount root fs on unknown-block (0,0)&lt;/code&gt;. I managed to get it working (eventually) but now that Ubuntu's been around long enough and search engines seem to be choked with outdated answers I thought I'd document what I did in case it happens on another update.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org837a1de" class="outline-2"&gt;
&lt;h2 id="org837a1de"&gt;First Get It Working&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org837a1de"&gt;
&lt;p&gt;
The first thing I tried was to follow the answers on &lt;a href="https://askubuntu.com/questions/41930/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block0-0"&gt;this Stackoverflow page&lt;/a&gt;. The only thing this did was get my computer up and running again - which is, I suppose a big thing, not to be minimized, but there's a lot of stuff on that page and the only relevant parts were:
&lt;/p&gt;

&lt;ol class="org-ol"&gt;
&lt;li&gt;Reboot&lt;/li&gt;
&lt;li&gt;At the menu that comes up choose "Advanced Options for Ubuntu"&lt;/li&gt;
&lt;li&gt;Pick a prior version of the Linux kernel (5.19.26 in my case) and let it finish starting up.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org07f2575" class="outline-2"&gt;
&lt;h2 id="org07f2575"&gt;Not a Solution But A Finger Pointing&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org07f2575"&gt;
&lt;p&gt;
The first thing I tried from that page was from &lt;a href="https://askubuntu.com/a/939883"&gt;this answer&lt;/a&gt;:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo dpkg --configure -a
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This gave me &lt;code&gt;error processing package linux-image-6.2.0-generic (--configure)&lt;/code&gt;. So I searched some more and tried the suggestion from &lt;a href="https://askubuntu.com/a/517882"&gt;this askubuntu answer&lt;/a&gt;:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo dpkg --purge linux-image-6.2.0-20-generic
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This gives an error along the lines of "&lt;code&gt;dependency problems, not purging&lt;/code&gt;". Oi. So then I tried:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo apt autoremove
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
This gave me another error:
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/purge-error.webp" alt="Purge Error" loading="lazy"&gt;
&lt;/p&gt;

&lt;p&gt;
This time in the error message it said to check out &lt;code&gt;/var/lib/dkms/nvidia/510.108.03/build/make.log&lt;/code&gt; which turned out not to have any useful information (to me, anyway) but it did tell me that there was something going on with my nvidia drivers that was causing the configuration of the new Linux kernel to fail.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org3fe35bb" class="outline-2"&gt;
&lt;h2 id="org3fe35bb"&gt;Blame It On the Drivers&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org3fe35bb"&gt;
&lt;p&gt;
&lt;i&gt;"Something going on with my nvidia drivers"&lt;/i&gt; being a little too vague for me to troubleshoot, I decided to go the brute force way and uninstall the nvidia-drivers. This actually proved a little harder than I thought it would be (which seems to always be the case, maybe I'm too optimistic about this kind of stuff). Every time I tried to run
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo apt remove nvidia-driver-510
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
&lt;code&gt;apt&lt;/code&gt; would try and configure the Linux kernel and run into the same error that I had before and exit without uninstalling the driver. Some kind of chicken and the egg thing. So then I tried &lt;code&gt;dpkg&lt;/code&gt; instead of &lt;code&gt;apt&lt;/code&gt; first:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo dpkg --purge nvidia-driver-510
sudo apt autoremove
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
&lt;code&gt;dpkg&lt;/code&gt; managed to uninstall the driver and running &lt;code&gt;apt autoremove&lt;/code&gt; not only cleaned out the unused packages but also triggered the kernel configuration and this time… no errors.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org42d9bab" class="outline-2"&gt;
&lt;h2 id="org42d9bab"&gt;From Nouveau To Nvidia&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org42d9bab"&gt;
&lt;p&gt;
After a reboot it started up okay and this time &lt;code&gt;uname -r&lt;/code&gt; showed that I was using the newer kernel (&lt;code&gt;6.2.0-20-generic&lt;/code&gt;). Yay. But now when I tried to re-install the nvidia drivers neither &lt;code&gt;ubuntu-drivers&lt;/code&gt; nor &lt;code&gt;apt&lt;/code&gt; seemed to know that they existed. It turns out that updating the ubuntu installation removes the proprietary drivers from the apt sources. So I launched the "Software &amp;amp; Updates" GUI.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/software-updates.webp" alt="Software &amp;amp; Updates" loading="lazy"&gt;
&lt;/p&gt;

&lt;p&gt;
And checked the "Proprietary drivers for devices (restricted)" button.
&lt;/p&gt;

&lt;p&gt;
&lt;img src="https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/proprietary-drivers.webp" alt="Proprietary Drivers" loading="lazy"&gt;
&lt;/p&gt;

&lt;p&gt;
I chose to update the apt listing when I closed the GUI and then installed the drivers at the command line:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo ubuntu-drivers install
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And then, after another reboot, now it works (I checked with &lt;code&gt;nvidia-smi&lt;/code&gt;).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgb63145e" class="outline-2"&gt;
&lt;h2 id="orgb63145e"&gt;And the End&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgb63145e"&gt;
&lt;p&gt;
I haven't run any tests other than using the system but this seems to have fixed the problem. Well, the problem with the kernel, updating also broke all my python virtual environments, but, oh, well, better than a kernel panic, I suppose.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>nvidia</category><category>ubuntu</category><guid>https://necromuralist.github.io/posts/kernel-panic-at-the-lunar-lobster/</guid><pubDate>Wed, 03 May 2023 23:20:07 GMT</pubDate></item><item><title>Converting A Date To Day of the Year In Python</title><link>https://necromuralist.github.io/posts/converting-a-date-to-day-of-the-year-in-python/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/converting-a-date-to-day-of-the-year-in-python/#orge6e8f8c"&gt;Date To Day of Year&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/converting-a-date-to-day-of-the-year-in-python/#orgfdc4e87"&gt;Day Of Year To Date&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/converting-a-date-to-day-of-the-year-in-python/#org3d555c2"&gt;Source&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
This is a quick note on how to take a date and convert it to the day of the year (and back again) using python.
&lt;/p&gt;

&lt;div id="outline-container-orge6e8f8c" class="outline-2"&gt;
&lt;h2 id="orge6e8f8c"&gt;Date To Day of Year&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orge6e8f8c"&gt;
&lt;p&gt;
We're going to use python's built-in &lt;a href="https://docs.python.org/3/library/datetime.html#datetime-objects"&gt;datetime&lt;/a&gt; object to create the date then convert it to a timetuple using its &lt;a href="https://docs.python.org/3/library/datetime.html#datetime-objects"&gt;timetuple&lt;/a&gt; method. The timetuple has an attribute &lt;code&gt;tm_yday&lt;/code&gt; which is the number of days in the year that the date represents.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="n"&gt;YEAR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MONTH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DAY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2023&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;

&lt;span class="n"&gt;DAY_OF_YEAR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;YEAR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MONTH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DAY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timetuple&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tm_yday&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DAY_OF_YEAR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;pre class="example"&gt;
38
&lt;/pre&gt;


&lt;p&gt;
So, February 7, 2023 is the 38th day of the year.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgfdc4e87" class="outline-2"&gt;
&lt;h2 id="orgfdc4e87"&gt;Day Of Year To Date&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgfdc4e87"&gt;
&lt;p&gt;
Now to go in the other direction we start with the first day of the year (represented as a datetime object) and add the number of days into the year we want. You can't create a datetime object with day zero so we need to start it on day one and then subtract one day from the number of days that we want.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;

&lt;span class="n"&gt;JANUARY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;YEAR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;JANUARY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DAY_OF_YEAR&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"%Y-%m-&lt;/span&gt;&lt;span class="si"&gt;%d&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;pre class="example"&gt;
2023-02-07
&lt;/pre&gt;


&lt;p&gt;
Easy-peasey.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org3d555c2" class="outline-2"&gt;
&lt;h2 id="org3d555c2"&gt;Source&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org3d555c2"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/a/623312"&gt;Answer on StackOverflow&lt;/a&gt; that shows how to get the day of the year from the date.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/a/13032755"&gt;Answer to the same question&lt;/a&gt; that shows how to go from the day of the year back to the date.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>calendar</category><category>python</category><guid>https://necromuralist.github.io/posts/converting-a-date-to-day-of-the-year-in-python/</guid><pubDate>Wed, 08 Feb 2023 00:56:59 GMT</pubDate></item><item><title>PyTorch and the Unknown CUDA Error</title><link>https://necromuralist.github.io/posts/pytorch-and-the-unknown-cuda-error/</link><dc:creator>Cloistered Monkey</dc:creator><description>&lt;div id="table-of-contents" role="doc-toc"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents" role="doc-toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/pytorch-and-the-unknown-cuda-error/#orgb1f470a"&gt;The Problem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/pytorch-and-the-unknown-cuda-error/#org5897120"&gt;The Symptom&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://necromuralist.github.io/posts/pytorch-and-the-unknown-cuda-error/#org8a2ae02"&gt;The Disease and Its Cure&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgb1f470a" class="outline-2"&gt;
&lt;h2 id="orgb1f470a"&gt;The Problem&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgb1f470a"&gt;
&lt;p&gt;
I recently decided to get back into using neural networks again and tried to update my docker container to get &lt;a href="https://www.fast.ai/"&gt;fastai&lt;/a&gt; up and running, but couldn't get CUDA working. After a while spent trying different configurations of CUDA, pytorch, pip, conda, and on and on I eventually found out that there's some kind of problem with using CUDA after suspending and then resuming your system (at least with linux/Ubuntu). This is a documentation of that particular problem and it's fixes (fastest but not necessarily the best answer: always shutdown or reboot the machine, don't suspend and resume).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;div id="outline-container-org5897120" class="outline-2"&gt;
&lt;h2 id="org5897120"&gt;The Symptom&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org5897120"&gt;
&lt;p&gt;
This is what happens if I try to use CUDA after waking the machine from a suspend.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;torch&lt;/span&gt;

&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_available&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;pre class="example"&gt;
/home/athena/.conda/envs/neurotic-fastai/lib/python3.9/site-packages/torch/cuda/__init__.py:88: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /opt/conda/conda-bld/pytorch_1666642975993/work/c10/cuda/CUDAFunctions.cpp:109.)
  return torch._C._cuda_getDeviceCount() &amp;gt; 0
&lt;/pre&gt;


&lt;p&gt;
As you can see, the error message doesn't really give any useful information about what's wrong - there &lt;i&gt;are&lt;/i&gt; a couple of suggestions but neither seems relevant or at least doesn't lead you to the fix.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org8a2ae02" class="outline-2"&gt;
&lt;h2 id="org8a2ae02"&gt;The Disease and Its Cure&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org8a2ae02"&gt;
&lt;p&gt;
There's a post on the &lt;a href="https://discuss.pytorch.org/t/userwarning-cuda-initialization-cuda-unknown-error-this-may-be-due-to-an-incorrectly-set-up-environment-e-g-changing-env-variable-cuda-visible-devices-after-program-start-setting-the-available-devices-to-be-zero/129335/2"&gt;pytorch discussion boards&lt;/a&gt; about this error in which "ptrblck" says that he runs into this problem if his machine is put into the suspend state. While mentioning this he also says that restarting his machine fixes the problem, but restarting it every time seems to defeat the purpose of using suspend (and I'd have to walk to a different room to log in and decrypt the drive after restarting the machine - ugh, so much work). 
&lt;/p&gt;

&lt;p&gt;
Luckily, in a &lt;a href="https://discuss.pytorch.org/t/userwarning-cuda-initialization-cuda-unknown-error-this-may-be-due-to-an-incorrectly-set-up-environment-e-g-changing-env-variable-cuda-visible-devices-after-program-start-setting-the-available-devices-to-be-zero/129335/5"&gt;later post&lt;/a&gt; in the thread the same user mentions that you can also fix it by reloading the &lt;code&gt;nvidia_uvm&lt;/code&gt; kernel module by entering these commands in the terminal:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Which seems to fix the problem for me right at the moment, without the need to restart the machine.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_available&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;pre class="example"&gt;
False
&lt;/pre&gt;


&lt;p&gt;
Ummm… oops. Well, it did sort of fix one problem - the &lt;code&gt;CUDA unknown error&lt;/code&gt;, but now it's saying that CUDA isn't available on this machine. Every fix begets a new problem. Let's try it again after restarting the Jupyter kernel.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;torch&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_available&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;pre class="example"&gt;
True
&lt;/pre&gt;


&lt;p&gt;
Okay, that's better, I guess. It feels a little inelegant to have to do this, but at least it seems to work.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>cuda</category><category>pytorch</category><category>troubleshooting</category><guid>https://necromuralist.github.io/posts/pytorch-and-the-unknown-cuda-error/</guid><pubDate>Tue, 01 Nov 2022 00:58:27 GMT</pubDate></item></channel></rss>