mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 12:49:05 +08:00
Stop vendoring pyarrow (#7233)
This commit is contained in:
@@ -38,24 +38,8 @@ if os.path.exists(so_path):
|
||||
from ctypes import CDLL
|
||||
CDLL(so_path, ctypes.RTLD_GLOBAL)
|
||||
|
||||
# MUST import ray._raylet before pyarrow to initialize some global variables.
|
||||
# It seems the library related to memory allocation in pyarrow will destroy the
|
||||
# initialization of grpc if we import pyarrow at first.
|
||||
# NOTE(JoeyJiang): See https://github.com/ray-project/ray/issues/5219 for more
|
||||
# details.
|
||||
import ray._raylet # noqa: E402
|
||||
|
||||
if "pyarrow" in sys.modules:
|
||||
raise ImportError("Ray must be imported before pyarrow because Ray "
|
||||
"requires a specific version of pyarrow (which is "
|
||||
"packaged along with Ray).")
|
||||
|
||||
# Add the directory containing pyarrow to the Python path so that we find the
|
||||
# pyarrow version packaged with ray and not a pre-existing pyarrow.
|
||||
pyarrow_path = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), "pyarrow_files")
|
||||
sys.path.insert(0, pyarrow_path)
|
||||
|
||||
# See https://github.com/ray-project/ray/issues/131.
|
||||
helpful_message = """
|
||||
|
||||
@@ -64,37 +48,6 @@ If you are using Anaconda, try fixing this problem by running:
|
||||
conda install libgcc
|
||||
"""
|
||||
|
||||
try:
|
||||
import pyarrow # noqa: F401
|
||||
|
||||
# pyarrow is not imported inside of _raylet because of the issue described
|
||||
# above. In order for Cython to compile _raylet, pyarrow is set to None
|
||||
# in _raylet instead, so we give _raylet a real reference to it here.
|
||||
# We first do the attribute checks here so that building the documentation
|
||||
# succeeds without fully installing ray..
|
||||
# TODO(edoakes): Fix this.
|
||||
if hasattr(ray, "_raylet") and hasattr(ray._raylet, "pyarrow"):
|
||||
ray._raylet.pyarrow = pyarrow
|
||||
except ImportError as e:
|
||||
if ((hasattr(e, "msg") and isinstance(e.msg, str)
|
||||
and ("libstdc++" in e.msg or "CXX" in e.msg))):
|
||||
# This code path should be taken with Python 3.
|
||||
e.msg += helpful_message
|
||||
elif (hasattr(e, "message") and isinstance(e.message, str)
|
||||
and ("libstdc++" in e.message or "CXX" in e.message)):
|
||||
# This code path should be taken with Python 2.
|
||||
condition = (hasattr(e, "args") and isinstance(e.args, tuple)
|
||||
and len(e.args) == 1 and isinstance(e.args[0], str))
|
||||
if condition:
|
||||
e.args = (e.args[0] + helpful_message, )
|
||||
else:
|
||||
if not hasattr(e, "args"):
|
||||
e.args = ()
|
||||
elif not isinstance(e.args, tuple):
|
||||
e.args = (e.args, )
|
||||
e.args += (helpful_message, )
|
||||
raise
|
||||
|
||||
from ray._raylet import (
|
||||
ActorCheckpointID,
|
||||
ActorClassID,
|
||||
|
||||
Reference in New Issue
Block a user