PyCharm Python

Issues with psycopg2 … again

In a previous post I had written about an issue I’d had with upgrading, installing, or just generally maintaining the python package psycopg2 (link).

I ran into that issue again today, and thought to myself, “Hey, I’ve had this problem before AND wrote something up about it. Let me go see what I did last time.”

I searched my site for psycopg2 and tried the solution, but I got the same forking error.

OK … let’s turn to the experts on the internet.

After a while I came across this article on StackOverflow but this specific answer helped get me up and running.

A side effect of all of this is that I upgraded from Python 3.7.5 to Python 3.8.1. I also updated all of my brew packages, and basically did a lot of cleaning up that I had neglected.

Not how I expected to spend my morning, but productive nonetheless.


Installing the osmnx package for Python

I read about a cool gis package for Python and decided I wanted to play around with it. This post isn’t about any of the things I’ve learned about the package, it’s so I can remember how I installed it so I can do it again if I need to. The package is described by it’s author in his post

To install osmnx I needed to do the following:

  1. Install Home Brew if it’s not already installed by running this command (as an administrator) in the terminal:

    /usr/bin/ruby -e "$(curl -fsSL"

  2. Use Home Brew to install the spatialindex dependency. From the terminal (again as an administrator):

    brew install spatialindex

  3. In python run pip to install rtree:

    pip install rtree

  4. In python run pip to install osmnx

    pip install osmnx

I did this on my 2014 iMac but didn’t document the process. This lead to a problem when I tried to run some code on my 2012 MacBook Pro.

Step 3 may not be required, but I’m not sure and I don’t want to not have it written down and then wonder why I can’t get osmnx to install in 3 years when I try again!

Remember, you’re not going to remember what you did, so you need to write it down!