mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
parent
9c81a97fd9
commit
7c1934dc40
1 changed files with 25 additions and 16 deletions
|
@ -11,19 +11,25 @@ def _configure_system():
|
|||
|
||||
"""Wraps system configuration to avoid 'leaking' variables into ray."""
|
||||
|
||||
# MUST add pickle5 to the import path because it will be imported by some
|
||||
# raylet modules.
|
||||
# Sanity check pickle5 if it has been installed.
|
||||
if "pickle5" in sys.modules:
|
||||
if sys.version_info >= (3, 8):
|
||||
logger.warning(
|
||||
"Package pickle5 becomes unnecessary in Python 3.8 and above. "
|
||||
"Its presence may confuse libraries including Ray. "
|
||||
"Please uninstall the package."
|
||||
)
|
||||
|
||||
import pkg_resources
|
||||
|
||||
try:
|
||||
version_info = pkg_resources.require("pickle5")
|
||||
version = tuple(int(n) for n in version_info[0].version.split("."))
|
||||
if version < (0, 0, 10):
|
||||
raise ImportError(
|
||||
"You are using an old version of pickle5 "
|
||||
"that leaks memory, please run "
|
||||
"'pip install pickle5 -U' to upgrade"
|
||||
logger.warning(
|
||||
"Although not used by Ray, a version of pickle5 that leaks memory "
|
||||
"is found in the environment. Please run 'pip install pickle5 -U' "
|
||||
"to upgrade."
|
||||
)
|
||||
except pkg_resources.DistributionNotFound:
|
||||
logger.warning(
|
||||
|
@ -34,6 +40,19 @@ def _configure_system():
|
|||
"previous versions may leak memory."
|
||||
)
|
||||
|
||||
# MUST add pickle5 to the import path because it will be imported by some
|
||||
# raylet modules.
|
||||
#
|
||||
# When running Python version < 3.8, Ray needs to use pickle5 instead of
|
||||
# Python's built-in pickle. Add the directory containing pickle5 to the
|
||||
# Python path so that we find the pickle5 version packaged with Ray and
|
||||
# not a pre-existing pickle5.
|
||||
if sys.version_info < (3, 8):
|
||||
pickle5_path = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), "pickle5_files"
|
||||
)
|
||||
sys.path.insert(0, pickle5_path)
|
||||
|
||||
# Check that grpc can actually be imported on Apple Silicon. Some package
|
||||
# managers (such as `pip`) can't properly install the grpcio library yet,
|
||||
# so provide a proactive error message if that's the case.
|
||||
|
@ -57,16 +76,6 @@ def _configure_system():
|
|||
)
|
||||
os.environ["OMP_NUM_THREADS"] = "1"
|
||||
|
||||
# When running Python version < 3.8, Ray needs to use pickle5 instead of
|
||||
# Python's built-in pickle. Add the directory containing pickle5 to the
|
||||
# Python path so that we find the pickle5 version packaged with Ray and
|
||||
# not a pre-existing pickle5.
|
||||
if sys.version_info < (3, 8):
|
||||
pickle5_path = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), "pickle5_files"
|
||||
)
|
||||
sys.path.insert(0, pickle5_path)
|
||||
|
||||
# Importing psutil & setproctitle. Must be before ray._raylet is
|
||||
# initialized.
|
||||
thirdparty_files = os.path.join(
|
||||
|
|
Loading…
Add table
Reference in a new issue