spopt icon indicating copy to clipboard operation
spopt copied to clipboard

P-Median Problem Tutorial Binder example

Open nickbearman opened this issue 2 years ago • 4 comments

Thanks for the really useful P-Median Problem Tutorial - https://pysal.org/spopt/notebooks/p-median.html.

The binder version looks really useful - and I can open the link fine. https://mybinder.org/v2/gh/pysal/spopt/main?filepath=notebooks/p-median.ipynb

However when I run the first code block:

from spopt.locate import PMedian
from spopt.locate.util import simulated_geo_points

import numpy
import geopandas
import pulp
import spaghetti
from shapely.geometry import Point
import matplotlib.pyplot as plt

I get this error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 from spopt.locate import PMedian
      2 from spopt.locate.util import simulated_geo_points
      4 import numpy

ModuleNotFoundError: No module named 'spopt'

So it can't find the spopt.locate / spopt.locate.util libraries - any pointers please?

This may be related to https://github.com/pysal/spopt/issues/113

Many thanks, Nick.

nickbearman avatar Sep 21 '22 09:09 nickbearman

Looks like we never add spopt into environment.yml...

jGaboardi avatar Sep 21 '22 13:09 jGaboardi

Though the binders did work before, so I am bit confused by this.

jGaboardi avatar Sep 21 '22 13:09 jGaboardi

Also to do:

  • remove descartes
  • bump Python version to 3.10
  • follow spaghetti's example and install spopt's main branch

jGaboardi avatar Sep 21 '22 13:09 jGaboardi

@jGaboardi I noticed some notebooks (AZP and Skater) have sys.path.append(../) and that make the code work properly. If we change something in the future we should change these code blocks.

gegen07 avatar Sep 21 '22 15:09 gegen07

Just tried this again and didn't get anywhere:

2023-01-30T10:03:55.399962Z [Warning] 0/3 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 2 Insufficient memory.

Has anyone else tried it? I will give it a few days and try again.

nickbearman avatar Jan 30 '23 10:01 nickbearman

@nickbearman Just now I was able to open the binder and run the P-Median notebook, both from the link in the README and the link in the tutorial page. I wonder why you are having trouble with this...

jGaboardi avatar Jan 30 '23 14:01 jGaboardi

Thanks @jGaboardi - I've just tried it again, and it works now. However it took a long time to be ready. Like, a significant number of whole minutes. I think possibly 10 min, maybe even 15 (I tried it after your comment and it has only just finished loading). Thanks for checking :-)

nickbearman avatar Jan 30 '23 14:01 nickbearman

Just to note @jGaboardi it took 11 min to load the binder.

I've also been through the notebook myself and can confirm it all works! Thanks :-)

nickbearman avatar Feb 10 '23 09:02 nickbearman