Joys of Installing Python For The Umpteenth Time
Tags: python, devjournal, troubleshooting, sisu
Published: 2022-04-29 11:44:58

---
title: Joys of Installing Python For The Umpteenth Time
published: true
description: Here we go again. 
tags: python, devjournal, troubleshooting, sisu
series: periksiantamaton
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i8rx5j34ya7to7jng57a.png
 
---

###Do you know what I love about C?

It's always there.

You can basically log in on any computer, open Vim, write couple lines of code, forget how pointer math works, `gcc *.c` and _badabim badaboom_ there's your segfault. No problem, easy as pie, Bob's your uncle etc.

###Then there's Python.

I've tried to learn Python several times during my decade long journey of hobbyist programmer. Had all the tutorials open, watched the YouTube videos, psyched myself: _this time it's going to happen._

Then I try to install it on my computer.

First time I attempted it was... maybe 2013, on Windows. I remember downloading some software package that was supposed to be plug'n'play type of deal - just install this and you have everything you need to start developing with Python.

I think I still have some registry settings and file associations remaining from that attempt that I can't seem to get rid of. I swear I have reinstalled Windows at least twice since then.

This kept repeating every couple of years. We don't need to go too much into detail - I decide to learn Python, try to install it, get confused about virtual environments and eventually some combination of software issues and incompatible hardware wears my motivation down and I give up. Let the snake hibernate for a while.

###But today I did it. I finally installed Python.
 
It was for a project that needed to use Spotify's Web API. Since [`libspotify`](https://developer.spotify.com/community/news/2022/04/12/libspotify-sunset/) is being deprecated and the project needed to get done sooner rather than later, I had to choose between Python and JavaScript.

Needless to say, I suddenly had very strong incentive to learn Python. [`Spotipy`](https://spotipy.readthedocs.io/en/2.19.0/) seemed to do everything I wanted in one easy package.

![...why'd id it have to be snakes?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u36t01ba0blnd9z34xbq.png)
####It didn't go smoothly.

Although fair's fair: blame is mostly on myself. I tried to do too many things at the same time - Pop_OS update had just gone disastrously wrong, forcing me to reinstall from recovery and also instead of working with Vim like I usually do I decided that this would be a perfect time to start learning VSCode.

Of course, I didn't use Visual Studio Code because I permanently wear a roll of tin foil around my head. I had Code OSS. It worked fine until I tried to do the [basic Hello World tutorial](https://code.visualstudio.com/docs/python/python-tutorial).

Pylance didn't work. It didn't recognize any of the standard libraries I tried to import. I guess I could have pushed forward without a language server, but what's the point of using a modern IDE if you don't have all the bells and whistles?

After trawling through [`pylance/issues`](https://github.com/microsoft/pylance-release/issues) & [`vscode/issues`](https://github.com/microsoft/vscode/issues) it seemed that 

1. Problem was common and had lots of unspecified causes
2. It would probably be easier to just bite the bullet and use the _Microsoft Approved Visual Studio Code_.

![More danger noodles.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zi7oybd6dvig1nezw67g.png)

So I installed it from the Pop!_Shop. I think there was some warning about it being an unofficial flatpak but I paid no mind, that's probably nothing to worry about. Pylance worked so everything was fine. I got Hello World running and hadn't even spent a full day troubleshooting at this point.

Then the problems with shell started. As in VSCode didn't recognize any of the shells that were installed (particularly `bash` or `zsh`) and defaulted on [`xterm`](https://en.wikipedia.org/wiki/Xterm), which was basically unusable without massive tinkering.

Maybe the default terminal could be set manually? Current documentation recommended using terminal profiles. It also mentioned that they should be prepopulated with shells already installed on the system.

####Naturally, there were no terminal profiles available.

I spent maybe an hour or two trying to create them by editing `settings.json` with no luck. Searched through StackOverflow, pasted miscellanous snippets and constantly reloaded to see if they had any effect. Nada.

Then I remembered that warning about unofficial flatpaks. I uninstalled this incarnation of VSCode and downloaded the .deb directly from Microsoft's website. And wouldn't you know it, fixed all the issues. Shell profiles were populated, all was well.

Of course, I still had to reload window each time I added a new package or imported a local file to wake up Pylance but that didn't seem to bad at this point. I even went as far as setting up [`virtualenvwrapper`](https://virtualenvwrapper.readthedocs.io/en/latest/) to handle all my venv-related needs. Found about [`Poetry`](https://python-poetry.org/) later but decided not to open a new _can of worms_ 🐍🐍🥫

###After a decade of trying, I finally have a working Python development setup.

It only took about 8 hours and years of miserable failures.

![sleepy snek](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5n76sar9ykx5lvwc7ulj.png)

...

... 

... Oh, almost forgot. I got the Spotify scraping script working in fifteen minutes with about 20 lines of code. I'd probably have spent couple of days reading through `man` pages of the C libraries I was planning to use.

There's probably a lesson here but [can't think of any](https://xkcd.com/353).