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

BUG: AttributeError: module 'numpy.linalg._umath_linalg' has no attribute '_ilp64' #25150

Closed
gunaxprofessional opened this issue Nov 15, 2023 · 18 comments
Labels
00 - Bug 32 - Installation Problems installing or compiling NumPy

Comments

@gunaxprofessional
Copy link

Describe the issue:

Whenever I try to run this code, from peft import PeftModel , it throws an error.

Reproduce the code example:

from peft import PeftModel

Error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-39-c22a8a6046a0> in <cell line: 1>()
----> 1 from peft import PeftModel

18 frames
/usr/local/lib/python3.10/dist-packages/numpy/testing/_private/utils.py in <module>
     55 IS_PYSTON = hasattr(sys, "pyston_version_info")
     56 HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON
---> 57 HAS_LAPACK64 = numpy.linalg._umath_linalg._ilp64
     58 
     59 _OLD_PROMOTION = lambda: np._get_promotion_state() == 'legacy'

AttributeError: module 'numpy.linalg._umath_linalg' has no attribute '_ilp64'

Runtime information:

numpy version = 1.23.5
system version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]

Context for the issue:

Well, I'm currently working on building a chatbot using the LLM. When I try to execute the from peft import PeftModel command, I receive the above error. You can access my notebook at the following link

@mattip
Copy link
Member

mattip commented Nov 15, 2023

Looking at your notebook and the stack trace, the interesting part is where the code does

from scipy.stats import norm

which then calls

from numpy.testing import suppress_warnings

This was removed in response to scipy/scipy#19344 in the latest SciPy HEAD.

As to why it fails: that seems very strange and points to a problem with the numpy module. What kernel/runtime are you using? What happens if you try to only import that attribute, which of these lines fail?

import numpy
import numpy.linalg
import numpy.linalg._umath_linalg
import numpy.linalg._umath_linalg._ilp64

@alexanderkulesza
Copy link

alexanderkulesza commented Nov 17, 2023

Can reproduce with numpy 1.23.5
import tellurium as te on a google collab

Trying the sequence you suggested gave

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-17-d2a9a824a7cd>](https://localhost:8080/#) in <cell line: 4>()
      2 import numpy.linalg
      3 import numpy.linalg._umath_linalg
----> 4 import numpy.linalg._umath_linalg._ilp64

ModuleNotFoundError: No module named 'numpy.linalg._umath_linalg._ilp64'; 'numpy.linalg._umath_linalg' is not a package

@mattip
Copy link
Member

mattip commented Nov 17, 2023

on a google collab

What kernel? How did you install numpy 1.23.5?

@alexanderkulesza
Copy link

alexanderkulesza commented Nov 17, 2023

To be honst, no idea. Collab comes with python3.10 and had that numpy version pre-installed. It also seems that I can not simply uninstall numpy1.23.5 and install a later, as then google-collab 1.0.0 does not run anymore

@mattip
Copy link
Member

mattip commented Nov 17, 2023

Maybe worth re-installing.

@contravarianceisuseful
Copy link

contravarianceisuseful commented Nov 22, 2023

Also having this issue.

pip show says 1.26.2 but in the python kernel numpy.__version__ says 1.23.3.

Error happened when calling from ray.rllib.agents.ppo import PPOTrainer.

Forcing it to pip install version 1.24.1 fixed the issue.

@Mrw33554432
Copy link

Mrw33554432 commented Dec 6, 2023

Same, newest numpy version 1.26.2 and 1.24.3, 1.24.1 and more

@Mr-Twave
Copy link

Mr-Twave commented Dec 6, 2023

In Spyder (anaconda3), I'm using print(np.__version__) -> 1.24.3 and it's throwing this same error.

Edit: Do I have two numpy versions installed? I'm very confused.
pip show numpy

Name: numpy
Version: 1.26.2
conda list numpy
# packages in environment at C:\Users\[user]\anaconda3:
#
# Name                    Version             
numpy                     1.26.2         
numpy-base                1.26.2         
numpydoc                  1.5.0           
!pip install --upgrade numpy
Requirement already satisfied: numpy in c:\users\[user]\anaconda3\lib\site-packages (1.26.2)

import numpy as np

print(np.__version__)
1.24.3

I am using the default spyder python installation path directory.

@mattip
Copy link
Member

mattip commented Dec 7, 2023

I think these all are errors due to two numpy versions installed on top of eachother. It just so happens ilp64 is the first thing to trip up the imports when numpy.linalg._umath_linalg is from a later version, and numpy/testing/_private/utils.py is from an earlier version.

@seberg
Copy link
Member

seberg commented Dec 22, 2023

Agreed with Matti, everyone here reporting seems to have a messed up NumPy installs that somehow have two versions mingled.

I might suggest manually uninstalling NumPy (possibly more than once with pip), but it's hard to guess how to fix broken environments remotely. In either case these don't seem like NumPy issues.

@seberg seberg closed this as completed Dec 22, 2023
@seberg seberg added the 32 - Installation Problems installing or compiling NumPy label Dec 22, 2023
@Mrw33554432
Copy link

Agreed with Matti, everyone here reporting seems to have a messed up NumPy installs that somehow have two versions mingled.

I might suggest manually uninstalling NumPy (possibly more than once with pip), but it's hard to guess how to fix broken environments remotely. In either case these don't seem like NumPy issues.

Not really. During problem solving I actually tired uninstall - reinstall, and it doesn’t work. And inside the site package there is only 1 numpy, as well as in the package list. So it is an unsolved problem in my case, and the bug only appeared in that piece of code - if there are two numpy then bug will be everywhere, as it used to be.

Additionally, having 2 versions of numpy is a very common issue, perhaps it worth to monitored during installation (actually I have encountered this type of issue a couple of times).

@Mr-Twave
Copy link

Agreed with Matti, everyone here reporting seems to have a messed up NumPy installs that somehow have two versions mingled.

I might suggest manually uninstalling NumPy (possibly more than once with pip), but it's hard to guess how to fix broken environments remotely. In either case these don't seem like NumPy issues.

I attempted this and I appeared to achieve the same result with only numpy 1.24.3 installed. I would reconsider closing this issue.

@charris
Copy link
Member

charris commented Dec 22, 2023

@Mr-Twave Have you done a file search to see if there is another version lurking about?

  • What OS are you running on?
  • How did you install 1.24.3?

@KlevertonSilva
Copy link

It worked here using pip install numpy==1.24.4

@finch-wren
Copy link

The issue still exists in colab, while pip show shows the latest version of numpy - the actual actual import's numpy.version shows a different version causing errors in codes as mentioned above. Reopen the issue please.

@mattip
Copy link
Member

mattip commented Jan 30, 2024

@finch-wren please open a new issue and describe exactly how to reproduce it so we can help. So far we have not seen anyone explain how they get to this situation in a way that is reproducible.

@ShivamGupta92
Copy link

Encountered same issue when working with Scikit-learn (version== 1.4.0) and NumPy (version==1.25.2). Had a version conflict with NumPy tried upgrading to NumPy version==1.26.3

@numpy numpy locked as resolved and limited conversation to collaborators Jan 31, 2024
@mattip
Copy link
Member

mattip commented Jan 31, 2024

I locked this issue. Please do open an new issue with a description of your environment and complete reproducer. Much of the discussion here is not anything NumPy can control, but maybe we can help you fix the problem with a good description of what you are doing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
00 - Bug 32 - Installation Problems installing or compiling NumPy
Projects
None yet
Development

No branches or pull requests