pysal / segregation

Segregation Measurement, Inferential Statistics, and Decomposition Analysis
https://pysal.org/segregation/
BSD 3-Clause "New" or "Revised" License
111 stars 26 forks source link

Import fails on a fresh 3.9 install #190

Closed darribas closed 2 years ago

darribas commented 2 years ago

This is how to reproduce it. Set up:

conda create -n pysal_test segregation
conda activate pysal_test

And the error is triggered by:

(pysal_test) jovyan@8148d5a1ee66:~$ ipython -c 'import segregation'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-de5053376334> in <module>
----> 1 import segregation

/opt/conda/lib/python3.9/site-packages/segregation/__init__.py in <module>
      5 
      6 """
----> 7 from . import batch, decomposition, dynamics, inference, local, multigroup, singlegroup, util
      8 
      9 

/opt/conda/lib/python3.9/site-packages/segregation/batch/__init__.py in <module>
----> 1 from .batch_compute import *

/opt/conda/lib/python3.9/site-packages/segregation/batch/batch_compute.py in <module>
      7 from tqdm.auto import tqdm
      8 
----> 9 from .. import multigroup, singlegroup
     10 from .._base import SpatialImplicitIndex
     11 from ..dynamics import compute_multiscalar_profile

/opt/conda/lib/python3.9/site-packages/segregation/singlegroup/__init__.py in <module>
      8 from .correlationr import CorrelationR
      9 from .delta import Delta
---> 10 from .density_corrected_dissim import DensityCorrectedDissim
     11 from .dissim import Dissim
     12 from .dx_interaction import DistanceDecayInteraction

/opt/conda/lib/python3.9/site-packages/segregation/singlegroup/density_corrected_dissim.py in <module>
      6 import numpy as np
      7 import pandas as pd
----> 8 from rvlib import Normal
      9 from scipy.optimize import minimize
     10 

/opt/conda/lib/python3.9/site-packages/rvlib/__init__.py in <module>
     12 __version__ = version
     13 
---> 14 from .univariate import *
     15 from .specials import *
     16 from ._rmath_ffi import *

/opt/conda/lib/python3.9/site-packages/rvlib/univariate.py in <module>
     27 fn = join(dirname(abspath(__file__)), "metadata.yaml")
     28 with open(fn, 'r') as ymlfile:
---> 29     mtdt = yaml.load(ymlfile)
     30 
     31 # --------------------------------------------------

TypeError: load() missing 1 required positional argument: 'Loader'
(pysal_test) jovyan@8148d5a1ee66:~$ 

This is a bit of an issue because the fail also trickles down to any import pysal.explore (strangely, it does not return an error with import pysal, shouldn't it?).

I think this related to a new version of the yaml package? It is a bit strange because it doesn't seem to have been picked up by the tests? Maybe I'm doing something wrong here?

darribas commented 2 years ago

Actually, update, the tests might not be passing now. This is the brief summary I get, and attached is the coverage file:

======================================================================================== warnings summary ========================================================================================
../../../opt/conda/lib/python3.9/site-packages/libpysal/cg/sphere.py:524
  /opt/conda/lib/python3.9/site-packages/libpysal/cg/sphere.py:524: DeprecationWarning: invalid escape sequence \m
    """Finds a point on a sphere along the great circle distance between

../../../opt/conda/lib/python3.9/site-packages/libpysal/cg/standalone.py:1260
  /opt/conda/lib/python3.9/site-packages/libpysal/cg/standalone.py:1260: DeprecationWarning: invalid escape sequence \m
    """Calculate a distance matrix.

-- Docs: https://docs.pytest.org/en/stable/warnings.html

----------- coverage: platform linux, python 3.9.7-final-0 -----------
Coverage XML written to file coverage.xml

==================================================================================== short test summary info =====================================================================================
ERROR segregation/tests/test_absolute_centralization.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_absolute_clustering.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_absolute_concentration.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_atkinson.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_batch_compute.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_bias_corrected_dissimilarity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_boundary_spatial_dissimilarity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_conprof.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_correlationr.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_decomposition.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_delta.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_density_corrected_dissimilarity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_dissim.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_distance_decay_interaction.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_distance_decay_isolation.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_entropy.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_gini_seg.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_inference.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_interaction.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_isolation.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_local_multi_local_diversity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_local_multi_local_entropy.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_local_multi_local_simpson_concentration.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_local_multi_local_simpson_interaction.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_local_multi_location_quotient.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_local_relative_centralization.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_min_max_s.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_modified_dissimilarity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_modified_gini.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_dissim.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_divergence.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_diversity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_gini_seg.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_information_theory.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_normalized_exposure.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_relative_diversity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_simpsons_concentration.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_simpsons_interaction.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multi_squared_coefficient_of_variation.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_multiscalar_profile.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_network.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_network_download.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_perimeter_area_ratio_spatial_dissimilarity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_relative_centralization.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_relative_clustering.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_relative_concentration.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_spatial_dissimilarity.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_spatial_prox_profile.py - TypeError: load() missing 1 required positional argument: 'Loader'
ERROR segregation/tests/test_spatial_proximity.py - TypeError: load() missing 1 required positional argument: 'Loader'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 49 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================ 2 warnings, 49 errors in 12.11s =================================================================================
(base) jovyan@2db6d3fa6bbf:~/segregation$

coverage.zip

knaaptime commented 2 years ago

resolved upstream