Error trying to run the FeatureDependence.ipynb #8
Unanswered
Best-BViriyaroj
asked this question in
Python
Replies: 1 comment 2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
I tried to import the packages, and there's an error
I was expecting that the installation would go through
##What did I do
I ran the code given in class
Code:
%%capture
!pip install geopandas
!pip install libpysal
import numpy as np
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
from statsmodels.stats.outliers_influence import variance_inflation_factor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import RepeatedKFold
from sklearn.linear_model import Ridge
from sklearn.linear_model import Lasso
from sklearn.linear_model import ElasticNet
from numpy import mean
from numpy import std
from numpy import absolute
from libpysal.weights.contiguity import Queen
import libpysal
from statsmodels.api import OLS
sns.set_style('white')
Error message:
ImportError Traceback (most recent call last)
Cell In[5], line 6
4 import matplotlib.pyplot as plt
5 import seaborn as sns
----> 6 import statsmodels.api as sm
7 from statsmodels.stats.outliers_influence import variance_inflation_factor
8 from sklearn.model_selection import cross_val_score
File ~/.local/lib/python3.11/site-packages/statsmodels/api.py:76
1 all = [
2 "BayesGaussMI",
3 "BinomialBayesMixedGLM",
(...)
72 "version_info"
73 ]
---> 76 from . import datasets, distributions, iolib, regression, robust, tools
77 from .init import test
78 from statsmodels._version import (
79 version as version, version_tuple as version_info
80 )
File ~/.local/lib/python3.11/site-packages/statsmodels/distributions/init.py:7
2 from .empirical_distribution import (
3 ECDF, ECDFDiscrete, monotone_fn_inverter, StepFunction
4 )
5 from .edgeworth import ExpandedNormal
----> 7 from .discrete import (
8 genpoisson_p, zipoisson, zigenpoisson, zinegbin,
9 )
11 all = [
12 'ECDF',
13 'ECDFDiscrete',
(...)
21 'zipoisson'
22 ]
24 test = PytestTester()
File ~/.local/lib/python3.11/site-packages/statsmodels/distributions/discrete.py:5
3 from scipy.stats import rv_discrete, poisson, nbinom
4 from scipy.special import gammaln
----> 5 from scipy._lib._util import _lazywhere
7 from statsmodels.base.model import GenericLikelihoodModel
10 class genpoisson_p_gen(rv_discrete):
ImportError: cannot import name '_lazywhere' from 'scipy._lib._util' (/home/jovyan/.local/lib/python3.11/site-packages/scipy/_lib/_util.py)
All reactions