Was copy-editing the PySAL Notebooks (https://pysal.org/notebooks/intro) and encountered semi-regular import errors when trying to run the Notebooks via 'Interact' feature of Jupyter Book. For example, on the first esda notebook Spatial_Autocorrelation_for_Areal_Unit_Data), the first chunk enouncters an error when trying to import relevant modules:
import sys
import os
sys.path.append(os.path.abspath('..'))
from pysal.explore import esda
in
2 import os
3 sys.path.append(os.path.abspath('..'))
----> 4 from pysal.explore import esda
/opt/conda/lib/python3.7/site-packages/pysal/__init__.py in
1 __version__ = '2.2.1'
----> 2 from . import lib
3 from . import explore
4 from . import viz
5 from . import model
/opt/conda/lib/python3.7/site-packages/pysal/lib/__init__.py in
26 """
27
---> 28 from libpysal import cg
29 from libpysal import io
30 from libpysal import weights
ModuleNotFoundError: No module named 'libpysal'
A quick reinstall and alternative loading of esda & libpysal allows the notebook to be run without error once a few import lines are edited throughout the notebook:
# Add these commands to top of notebook
!pip install esda
import esda as esda
!pip install libpysal
import libpysal as lps
Remove:
from pysal.explore import esda #from second chunk
import pysal.lib as lps #from third chunk
from pysal.explore import esda #from ~20th chunk
from pysal.explore import esda #from ~35th chunk
Lastly, change:
from pysal.viz import mapclassify as mc to import mapclassify as mc
Is this issue due to a setting in Jupyter Book or Binder? Or simply some import commands that needed to be updated?
Hi all,
Was copy-editing the PySAL Notebooks (https://pysal.org/notebooks/intro) and encountered semi-regular import errors when trying to run the Notebooks via 'Interact' feature of Jupyter Book. For example, on the first
esda
notebook Spatial_Autocorrelation_for_Areal_Unit_Data), the first chunk enouncters an error when trying to import relevant modules:A quick reinstall and alternative loading of esda & libpysal allows the notebook to be run without error once a few import lines are edited throughout the notebook:
Remove:
Lastly, change:
from pysal.viz import mapclassify as mc
toimport mapclassify as mc
Is this issue due to a setting in Jupyter Book or Binder? Or simply some import commands that needed to be updated?