Press "Enter" to skip to content

[twenty twenty-four day twenty-four]: in foggiest depths

centaur 0

One of the problems with computing is when it just gets … foggy. Not when you’re trying to do something hard, or when two pieces of software are incompatible, no. When things just sort of kind of don’t work, and there are no known reasons that it’s happening, and no reliable actions you can take to fix it.

Once this happened to me when I was working on a robotics device driver, and I realized the lidar itself was unreliable, so the only way to fix problems was to run each configuration ten times and keep average stats. Broken “worked” around ten percent of the time, whereas “fixed” worked around seventy percent of the time (approaching the rate at which the manufacturer’s own software could connect to its own hardware).

Today, I ran into a seemingly simple problem with Anaconda, a Python package / environment management system. Conda lets you corral Python and other software into “environments” with different configurations so that potentially incompatible versions can be used on the same computer (albeit, not at the same time). It even gives you a handy indication about which environment is in use in your command prompt, like so:

There’s a seemingly innocent blank line between (ThatEnvironment) and the previous line, yes? Not part of the standard Conda setup, but you can easily add it with a single line of configuration, changing the “env_prompt” to include an extra newline “\n” before printing the environment, like so:

Yeah, that line at the end. “env_prompt: \n({default_env})”. In a conda configuration – a .condarc, or “dot condarc” file – which is almost as simple as possible. I don’t even think the “channels” bit is needed – I didn’t recall writing it, I think it just got added automatically by Conda. So this is almost the simplest possible change that you could make to your Conda configuration, done in almost the simplest possible way.

Except. It. Didn’t. Take.

No matter what changes I made to the .condarc file, they didn’t affect my Conda configuration. Why? I don’t know. No matter what I did, nothing happened. I changed the prompt to all sorts of weird things to try to see if maybe my syntax was wrong, no dice. No amount of searching through manuals or documentation or Stack Overflow helped. I re-ran conda config, re-loaded my shell, rebooted my Ubuntu instance – nothing.

Finally, almost in desperation, I went back to my original version, and tried creating system-wide, then environment-specific configurations – and then the changes to the prompt started working. Thank goodness, I thought, and rebooted one more time, convinced I had solved the problem.

Except. It. Took. The. Wrong. Config.

Remember how I said I created a weird version just to see that it was working? Conda started reverting to that file and using it, even though it was several versions ago. It actively started overwriting my changes – and ignoring the changes in the environment-specific configurations.

So, I blew away all the versions of the file – local, system and environment-specific – and re-created it, in its original location, and then it started to work right. In the end, what was the final solution?

I have no idea.

When I started working on the problem, I wanted Conda to do a thing – print an extra blank line so I could more easily see a command and its result, separate from the next command and result. And so I created a file in the recommended place with a line containing the recommended magic words … and it didn’t work. Then I hacked on it for a while, it sort of started working, and I backed out my changes, creating a file in the same recommended place with a line containing the same recommended magic words … and it did work.

Why? Who knows! Will it keep working? Who knows! If it breaks again, how do I fix it? Who knows!

This is what I call “the fog”. And it’s the worst place to be when working on computers.

-the Centaur

Pictured: Sure was foggy today.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.