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

[Air] Missing pyarrow module causes import issues #37656

Closed
pclay614 opened this issue Jul 21, 2023 · 3 comments · Fixed by #37670
Closed

[Air] Missing pyarrow module causes import issues #37656

pclay614 opened this issue Jul 21, 2023 · 3 comments · Fixed by #37670
Assignees
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@pclay614
Copy link

What happened + What you expected to happen

Importing tune from ray should work and not fail.

This is due to the inclusion of this line, which assumes pyarrow imported successfully.

Versions / Dependencies

python: 3.8.10
os: Ubuntu 20.04.5
ray: 2.6.0

Reproduction script

  1. Create a virtualenv
  2. pip install ray==2.6.0
  3. Start a python3 interactive interpreter
  4. import ray (works)
  5. from ray import tune (fails)
Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ray
>>> from ray import tune
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/me/.virtualenvs/test_ray/lib/python3.8/site-packages/ray/tune/__init__.py", line 2, in <module>
    from ray.tune.tune import run_experiments, run
  File "/home/me/.virtualenvs/test_ray/lib/python3.8/site-packages/ray/tune/tune.py", line 27, in <module>
    from ray.air import CheckpointConfig
  File "/home/me/.virtualenvs/test_ray/lib/python3.8/site-packages/ray/air/__init__.py", line 1, in <module>
    from ray.air.checkpoint import Checkpoint
  File "/home/me/.virtualenvs/test_ray/lib/python3.8/site-packages/ray/air/checkpoint.py", line 22, in <module>
    from ray.air._internal.remote_storage import (
  File "/home/me/.virtualenvs/test_ray/lib/python3.8/site-packages/ray/air/_internal/remote_storage.py", line 142, in <module>
    _cached_fs: Dict[tuple, Tuple[float, pyarrow.fs.FileSystem]] = {}
AttributeError: 'NoneType' object has no attribute 'fs'

Issue Severity

Medium: It is a significant difficulty but I can work around it.

@pclay614 pclay614 added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Jul 21, 2023
@pclay614
Copy link
Author

pclay614 commented Jul 21, 2023

Suggestion. It seems that the import is being allowed to fail, so it should be allowed to fail gracefully.

try:
    import pyarrow
    import pyarrow.fs

except (ImportError, ModuleNotFoundError):
    pyarrow_fs = type("", (), {"FileSystem": None})
    pyarrow = type("", (), {"fs": pyarrow_fs})

@richardliaw
Copy link
Contributor

cc @matthewdeng @pcmoritz @justinvyu we probably want to include a warning message that informs user that they should rerun pip install ray[tune] or ray[air].

@matthewdeng
Copy link
Contributor

Thanks for reporting, I've put up a fix for this here: #37670.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants