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 'numpy' has no attribute 'float128'. Did you mean: 'float16'? #12

Closed
copperfield42 opened this issue Jun 23, 2022 · 7 comments

Comments

@copperfield42
Copy link

after just coming across this library, I just pip installed it and the first thing I come across is

>>> import numerary
Traceback (most recent call last):
  File "<pyshell#35>", line 1, in <module>
    import numerary
  File "C:\Python3.10.5\lib\site-packages\numerary\__init__.py", line 13, in <module>
    from .types import *  # noqa: F401,F403
  File "C:\Python3.10.5\lib\site-packages\numerary\types.py", line 1712, in <module>
    numpy.float128,
  File "C:\Python3.10.5\lib\site-packages\numpy\__init__.py", line 315, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'float128'. Did you mean: 'float16'?
>>> 

versions:
python: 3.10.5
numpy: 1.22.4

@posita
Copy link
Collaborator

posita commented Jun 23, 2022

Hi @copperfield42! Thanks for the report! I should have a fix out shortly. Are you running on Windows by any chance? What do the following give for you?

python -VV
python -c 'import sys ; print(sys.platform)'

@copperfield42
Copy link
Author

yes, I use windows.

Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]
win32

@posita
Copy link
Collaborator

posita commented Jun 23, 2022

Thanks again, @copperfield42. Can you try to see if my fix addresses your issue? You can try it out with pip install 'git+https://github.com/posita/numerary@posita/0/fix-numpy'. I should be able to cut a release in a few hours, but that will allow you to verify the fix before that.

@copperfield42
Copy link
Author

copperfield42 commented Jun 23, 2022

meanwhile I fixed like this: commented the problem line and try-except the float128

    for t in (
        numpy.float16,
        numpy.float32,
        numpy.float64,
        #numpy.float128,
    ):
        SupportsFloorCeil.includes(t)
        SupportsIntegralOps.excludes(t)
        SupportsIntegralPow.excludes(t)
    try:
        t = numpy.float128
        SupportsFloorCeil.includes(t)
        SupportsIntegralOps.excludes(t)
        SupportsIntegralPow.excludes(t)
    except AttributeError:
        pass

and that solve it.


I will try your fix in a bit and tell you

@copperfield42
Copy link
Author

that pip command give me

> pip install "git+https://github.com/posita/numerary@posita/0/fix-numpy"
Collecting git+https://github.com/posita/numerary@posita/0/fix-numpy
  Cloning https://github.com/posita/numerary (to revision posita/0/fix-numpy) to c:\users\thecnomacvzla\appdata\local\temp\pip-req-build-l_iw0x15
  ERROR: Error [WinError 2] El sistema no puede encontrar el archivo especificado while executing command git version
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

>

@posita
Copy link
Collaborator

posita commented Jun 23, 2022

Ah. Okay, so that's not an option for you. Given that your commented line addresses the issue on your platform, I'm pretty sure my fix will also work for you, but I'll need to cut a new release. Give me a bit, and I should have something soon.

@posita posita closed this as completed in bad0fe8 Jun 24, 2022
posita added a commit that referenced this issue Jun 24, 2022
`float128` is not available on some Windows platforms. Not sure if there are others.

Fixes #12.
@posita
Copy link
Collaborator

posita commented Jun 24, 2022

@copperfield42, I believe @v0.4.2 should address this issue for you, but please reopen if it does not. pip install --upgrade 'numerary>=0.4.2' should update the version you have.

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