deedy / mac_computer_use

A fork of Anthropic Computer Use that you can run on Mac computers to give Claude and other AI models autonomous access to your computer.
https://x.com/deedydas/status/1849481225041559910
641 stars 96 forks source link

Segmentation Fault #11

Open jeffhaskin opened 17 hours ago

jeffhaskin commented 17 hours ago

System: M2 Macbook, macos Sequoia 15.0.1 (24A348) Python: 3.12.2

The readme says macOS Sonoma 15.7 or above, but 15.0 is Sequoia, and 15.7 isn't out yet.

According to Claude, the crash is in keyboard._darwinkeyboard.py, indicating an issue with the keyboard module's macOS implementation.

% streamlit run streamlit.py                                      

  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://198.91.1.114:8501

zsh: segmentation fault  streamlit run streamlit.py

With debug flag enabled:

% $VIRTUAL_ENV/bin/python -X faulthandler $VIRTUAL_ENV/bin/streamlit run streamlit.py

  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://198.91.1.114:8501

Fatal Python error: Segmentation fault

Current thread 0x0000000172a97000 (most recent call first):
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/keyboard/_darwinkeyboard.py", line 134 in __init__
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/keyboard/_darwinkeyboard.py", line 204 in __init__
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/keyboard/_darwinkeyboard.py", line 404 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 995 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1415 in _handle_fromlist
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/keyboard/__init__.py", line 126 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 995 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/tools/computer.py", line 6 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 995 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/tools/__init__.py", line 4 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 995 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/loop.py", line 25 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 995 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/app.py", line 24 in <module>
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579 in code_to_exec
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88 in exec_func_with_error_handling
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 595 in _run_script
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 320 in _run_script_thread
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1010 in run
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1030 in _bootstrap

Thread 0x00000001719ff000 (most recent call first):
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/watchdog/observers/fsevents.py", line 308 in run
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1030 in _bootstrap

Thread 0x00000001709f3000 (most recent call first):
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 355 in wait
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/queue.py", line 171 in get
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/watchdog/observers/api.py", line 379 in dispatch_events
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/watchdog/observers/api.py", line 213 in run
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/threading.py", line 1030 in _bootstrap

Thread 0x00000001fb69b240 (most recent call first):
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/selectors.py", line 566 in select
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/asyncio/base_events.py", line 1947 in _run_once
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/asyncio/base_events.py", line 639 in run_forever
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/asyncio/base_events.py", line 672 in run_until_complete
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/asyncio/runners.py", line 118 in run
  File "/Users/jeffhaskin/miniconda3/lib/python3.12/asyncio/runners.py", line 194 in run
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/web/bootstrap.py", line 329 in run
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/web/cli.py", line 276 in _main_run
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/streamlit/web/cli.py", line 240 in main_run
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/click/core.py", line 783 in invoke
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/click/core.py", line 1434 in invoke
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/click/core.py", line 1688 in invoke
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/click/core.py", line 1078 in main
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/lib/python3.12/site-packages/click/core.py", line 1157 in __call__
  File "/Users/jeffhaskin/Documents/Programs/Applications/mac_computer_use/venv/bin/streamlit", line 8 in <module>

Extension modules: google._upb._message, tornado.speedups, _watchdog_fsevents, PIL._imaging, objc._objc, CoreFoundation._CoreFoundation, CoreFoundation._inlines, Foundation._Foundation, Foundation._inlines, AppKit._AppKit, AppKit._inlines, Quartz.CoreGraphics._callbacks, Quartz.CoreGraphics._doubleindirect, Quartz.CoreGraphics._sortandmap, Quartz.CoreGraphics._coregraphics, Quartz.CoreGraphics._inlines, Quartz.ImageKit._imagekit, Quartz.CoreVideo._CVPixelBuffer, Quartz.QuartzCore._quartzcore, Quartz.PDFKit._PDFKit, Quartz.QuickLookUI._QuickLookUI (total: 21)
zsh: segmentation fault  $VIRTUAL_ENV/bin/python -X faulthandler $VIRTUAL_ENV/bin/streamlit run streamlit.py
jeffhaskin commented 16 hours ago

I was able to get it to launch by opening venv/lib/python3.12/site-packages/keyboard/_darwinkeyboard.py and commenting out line 134, but that will probably break stuff so I don't think that's a fix. I'll test it but I don't know what will stop working.