This is mainly a note-to-self to remind me for my next upgrade – but hope it helps you too. TL;DR – install python-dev tools, export old installs into a requirements file, import into new python site-packages.
I upgraded the python on my laptop from 3.6 to 3.7 so I could use dataclasses for a little project. Then I got on a plane to Zurich and planned to get some work done on the 9 hour flight. Unfortunately I spent most of that time wrangling my python install – little cli tools I like to use like black, glances, sphinx, cookiecutter, etc – none of them worked!
When you do a python pip install of a library, it puts the library in a directory called site-packages under lib/python3.<your-version>/site-packages/<your-package-name>. If the library has defined command line entry-points, you will find it has also installed a file under bin/<your-package-name>. If bin is in your PATH, it means you can just type something like cookiecutter and it will call a function in the library to do stuff for you! Here’s what one of those files looks like:
➜ ~ bat ~/.local/bin/cookiecutter ───────┬─────────────────────────────────────────────────────────────────────────────────────────────── │ File: /home/matt/.local/bin/cookiecutter ───────┼─────────────────────────────────────────────────────────────────────────────────────────────── 1 │ #!/usr/bin/python3 2 │ 3 │ # -*- coding: utf-8 -*- 4 │ import re 5 │ import sys 6 │ 7 │ from cookiecutter.__main__ import main 8 │ 9 │ if __name__ == "__main__": 10 │ sys.argv = re.sub(r"(-script\.pyw?|\.exe)?$", "", sys.argv) 11 │ sys.exit(main()) ───────┴─────────────────────────────────────────────────────────────────────────────────────────────── ➜ ~
It tells the shell to execute it using /usr/bin/python3 – that’s a link to the latest version of python3 – in this case it’s now python3.7, while the library was installed under python3.6. So the command line now fails! Python3.7 doesn’t know about libs installed for 3.6 at all.
On the flight I realized I could either copy from the python3.6 site-lib to the python3.7 one or just switch python3 to point back to python3.6 to make things work. But once you have internet access, here’s the magic to get it all working.
First, install the python3.7 dev stuff so you can compile anything that needs compilation.
➜ ~ sudo apt-get install python3.7-dev
Then let’s export everything we used to use under 3.6 and then reinstall it under 3.7.
➜ ~ python3.6 -m pip freeze > old_requirements.txt ➜ ~ python3.7 -m pip install --user -r old_requirements.txt
Just finished Sam Miller’s beautiful book in the wee dark hours and it is a GEM. Qaanaaq is a place – I can see it and feel it’s culture, smell the noodles and the brine, feel the bitter cold. It’s like a long Geoff Manaugh article come to life. The nano-bonded orca-amazon that opens the book is one of the least weird things in it.
This book is start to finish what Robin Sloan calls gold coins, fascinating little surprises. Beyond the end actually – in the acknowledgments I discovered Bradley Silver’s modern tattoo work at white rabbit studio.
I enjoyed this as much as The Fifth Season, which is to say: immensely. Ended up checking it out twice from the NYPL on my Kobo just to savor through it.
Really enjoyed this episode of 99 percent invisible called “The Help Yourself City”. It challenges a lot of my ideas about anarchic self-help and how it might not be democratic after all.￼
Just found out my buddy Krishnan Ganesan from Niraval is a backing singer in this video from a movie. It’s funny (La x 15)!
Did a little welding class last night. I got to practice Oxy-Acetylene welding one on one because no one else wanted to weld on a hot summer night in the Brooklyn Navy Yard.
Since it was just me I got to do more with the instructor and we did both brazing and actual steel welding. Tons of fun. My final project was a little Z-Z tea light holder!
I did my second obstacle race last weekend and it was glorious. This time, instead of just being alone, I had a crew. I saw them at the beginning and the end, but it was good to have a posse! I got all the obstacles except three that I gave up (too early) on.
Mike, the guy in the sling, had his arm broken by someone’s knee in the race and KEPT RUNNING!
This is mostly an excuse to share some cool pictures.
I did great on time but next race I’m going for strict completion of everything. I should be able to do it!
Celebrated a big birthday with Swale and it was generally a good time – minus some tears when the birthday boy insisted on spraying people with his water gun and got sprayed back.
The owner of Cafe Hudson pointed me to an interesting post where the OpenStreetMap community has been around long enough that the movement of tectonic plates is a problem for keeping the maps accurate over time.
We all come from an explosion in the sky
One day there was nothing and the next there was life