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

Import failing due to breaking change in numpy lib #804

Closed
MysticMith opened this issue Jun 28, 2024 · 6 comments
Closed

Import failing due to breaking change in numpy lib #804

MysticMith opened this issue Jun 28, 2024 · 6 comments
Labels
info Informational

Comments

@MysticMith
Copy link

MysticMith commented Jun 28, 2024

ImportError: cannot import name 'NaN' from 'numpy' (/usr/local/lib/python3.12/site-packages/numpy/__init__.py). Did you mean: 'nan'?
from numpy import NaN as npNaN
File "/usr/local/lib/python3.12/site-packages/pandas_ta/momentum/squeeze_pro.py", line 2, in <module>
from .squeeze_pro import squeeze_pro
File "/usr/local/lib/python3.12/site-packages/pandas_ta/momentum/__init__.py", line 34, in <module>
from pandas_ta.momentum import *
File "/usr/local/lib/python3.12/site-packages/pandas_ta/core.py", line 18, in <module>
from pandas_ta.core import *
File "/usr/local/lib/python3.12/site-packages/pandas_ta/__init__.py", line 116, in <module>
from pandas_ta.candles import ha

The line - "from pandas_ta.core import *" triggers an init that is breaking at "from numpy import NaN as npNaN".

Looks like numpy has changed NaN to nan.

@MysticMith MysticMith added the bug Something isn't working label Jun 28, 2024
@twopirllc twopirllc removed their assignment Jun 28, 2024
@twopirllc twopirllc added info Informational and removed bug Something isn't working labels Jun 28, 2024
@twopirllc
Copy link
Owner

twopirllc commented Jun 28, 2024

Hello @MysticMith,

Some Bug Reporting Points Worth Reading

Which version are you running? The lastest version is on Github. Pip is for major releases.

import pandas_ta as ta
print(ta.version)

Do you have TA Lib also installed in your environment?

$ pip list

Have you tried the development version? Did it resolve the issue?

$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Provide sample code.

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

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Thanks for using Pandas TA!

@Rydo111
Copy link

Rydo111 commented Jun 29, 2024

Is this issue fixed making a simple change of:

from numpy import nan as npNaN ? ...instead of NaN?

@twopirllc
Copy link
Owner

@Rydo111 @MysticMith

It is one way to resolve. But Pandas TA version 0.3.14b will not be supporting numpy 2.0. Use the last numpy version of 1.6.x.

Some of this discussed already in Issue #799 with PRs #800 & #801.

If you absolutely need numpy 2.x, you should be using the development branch after those have been applied.

Kind Regards,
KJ

@MysticMith
Copy link
Author

MysticMith commented Jul 2, 2024 via email

@twopirllc
Copy link
Owner

@MysticMith

I understand the temporary fix but i will wait for the fix in the major
release.

You can wait, but the development version is much better in many ways than the major release you are using.

This is the first time i am reporting a bug on Github, so let me know what
to do next.

I figured that out since you deleted all the bug report questions and just dumped your stack trace of the issue with no other context. Thus I provided a link to help you learn how to describe your issue so you and others can be helped more quickly.

KJ

@icemagno
Copy link

I can see this as "completed" but I'm still facing this issue. Just use "pip install pandas_ta".
When your changes will be in the standard installation method so we will no need to change codes that are not our?

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

No branches or pull requests

4 participants