Showing posts with label pip. Show all posts
Showing posts with label pip. Show all posts

Sunday, January 1, 2017

Voting Districts Day 2: Wrong Python Packages?

I think that I'm going to switch up and use some different packages for reading this spatial data.  In order to use the SciPy stuff, I still need more packages and those packages require some unorthodox installation methods.  It includes a ton of stuff I'm not sure I need.  So, I'm going to do this one package at a time.  Well, two in this case.  

It looks like Shapely and Fiona can do what I want initially, which is to read shapefiles and plot them.  

When I try to use pip for the install ("pip install Fiona"), it doesn't work.  It says I need Microsoft Visual C++.  

So, after searching the internet, I discovered that I have to install the packages via a wheel.  A plethora of these wheels can be found here at this University of California - Irvine website here.  

You also use pip to install these wheels; you just have to download them into the same folder first.  Also, I have to run the command prompt as an administrator via a right click when starting the application.  

Shapely seemed to work like a charm when attempting the old "import shapely" line in Python.  Fiona had other ideas.

Looking at Fiona's documentation, she requires a GDAL package, which was also available on the same UC Irvine page that had the other wheels.  I installed that one and was finally able to run "import Fiona" successfully.  

So, next time, we'll see about reading the shapefiles.


Monday, December 19, 2016

New Python Project: Is there a way to build nonpartisan voting districts?

Gerrymandering  seems to make the news every couple of years and every couple of years I wander if there's a solution to the problem.  It seems that somebody should have figured out how to make fair and equitable congressional districts by now, right?  

I'm a little curious if something like that is possible using some geospatial analysis.  What are the roadblocks and what's stopping somebody from pulling this off?  Who knows?  It's an excuse to learn more about Python and its application to mapping and such.

How much experience do I have with Python and geospatial analysis?  none!  Well, I've done a little, but with esri's arcpy Python module.  This should be WAY harder, but a fun challenge. 

Poking around the internet, it looks like Python needs some packages to do what I want (or at least get me started).  A place called SciPy can hook me up.  

They allow installing via pip, which I've done a couple of times in the past.  They even tell me exactly what to type.  So, to Command Prompt we go and we'll do the install.


Easy peasy.  Next time, we'll see what we've installed and how it can help us.