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

Python 3.9 Numpy 1.20 Depreciation: np.int, np.float #307

Closed
Ali-Tehrani opened this issue Jan 31, 2024 · 7 comments
Closed

Python 3.9 Numpy 1.20 Depreciation: np.int, np.float #307

Ali-Tehrani opened this issue Jan 31, 2024 · 7 comments
Labels
good 1st issue Good issue for beginners

Comments

@Ali-Tehrani
Copy link
Contributor

Ali-Tehrani commented Jan 31, 2024

In Numpy 1.20.0, np.int and np.float are depreciated and should be replaced with int and float. From looking at the website above, this is a very easy fix to do and good for a beginner for learning CI/Git/Github, if I have time later in the week I could do it as well.

Where it occured, the following is an error I get from reading a ".wfx" file:

  File "/home/tehrana/py39/lib/python3.9/site-packages/iodata/api.py", line 142, in load_one
    iodata = IOData(**format_module.load_one(lit, **kwargs))
  File "/home/tehrana/py39/lib/python3.9/site-packages/iodata/formats/wfx.py", line 218, in load_one
    data = load_data_wfx(lit)
  File "/home/tehrana/py39/lib/python3.9/site-packages/iodata/formats/wfx.py", line 134, in load_data_wfx
    result[lbs_aint[key]] = np.fromstring(" ".join(value), dtype=np.int, sep=" ")
  File "/home/tehrana/py39/lib/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
@PaulWAyers PaulWAyers added the good 1st issue Good issue for beginners label Jan 31, 2024
@LudoRNLT
Copy link

LudoRNLT commented Feb 1, 2024

Hello ! we are 2 French computer science students at the University Paris 8 and we hope to work on this bug for our "free software development" course. In this course, we must make a contribution. We're excited to work on this one. I will work with D-TheProgrammer (name on github) if we can.

@Ali-Tehrani
Copy link
Contributor Author

That would be great! Thank you, @LudoRNLT and @D-TheProgrammer. Let me know if you have any questions/concerns.

@PaulWAyers
Copy link
Member

Thanks! We are happy to have your help. I have added you both to the QC-Devs GitHub organization.

@LudoRNLT
Copy link

LudoRNLT commented Feb 8, 2024

Hey, thanks that's really nice !
We were wondering, we are not able to recreate this error with the wfx files, is this already patch or maybe we are not using the good method to get it ?
We are trying with the latest version, with "pytest --pyargs iodata -n auto" after all the installation.
Also, after a quick look in the iodata/format/wfx.py, "np.int" l.134 is already replaced by an "dtype=int". Is this the solution for this problem ?

@Ali-Tehrani
Copy link
Contributor Author

Oh wow, thanks, yes that's the solution to the problem! I was using an old version of IOData. How silly of me.

If you're still interested for your assignment, there is another issue that has a quick, easy solution to it that will involve some coding. Thank you for looking into this.

@D-TheProgrammer
Copy link
Contributor

Sure !! We'll be glad to help you with this other issue.

@Ali-Tehrani
Copy link
Contributor Author

Okay thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good 1st issue Good issue for beginners
Projects
None yet
Development

No branches or pull requests

4 participants