Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yalda1205 opened this issue May 7, 2024 · 1 comment
Open

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

yalda1205 opened this issue May 7, 2024 · 1 comment

Comments

@yalda1205
Copy link

Hi, I install the package using these lines:
git clone https://github.com/bbalasub1/glmnet_python.git
cd glmnet_python
python setup.py install

and then try to import the package:
import glmnet_python

but there is this error:

{
"name": "AttributeError",
"message": "Module 'scipy' has no attribute 'empty'",
"stack": "---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/venv_environments/glmnet/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[1], line 3
1 import scipy, importlib, pprint, matplotlib.pyplot as plt, warnings
2 from scipy import integrate
----> 3 import glmnet_python
4 from glmnet import glmnet
5 from glmnet import glmnet; from glmnetPlot import glmnetPlot

File ~/venv_environments/glmnet/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 ~/venv_environments/glmnet/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 ~/venv_environments/glmnet/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 ~/venv_environments/glmnet/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'"
}

Could you please help me how can I solve it?

@petomajci
Copy link

I ran into the same problem. Downgrading to scipy 1.11.0 solved it for me (e.g. pip install scipy==1.11.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants