Skip to content

AttributeError: Module 'scipy' has no attribute 'empty' #70

@fengxiaohu

Description

@fengxiaohu

when I import glmnet_python, and
from glmnetPrint import glmnetPrint; from glmnetCoef import glmnetCoef; from glmnetPredict import glmnetPredict

it shows error


KeyError Traceback (most recent call last)
File /opt/homebrew/lib/python3.11/site-packages/scipy/init.py:137, in getattr(name)
136 try:
--> 137 return globals()[name]
138 except KeyError:

KeyError: 'empty'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
Cell In[7], line 11
9 import seaborn as sns
10 import pandas as pd
---> 11 import glmnet_python
13 from sklearn.ensemble import IsolationForest
14 from sklearn.covariance import EllipticEnvelope

File /opt/homebrew/lib/python3.11/site-packages/glmnet_python/init.py:10
8 from .glmnetPlot import glmnetPlot
9 from .glmnetPrint import glmnetPrint
---> 10 from .glmnetCoef import glmnetCoef
11 from .glmnetPredict import glmnetPredict
12 from .cvglmnet import cvglmnet

File /opt/homebrew/lib/python3.11/site-packages/glmnet_python/glmnetCoef.py:72
2 """
3 --------------------------------------------------------------------------
4 glmnetCoef computes coefficients from a "glmnet" object.
(...)
68
69 """
71 import scipy
---> 72 from glmnetPredict import glmnetPredict
74 def glmnetCoef(obj, s = None, exact = False):
76 if s is None:

File /opt/homebrew/lib/python3.11/site-packages/glmnet_python/glmnetPredict.py:110
106 import scipy
107 import scipy.interpolate
109 def glmnetPredict(fit,
--> 110 newx = scipy.empty([0]),
111 s = scipy.empty([0]),
112 ptype = 'link',
113 exact = False,
114 offset = scipy.empty([0])):
116 typebase = ['link', 'response', 'coefficients', 'nonzero', 'class']
117 indxtf = [x.startswith(ptype.lower()) for x in typebase]

File /opt/homebrew/lib/python3.11/site-packages/scipy/init.py:139, in getattr(name)
137 return globals()[name]
138 except KeyError:
--> 139 raise AttributeError(
140 f"Module 'scipy' has no attribute '{name}'"
141 )

AttributeError: Module 'scipy' has no attribute 'empty'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions