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

VIF: module 'numpy' has no attribute 'MachAr' #8731

Closed
spktiger opened this issue Mar 15, 2023 · 5 comments
Closed

VIF: module 'numpy' has no attribute 'MachAr' #8731

spktiger opened this issue Mar 15, 2023 · 5 comments
Milestone

Comments

@spktiger
Copy link

spktiger commented Mar 15, 2023

Describe the bug

This is a new bug that I am facing in Variance Inflation Factor. With numpy 1.24 and above, package throws above mentioned error:
The traceback points at this line:
EPS = np.MachAr().eps
from statsmodels/tools/numdiff.py

Code Sample, a copy-pastable example if possible

# Your code here that produces the bug
# This example should be self-contained, and so not rely on external data.
# It should run in a fresh ipython session, and so include all relevant imports.
from statsmodels.stats.outliers_influence import variance_inflation_factor

Note: As you can see, there are many issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates.

Note: Please be sure you are using the latest released version of statsmodels, or a recent build of main. If your problem has been fixed in an unreleased version, you might be able to use main until a new release occurs.

Note: If you are using a released version, have you verified that the bug exists in the main branch of this repository? It helps the limited resources if we know problems exist in the current main branch so that they do not need to check whether the code sample produces a bug in the next release.

If the issue has not been resolved, please file it in the issue tracker.

Expected Output

A clear and concise description of what you expected to happen.

Output of import statsmodels.api as sm; sm.show_versions()

[paste the output of import statsmodels.api as sm; sm.show_versions() here below this line]

@josef-pkt
Copy link
Member

which version of statsmodels are your using?

I don't find any "machar" in the source code using file search

@spktiger
Copy link
Author

I am using statsmodels 0.12.2
Apparently, some other people also have faced same issue recently.
https://stackoverflow.com/questions/75371176/module-numpy-has-no-attribute-machar

I tried downgrading numpy version, and I am no longer facing this issue.

@josef-pkt
Copy link
Member

josef-pkt commented Mar 15, 2023

dependencies are

python -> numpy -> scipy -> pandas -> statsmodels

compatibility requires that they are released at around the same time or have age sequence the same as dependency sequence.

@bashtage bashtage added this to the 0.14 milestone Apr 14, 2023
@TimeSaverr
Copy link

check this

https://numpy.org/doc/stable/release/1.22.0-notes.html#the-np-machar-class-has-been-deprecated

The np.MachAr class has been deprecated
The numpy.MachAr class and finfo.machar <numpy.finfo> attribute have been deprecated. Users are encouraged to access the property if interest directly from the corresponding numpy.finfo attribute.

(gh-20201)

@aijazafzaal
Copy link

I am using statsmodels 0.12.2 Apparently, some other people also have faced same issue recently. https://stackoverflow.com/questions/75371176/module-numpy-has-no-attribute-machar

I tried downgrading numpy version, and I am no longer facing this issue.

Unfortunately downgrading numpy is not working anymore or at least not for me (in databricks), what version did you specify?
I have numpy-1.26.3 and statsmodels==0.13.1

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

5 participants