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

[Bug] ProcessLookupError on CLI command from quickstart #7005

Open
fleimgruber opened this issue Jan 18, 2025 · 12 comments
Open

[Bug] ProcessLookupError on CLI command from quickstart #7005

fleimgruber opened this issue Jan 18, 2025 · 12 comments

Comments

@fleimgruber
Copy link

fleimgruber commented Jan 18, 2025

Describe the bug

Python traceback after CLI command from quickstart.

To Reproduce

  1. openbb
  2. equity RET
  3. price RET
  4. historical --symbol SPY --start_date 2024-01-01 --provider yfinance

Screenshots

2025 Jan 18, 06:41 (🦋) /equity/price/ $ historical --symbol SPY --start_date 2024-01-01 --provider yfinance


2025 Jan 18, 06:41 (🦋) /equity/price/ $ Exception in callback Process.terminate()
handle: <Handle Process.terminate()>
Traceback (most recent call last):
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/subprocess.py", line 140, in terminate
    self._transport.terminate()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/base_subprocess.py", line 149, in terminate
    self._check_proc()eturn to previous menu    [e] exit the program    [cmd -h] see usage and available options    Price (cmd/menu) Documentation
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/base_subprocess.py", line 142, in _check_proc
    raise ProcessLookupError()
ProcessLookupError
Exception in callback Process.kill()
handle: <Handle Process.kill()>
Traceback (most recent call last):
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/subprocess.py", line 143, in kill
    self._transport.kill()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/base_subprocess.py", line 153, in kill
    self._check_proc()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/base_subprocess.py", line 142, in _check_proc
    raise ProcessLookupError()
ProcessLookupError
Exception in thread Thread-3 (run):
Traceback (most recent call last):
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/site-packages/pywry/core.py", line 349, in run_backend
    await self.runner.stdin.drain()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/streams.py", line 371, in drain
    await self._protocol._drain_helper()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/streams.py", line 167, in _drain_helper
    raise ConnectionResetError('Connection lost')
ConnectionResetError: Connection lost

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/site-packages/pywry/core.py", line 384, in run
    asyncio.run(self.run_backend())
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/site-packages/pywry/core.py", line 358, in run_backend
    await self.run_backend()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/site-packages/pywry/core.py", line 339, in run_backend
    await self.runner.stdin.drain()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/streams.py", line 371, in drain
    await self._protocol._drain_helper()
  File "/home/pbz/micromamba/envs/obb/lib/python3.10/asyncio/streams.py", line 167, in _drain_helper
    raise ConnectionResetError('Connection lost')
ConnectionResetError: Connection lost

Desktop (please complete the following information):

  • OS: NixOS 24.11
  • Python version: 3.10

Additional context

Installed from source using micromamba for env creation and installed via python dev_install.py -e --cli.

@deeleeramone
Copy link
Contributor

deeleeramone commented Jan 20, 2025

Hi, thanks for this. We can't directly support this OS, specifically, but did you also install the Linux-specific components?

https://docs.openbb.co/cli/installation#linux-requirements

Additionally, CLI is not really suitable for VMs or Docker.

@fleimgruber
Copy link
Author

Thanks for checking back.

I would look into it myself, but I don't get any promising lead from the traceback - I would not even know where to begin, probably starting from the pywry dependency? Regarding Linux-specific components: Yes, Rust and Webkitgtk are both installed system-wide.

CLI is not really suitable for VMs or Docker.

Thanks for mentioning. Just to be clear, I am not running this in a VM or Docker.

@deeleeramone
Copy link
Contributor

It's going to be something related to PyWry - window creation - or environment contamination via $PATH priorities of Python libraries and executables

@qmarsun
Copy link

qmarsun commented Feb 9, 2025

@fleimgruber
Could you get the stacktrace the run with strace -f -o srace.out then compressed. just curious to know
what system library are getting loaded during this python error.

is this https://nixos.org/blog/announcements/2024/nixos-2411/ ?

what version Linux/MacOS/Windows(WSL2)/Docker ?

Image

@fleimgruber
Copy link
Author

fleimgruber commented Feb 15, 2025

@qmarsun Where should I upload the compressed strace output (~200 KB)?

is this https://nixos.org/blog/announcements/2024/nixos-2411/ ?

Yep, that's it.

what version Linux/MacOS/Windows(WSL2)/Docker ?

FWIW, GNU/Linux kernel 6.6.75

edit: I reproduced this with v4.4.0 of openbb_platform.
edit: I reproduced this also with openbb_cli/cli.py directly.

@deeleeramone
Copy link
Contributor

@fleimgruber, what version of libwebkit2 do you have installed, libwebkit2gtk-4.1-dev?

If 4.1, can you try downgrading to 4.0?

@fleimgruber
Copy link
Author

fleimgruber commented Feb 17, 2025

Looking at https://search.nixos.org/packages?channel=24.11&from=0&size=50&sort=relevance&type=packages&query=webkitgtk I see both 4.0 and 4.1 as different ABI versions. I explicitly installed webkitgtk_4_0 but still see both ABIs installed on my system - the package version (2.46.6) itself is the same though. I asked on a NixOS community space for support.

@deeleeramone
Copy link
Contributor

Other things to try:

  • A new environment, using venv, where all user site-packages are explicitly excluded.
    • Update pip and setuptools before installing anything.
  • Install the Python interface without CLI, pip install "openbb[all]"
    • If the problem still persists, then webkit probably isn't the issue, more likely involving async - anyio, aiohttp, etc.

@fleimgruber
Copy link
Author

fleimgruber commented Feb 19, 2025

A new environment, using venv, where all user site-packages are explicitly excluded

I am always using tools such as uv or poetry for development and use venvs by default.

Install the Python interface without CLI

How should I reproduce the problem without CLI?

@deeleeramone
Copy link
Contributor

deeleeramone commented Feb 21, 2025

A new environment, using venv, where all user site-packages are explicitly excluded

I am always using tools such as uv or poetry for development and use venvs by default.

Well which is it then?

Image

In any case, it is always possible to include/exclude user site-packages, I'm suggesting ensuring they are strictly excluded from the environment, and packages pulled into the environment are not symlinks.

@fleimgruber
Copy link
Author

fleimgruber commented Feb 21, 2025

Ah, yes that might have been confusing: I tried with micromamba first as I was exactly following the install instructions (and empirically conda tends to work best as a first attempt). When I came back to this later (in #7005 (comment)) I tried with uv (migrating the pyproject.toml from [tool.poetry.dependencies] to the standard [project.dependencies]) and reproduced with uv as I thought it would be a good alternative way to test. Also, I hoped to avoid some conda magic that might have come in as you hinted at.

I tried uv run --prerelease=allow python -s openbb_cli/cli.py which should exclude user site-packages as you suggested, but am facing this error "['SPY']: YFRateLimitError('Too Many Requests. Rate limited. Try after a while.')" at the moment so I am not able to reproduce yet.

@deeleeramone
Copy link
Contributor

I tried uv run --prerelease=allow python -s openbb_cli/cli.py which should exclude user site-packages as you suggested, but am facing this error "['SPY']: YFRateLimitError('Too Many Requests. Rate limited. Try after a while.')" at the moment so I am not able to reproduce yet.

That's an issue with the version of yFinance, you can pip install -U yfinance to install the latest version of that.

Make sure you update your version of pip in any new environment, before installing anything in it.

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

3 participants