pysal/spopt

unexpected keyword argument 'facility_capacities' in the p-median notebook

Closed this issue · 2 comments

qszhao commented

Hi all,

I ran through the P-median notebook. The first part works fine but the capacitated part gives me errors as below:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[35], line 1
----> 1 pmedian_capacity_from_cm = PMedian.from_cost_matrix(
      2     cost_matrix,
      3     ai,
      4     p_facilities = 8,
      5     facility_capacities=cj,
      6     name="capacitated-p-median-network-distance"
      7 )

TypeError: PMedian.from_cost_matrix() got an unexpected keyword argument 'facility_capacities'

I use a new conda environment with python=3.11, spopt=0.5.0, pulp=2.7.0 and the installations are via

conda create --name spatialopt python=3.11
conda install -c conda-forge spopt
conda install -c conda-forge pulp

Best,
Qunshan

@qszhao I just realized you say you are installing spopt via conda-forge. While we have merged the new functionality into spopt@main (#397, #399), we have not yet cut a release. We want to resolve #386 before another release and it is being especially troublesome to figure out. In the meantime you can install by:

pip install git+https://github.com/pysal/spopt.git
qszhao commented

Thanks @jGaboardi. This is very good to know.