pysal / spopt

Spatial Optimization
https://pysal.org/spopt/
BSD 3-Clause "New" or "Revised" License
305 stars 46 forks source link

Installing for Google Collab #69

Closed schandler88 closed 3 years ago

schandler88 commented 3 years ago

Hi! I'm using google's Colab but struggling to install spopt, specifically looking to use MaxPHeuristic.

Any ideas why I'm unable to install spopt in Colab?

jGaboardi commented 3 years ago

I have never used Colab, so I won't be any help there, but what error message are you getting? Also please include your system information. And Python version, package versions (scipy, numpy, geopandas, etc.).

schandler88 commented 3 years ago

As of April 2020, Colab uses Python 3.6.9 - Geopandas: 0.8.1 - Numpy: 1.18.5 The cool thing about colab is it doesn't run locally, so it should run with the latest and greatest seeing how you need to re-install some libraries for each notebook.

when I run !pip install spopt I receive the following error:

ERROR: Could not find a version that satisfies the requirement spopt (from versions: none) ERROR: No matching distribution found for spopt

or from pysal import spopt I get:

ImportError Traceback (most recent call last)

in () ----> 1 from pysal import spopt ImportError: cannot import name 'spopt' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below.

Screen Shot 2020-11-12 at 12 11 50 PM

I was able to install pysal's region by !pip install git+https://github.com/pysal/region.git#egg=region but not sure what to do from here to get MaxPHeuristic

Thank you for responding so quickly!

knaaptime commented 3 years ago

we havent realeased spopt on pypi yet, so you'll need to install from source

jGaboardi commented 3 years ago

I was able to install pysal's region by !pip install git+https://github.com/pysal/region.git#egg=region but not sure what to do from here to get MaxPHeuristic

Looks like you installed region, not spopt.

knaaptime commented 3 years ago

if you're after max-p, you might want to check out geosnap's cluster_spatial method which wraps the clusterers from region

jGaboardi commented 3 years ago

@schandler88 spopt is now up on PyPI and will soon be available via conda-forge. I'll go ahead and close for now, but feel free to reopen if you run into trouble again.