-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Pandas-ta doesnt work with numpy 2.0 #799
Comments
That's crazy @Chuck321123! How is that possible? 🤷🏼♂️ Please inform the following packages that they are not up to date with the newest numpy 2.0. I don't want them to miss out on the action. ![]() Note: streamlit is not necessary for pandas-ta
Let's do it! ✅ FYI, I'm now running: |
@twopirllc Unfortunately, I don't know how to do that. However, If anyone knows how to do it I would be very happy |
I have created the pull request. Have tested with server so it should work. Though haven't touched the package requirements though should also be compatible with 1.22. |
Until the next release, on momentum/squeeze_pro.py change:
to
|
Import the whole numpy namespace for a single item? 🤔 |
Temporary bro, just to wait the final fix release. |
instead, just rename to
|
I believe this has already been done, the NaN is already renamed to nan and in the #801 I have fixed the imports regarding infinity (to inf). Let all these get merged then we can close this issue i guess. |
Sorry but there are no new releases since 2021, why should a new release come out any soon? |
I don't know, the comment was just try to help, feel free to improve and send another one. This is not a PR. |
You shouldn't expect a main release soon as the development (wih 360+ commits beyond main) is still ironing out main's issues of numerous bugs, new indicators, speed and documentation improvements. If you want to help speed up this process, contributions to developement or answering basic Issues have always been welcome. 😎 However if you are as busy as I am, perhaps consider Buying Me a Coffee or Sponsoring my work instead. While it is Open Source, it is not free. I find it rather disheartening that only 25 people out of 4900 ⭐'s (or 0.5% of people/companies/downstream projects have bought a ☕ and one is a sponsor). 🤷🏼♂️ Kind Regards! |
Was going to the log files of the server, noticed that the current version of pandas_ta asks for numpy>=1.26 which is a problem as numpy2 (latest) one is not supported in the main version. This is resulting in an error while trying to use pandas_ta. |
Sorry, I thought this was discontinued. Also, I'm sorry there are not many donations but you're not pushing a new version since 2021, naturally end users will avoid a project that looks like discontinued, and less users = less donations. You can't complain about users not donating when they're not receiving an update since 2021, since there's also TA-Lib which is more active. |
I went ahead and manually updated the import as suggested by @seraph-wing The import succeeded but when using RSI another compat issue arose: File ~/code/pylibs/lib/python3.12/site-packages/pandas_ta/core.py:1058, in AnalysisIndicators.rsi(self, length, scalar, drift, offset, **kwargs)
1056 def rsi(self, length=None, scalar=None, drift=None, offset=None, **kwargs):
1057 close = self._get_column(kwargs.pop("close", "close"))
-> 1058 result = rsi(close=close, length=length, scalar=scalar, drift=drift, offset=offset, **kwargs)
1059 return self._post_process(result, **kwargs)
File ~/code/pylibs/lib/python3.12/site-packages/pandas_ta/momentum/rsi.py:22, in rsi(close, length, scalar, talib, drift, offset, **kwargs)
20 # Calculate Result
21 if Imports["talib"] and mode_tal:
---> 22 from talib import RSI
23 rsi = RSI(close, length)
24 else:
File ~/code/pylibs/lib/python3.12/site-packages/talib/__init__.py:93
89 else:
90 _wrapper = lambda x: x
---> 93 from ._ta_lib import (
94 _ta_initialize, _ta_shutdown, MA_Type, __ta_version__,
95 _ta_set_unstable_period as set_unstable_period,
96 _ta_get_unstable_period as get_unstable_period,
97 _ta_set_compatibility as set_compatibility,
98 _ta_get_compatibility as get_compatibility,
99 __TA_FUNCTION_NAMES__
100 )
102 # import all the func and stream functions
103 from ._ta_lib import *
File talib/_ta_lib.pyx:1, in init talib._ta_lib()
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject |
if we are talking about the current main branch, why not just limit the numpy to 1.26.4 in the setup.py. |
Understandable. However, this is not a high churn library nor is it archived (which is considered discontinued). Thanks for the feedback |
Even better, let not upgrade prematurely to a new release especially when downstream library and applications haven't done so either... ie pandas, pyarrow, & numba., as numpy states. 😅 ![]() and ![]() Using |
Yup, that's what I suggested in the last comment. In the mean time lets change the requirements mentioned in setpu.py to |
since this is relatively small change ,by which date can we expect to get the update pushed to main branch? |
Fixed numpy version to 1.26.4 in setup.py for main. Not updating pip for a single change. |
Why not? It's stalled since 2021... |
@twopirllc Thank you for all you do. I went to sponsor you just now and forgot I already was (not much but a small show of gratitude.) Come on folks let's help this fella retire early so he can build more cool Sh%^ for us. |
Using cached tzlocal-5.2-py3-none-any.whl (17 kB)
Installing collected packages: widgetsnbextension, tzlocal, tqdm, threadpoolctl, schedule, regex, numpy, mypy-extensions, llvmlite, jupyterlab-widgets, joblib, dill, scipy, numba, imageio, dateparser, scikit-learn, ipywidgets, vectorbt
Attempting uninstall: numpy
Found existing installation: numpy 1.26.4
Uninstalling numpy-1.26.4:
Successfully uninstalled numpy-1.26.4
WARNING: Failed to remove contents in a temporary directory 'C:\Users\vishw\AppData\Local\Temp\pip-uninstall-f04ies4l'.
You can safely remove it manually.
WARNING: Failed to remove contents in a temporary directory 'C:\Users\vishw\.conda\envs\crypto-bot\Lib\site-packages\~umpy.libs'.
You can safely remove it manually.
WARNING: Failed to remove contents in a temporary directory 'C:\Users\vishw\.conda\envs\crypto-bot\Lib\site-packages\numpy\~ft'.
You can safely remove it manually.
WARNING: Failed to remove contents in a temporary directory 'C:\Users\vishw\.conda\envs\crypto-bot\Lib\site-packages\numpy\~inalg'.
You can safely remove it manually.
WARNING: Failed to remove contents in a temporary directory 'C:\Users\vishw\.conda\envs\crypto-bot\Lib\site-packages\numpy\~andom'.
You can safely remove it manually.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pandas-ta 0.3.14b0 requires numpy==1.26.4, but you have numpy 1.23.5 which is incompatible.
Successfully installed dateparser-1.2.0 dill-0.3.8 imageio-2.34.2 ipywidgets-8.1.3 joblib-1.4.2 jupyterlab-widgets-3.0.11 llvmlite-0.39.1 mypy-extensions-1.0.0 numba-0.56.4 numpy-1.23.5 regex-2024.5.15 schedule-1.2.2 scikit-learn-1.5.0 scipy-1.13.1 threadpoolctl-3.5.0 tqdm-4.66.4 tzlocal-5.2 vectorbt-0.26.1 widgetsnbextension-4.0.11
this change resulted in above message when i installed vectorbt. I'm not sure whether to raaise this on the vectorbt repo, or here, since a large part of the people using pandas-ta would be using vectorbt. As @twopirllc mentioned, it might be best to keep the numpy version as '''numpy<2''' after all... |
Yes, only the main branch has been on hold.
Unfortunately, the development version still has more improvements left before merging into main. These improvements have been discussed recently in Issue #771 and below is the updated requirements from the post that @Rossco8 has helped with. Required Improvements
Main Branch: If neither work for you, fork and carry on or use another library. 🍀 |
@eervin123: Thank you for the recent sponsorship upgrade and continued support! It means a lot. 😎 |
Hi all, I am just at the very beginning of working with python. So please forgive the dumb questions. Where is the renaming done at? I tried just using that in the IDE but I am still getting the same error. I still get 'ImportError: cannot import name 'NaN' from 'numpy' |
Anyone has already a fix to this? |
for the folks that get here and dont read through all the comments, the import error can be fixed by installing numpy 1.26.4 |
We are back to the Same issue with latest pandas-ta build 2024.1 and numpy 2.0.1. Can anyone help keep these dependencies lined up properly or open source mean open headaches for developers ? |
Meet the same issue. Please fix it! Thank you very much! |
Thank you |
This works for me. |
Hi all, happy to help however I can. It looks like this issue has been fixed since June in the development branch. What can I do to help get this over the finish line? I assume there is more work to be done in the development branch before it is merged in. |
but the issue is that with Python 3.9 and higher you need Numpy 2.0. Or I am using 3.12.5 and other libs need Numpy 2 or higher |
all the fixs that were suggested here doesnt work for me, "cannot import name 'NaN' from 'numpy'" is there a fix for this problem? |
downgrade numpy to 1.56 it worked for me after that.
…On Tue, Oct 8, 2024, 12:50 PM Roi Dayan ***@***.***> wrote:
all the fixs that were suggested here doesnt work for me, "cannot import
name 'NaN' from 'numpy'"
is there a fix for these or panda ta is outdated?
—
Reply to this email directly, view it on GitHub
<#799 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AINWUSCWE5HKXMLGC53WIXTZ2QLQDAVCNFSM6AAAAABJOKZ23OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBQGQ3TOMZYG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Than I got this issue (Docker, WSL, VS Code):
|
I need Numpy version 2.0 or higher so that solution will not work for me. I use Python 3.12.5, Numpy 2.1.1 because I use another plugin that needs Numpy 2 or higher |
So pandas-ta doesnt work with the newest numpy 2.0.
Reproducible example:
import pandas_ta as ta
Log:
Would be nice to get support for the latest numpy version.
Pandas-ta version 0.3.14b
Python: 3.12.2
The text was updated successfully, but these errors were encountered: