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

Kernel Crash #17

Open
ddouglas87 opened this issue Dec 15, 2024 · 0 comments
Open

Kernel Crash #17

ddouglas87 opened this issue Dec 15, 2024 · 0 comments

Comments

@ddouglas87
Copy link

ddouglas87 commented Dec 15, 2024

Note: This is three different issues in one. I'm reporting it this way because I don't know if the three issues are connected or not.

First I install polars_talib by doing a %pip install --no-deps polars_talib. Note that I have to do --no-deps because polars_talib puts polars as a prerequisite package, but I'm using the polars-lts-cpu package.

Issue #1: polars_talib installs the polars package, but there are multiple polars packages. pip install polars_talib should not install the polars package.

Issue #2: "'Expr' object has no attribute 'ta'",

    return df.with_columns(
        ADT=adv/(adv+dec)*100,  # Advance Decline Thrust
        UDT=up/(up+down)*100,  # UP/DOWN VOLUME THRUST
        SPT=change_snp*100,  # S&P 500 PRICE THRUST
        total_issues=total_issues,
        minimum_52w=minimum_52week_movement,
        MHL=minimum_52week_movement.ta.ema(10),  # Minimum High Low
    )

This is my first attempt to run .ta.ema(...). Upon running it here is the output I get:

22:09:23.572 [warn] Cell completed with errors [iu [Error]: 'Expr' object has no attribute 'ta'
	at n.execute (/home/~/.vscode-oss/extensions/ms-toolsai.jupyter-2024.11.0-universal/dist/extension.node.js:297:4958)] {
  ename: 'AttributeError',
  evalue: "'Expr' object has no attribute 'ta'",
  traceback: [
    '\x1B[0;31m---------------------------------------------------------------------------\x1B[0m',
    '\x1B[0;31mAttributeError\x1B[0m                            Traceback (most recent call last)',
    'Cell \x1B[0;32mIn[3], line 21\x1B[0m\n' +
      '\x1B[1;32m     10\x1B[0m     minimum_52week_movement \x1B[38;5;241m=\x1B[39m (pl\x1B[38;5;241m.\x1B[39mmin_horizontal(col\x1B[38;5;241m.\x1B[39mYear_Highs,col\x1B[38;5;241m.\x1B[39mYear_Lows)\x1B[38;5;241m/\x1B[39mtotal_issues)\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m\n' +
      '\x1B[1;32m     12\x1B[0m     \x1B[38;5;28;01mreturn\x1B[39;00m df\x1B[38;5;241m.\x1B[39mwith_columns(\n' +
      '\x1B[1;32m     13\x1B[0m         ADT\x1B[38;5;241m=\x1B[39madv\x1B[38;5;241m/\x1B[39m(adv\x1B[38;5;241m+\x1B[39mdec)\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m,  \x1B[38;5;66;03m# Advance Decline Thrust\x1B[39;00m\n' +
      '\x1B[1;32m     14\x1B[0m         UDT\x1B[38;5;241m=\x1B[39mup\x1B[38;5;241m/\x1B[39m(up\x1B[38;5;241m+\x1B[39mdown)\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m,  \x1B[38;5;66;03m# UP/DOWN VOLUME THRUST\x1B[39;00m\n' +
      '\x1B[0;32m   (...)\x1B[0m\n' +
      '\x1B[1;32m     18\x1B[0m         MHL\x1B[38;5;241m=\x1B[39mminimum_52week_movement\x1B[38;5;241m.\x1B[39mta\x1B[38;5;241m.\x1B[39mema(\x1B[38;5;241m10\x1B[39m), \x1B[38;5;66;03m#.ewm_mean(min_periods=30, alpha=0.05),  # Minimum High Low\x1B[39;00m\n' +
      '\x1B[1;32m     19\x1B[0m     )\n' +
      '\x1B[0;32m---> 21\x1B[0m whaley_breadth_thrust_df \x1B[38;5;241m=\x1B[39m \x1B[43mcalc\x1B[49m\x1B[43m(\x1B[49m\x1B[43mnyse_issues\x1B[49m\x1B[43m)\x1B[49m\n' +
      '\x1B[1;32m     22\x1B[0m t \x1B[38;5;241m=\x1B[39m whaley_breadth_thrust_df\x1B[38;5;241m.\x1B[39mdrop_nulls()\n' +
      '\x1B[1;32m     23\x1B[0m t\x1B[38;5;241m.\x1B[39mfilter(col\x1B[38;5;241m.\x1B[39mDate\x1B[38;5;241m.\x1B[39mis_between(pl\x1B[38;5;241m.\x1B[39mdate(\x1B[38;5;241m2008\x1B[39m,\x1B[38;5;241m10\x1B[39m,\x1B[38;5;241m15\x1B[39m), pl\x1B[38;5;241m.\x1B[39mdate(\x1B[38;5;241m2008\x1B[39m,\x1B[38;5;241m10\x1B[39m,\x1B[38;5;241m28\x1B[39m)))\n',
    'Cell \x1B[0;32mIn[3], line 18\x1B[0m, in \x1B[0;36mcalc\x1B[0;34m(df, timeframe)\x1B[0m\n' +
      '\x1B[1;32m      9\x1B[0m total_issues \x1B[38;5;241m=\x1B[39m col\x1B[38;5;241m.\x1B[39mAdvancing \x1B[38;5;241m+\x1B[39m col\x1B[38;5;241m.\x1B[39mDeclining \x1B[38;5;241m+\x1B[39m col\x1B[38;5;241m.\x1B[39mUnchanged\n' +
      '\x1B[1;32m     10\x1B[0m minimum_52week_movement \x1B[38;5;241m=\x1B[39m (pl\x1B[38;5;241m.\x1B[39mmin_horizontal(col\x1B[38;5;241m.\x1B[39mYear_Highs,col\x1B[38;5;241m.\x1B[39mYear_Lows)\x1B[38;5;241m/\x1B[39mtotal_issues)\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m\n' +
      '\x1B[1;32m     12\x1B[0m \x1B[38;5;28;01mreturn\x1B[39;00m df\x1B[38;5;241m.\x1B[39mwith_columns(\n' +
      '\x1B[1;32m     13\x1B[0m     ADT\x1B[38;5;241m=\x1B[39madv\x1B[38;5;241m/\x1B[39m(adv\x1B[38;5;241m+\x1B[39mdec)\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m,  \x1B[38;5;66;03m# Advance Decline Thrust\x1B[39;00m\n' +
      '\x1B[1;32m     14\x1B[0m     UDT\x1B[38;5;241m=\x1B[39mup\x1B[38;5;241m/\x1B[39m(up\x1B[38;5;241m+\x1B[39mdown)\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m,  \x1B[38;5;66;03m# UP/DOWN VOLUME THRUST\x1B[39;00m\n' +
      '\x1B[1;32m     15\x1B[0m     SPT\x1B[38;5;241m=\x1B[39mchange_snp\x1B[38;5;241m*\x1B[39m\x1B[38;5;241m100\x1B[39m,  \x1B[38;5;66;03m# S&P 500 PRICE THRUST\x1B[39;00m\n' +
      '\x1B[1;32m     16\x1B[0m     total_issues\x1B[38;5;241m=\x1B[39mtotal_issues,\n' +
      '\x1B[1;32m     17\x1B[0m     minimum_52w\x1B[38;5;241m=\x1B[39mminimum_52week_movement,\n' +
      '\x1B[0;32m---> 18\x1B[0m     MHL\x1B[38;5;241m=\x1B[39m\x1B[43mminimum_52week_movement\x1B[49m\x1B[38;5;241;43m.\x1B[39;49m\x1B[43mta\x1B[49m\x1B[38;5;241m.\x1B[39mema(\x1B[38;5;241m10\x1B[39m), \x1B[38;5;66;03m#.ewm_mean(min_periods=30, alpha=0.05),  # Minimum High Low\x1B[39;00m\n' +
      '\x1B[1;32m     19\x1B[0m )\n',
    "\x1B[0;31mAttributeError\x1B[0m: 'Expr' object has no attribute 'ta'"
  ]
}
22:10:26.782 [error] Disposing session as kernel process died ExitCode: undefined, Reason: thread caused non-unwinding panic. aborting.

Issue #3: Kernel panics and crashes.

I figured issue #2 was caused by an old version of Polars, so I updated from version polars-lts-cpu~=1.9.0 to polars-lts-cpu~=1.17.1. (Also note I'm running Python version 3.12.7 right now.)

Here's the new kernel panic output:

22:29:05.246 [info] Kernel successfully started
22:29:05.297 [info] Process Execution: /mnt/hunk/projects/orchestrator/.venv/bin/python /home/~/.vscode-oss/extensions/ms-toolsai.jupyter-2024.11.0-universal/pythonFiles/printJupyterDataDir.py
22:29:20.340 [error] Disposing session as kernel process died ExitCode: undefined, Reason: [IPKernelApp] ERROR | Invalid Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 395, in dispatch_shell
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'b8499a13f07e28c5a835d747d9e66cabc088a33fdfa3438a4d31ab038eef8a2d'
[IPKernelApp] ERROR | Invalid Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 395, in dispatch_shell
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'84e92308f5beaf5b6f5749e2c7b6b2f0ec42a0c76029316a5c8c919c7b68bb16'
[IPKernelApp] ERROR | Invalid Control Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 341, in process_control
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'c5df9861b9bbb613a5b8e100bda616f90a4a09970be6725dc7ee0a5c13a1bea4'
[IPKernelApp] ERROR | Invalid Control Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 341, in process_control
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'b7028d79a298c7c7fa9ef6084a41bbd56978eeec0dce83d207582003a038ce81'
[IPKernelApp] ERROR | Invalid Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 395, in dispatch_shell
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'4d31bc38269acc178c23f8efb4a33183a66893ea2a578a43917c74ef4f8d549d'
[IPKernelApp] ERROR | Invalid Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 395, in dispatch_shell
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'f115224a7636452891dd168b4b53e1b926e353175fcff9bd20f7a1f2523caf69'
[IPKernelApp] ERROR | Invalid Control Message
Traceback (most recent call last):
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/ipykernel/kernelbase.py", line 341, in process_control
    msg = self.session.deserialize(msg, content=True, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/hunk/projects/orchestrator/.venv/lib64/python3.12/site-packages/jupyter_client/session.py", line 1074, in deserialize
    raise ValueError(msg)
ValueError: Invalid Signature: b'17549cb2cc7d718794092782eec4fd8f9adc4969e32c9afa256917bb3d2cebeb'
thread caused non-unwinding panic. aborting.

Note these kernel panics might overlap with the lack of ARM support. Ironically I prefer to use ARM too. I fell back to an older machine which is why I'm using polars-lts-cpu to try it on an Intel x86_64 machine. My Sandy Bridge i5 CPU does not support AVX2 which polars uses. polars-lts-cpu disables AVX2 instructions.

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

1 participant