mirror of
https://github.com/wassname/ray.git
synced 2026-08-15 12:45:23 +08:00
install setproctitle from pypi instead of building from source
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
This script ensures python files conform to ray's import ordering rules.
|
||||
In particular, we make sure psutil and setproctitle is imported _after_
|
||||
In particular, we make sure psutil is imported _after_
|
||||
importing ray due to our bundling of the two libraries.
|
||||
|
||||
Usage:
|
||||
@@ -22,7 +22,6 @@ def check_import(file):
|
||||
check_to_lines = {
|
||||
"import ray": -1,
|
||||
"import psutil": -1,
|
||||
"import setproctitle": -1
|
||||
}
|
||||
|
||||
with io.open(file, "r", encoding="utf-8") as f:
|
||||
@@ -41,7 +40,7 @@ def check_import(file):
|
||||
line) and check_to_lines[check] == -1:
|
||||
check_to_lines[check] = i
|
||||
|
||||
for import_lib in ["import psutil", "import setproctitle"]:
|
||||
for import_lib in ["import psutil"]:
|
||||
if check_to_lines[import_lib] != -1:
|
||||
import_psutil_line = check_to_lines[import_lib]
|
||||
import_ray_line = check_to_lines["import ray"]
|
||||
|
||||
+1
-1
@@ -291,7 +291,7 @@ else
|
||||
fi
|
||||
|
||||
# Ensure import ordering
|
||||
# Make sure that for every import psutil; import setproctitle
|
||||
# Make sure that for every import psutil
|
||||
# There's a import ray above it.
|
||||
|
||||
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE:-python}
|
||||
|
||||
@@ -333,7 +333,7 @@ install_dependencies() {
|
||||
install_node
|
||||
fi
|
||||
|
||||
CC=gcc pip install psutil setproctitle --target="${WORKSPACE_DIR}/python/ray/thirdparty_files"
|
||||
CC=gcc pip install psutil --target="${WORKSPACE_DIR}/python/ray/thirdparty_files"
|
||||
}
|
||||
|
||||
install_dependencies "$@"
|
||||
|
||||
@@ -340,32 +340,3 @@ that you've cloned the git repository.
|
||||
.. code-block:: bash
|
||||
|
||||
python -m pytest -v python/ray/tests/test_mini.py
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
If importing Ray (``python3 -c "import ray"``) in your development clone results
|
||||
in this error:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
Traceback (most recent call last):
|
||||
File "<string>", line 1, in <module>
|
||||
File ".../ray/python/ray/__init__.py", line 63, in <module>
|
||||
import ray._raylet # noqa: E402
|
||||
File "python/ray/_raylet.pyx", line 98, in init ray._raylet
|
||||
import ray.memory_monitor as memory_monitor
|
||||
File ".../ray/python/ray/memory_monitor.py", line 9, in <module>
|
||||
import psutil # noqa E402
|
||||
File ".../ray/python/ray/thirdparty_files/psutil/__init__.py", line 159, in <module>
|
||||
from . import _psosx as _psplatform
|
||||
File ".../ray/python/ray/thirdparty_files/psutil/_psosx.py", line 15, in <module>
|
||||
from . import _psutil_osx as cext
|
||||
ImportError: cannot import name '_psutil_osx' from partially initialized module 'psutil' (most likely due to a circular import) (.../ray/python/ray/thirdparty_files/psutil/__init__.py)
|
||||
|
||||
Then you should run the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
rm -rf python/ray/thirdparty_files/
|
||||
python3 -m pip install setproctitle
|
||||
|
||||
@@ -37,7 +37,7 @@ 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.
|
||||
# Importing psutil. Must be before ray._raylet is initialized.
|
||||
thirdparty_files = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), "thirdparty_files")
|
||||
sys.path.insert(0, thirdparty_files)
|
||||
|
||||
@@ -10,15 +10,12 @@ except ImportError:
|
||||
import sys
|
||||
import tempfile
|
||||
import datetime
|
||||
import setproctitle
|
||||
|
||||
import ray
|
||||
import ray.test_utils
|
||||
import ray.cluster_utils
|
||||
|
||||
# NOTE: We have to import setproctitle after ray because we bundle setproctitle
|
||||
# with ray.
|
||||
import setproctitle
|
||||
|
||||
|
||||
def test_caching_actors(shutdown_only):
|
||||
# Test defining actors before ray.init() has been called.
|
||||
|
||||
@@ -10,6 +10,7 @@ import time
|
||||
import numpy as np
|
||||
import pickle
|
||||
import pytest
|
||||
import setproctitle
|
||||
|
||||
import ray
|
||||
import ray.ray_constants as ray_constants
|
||||
@@ -17,7 +18,6 @@ import ray.util.accelerators
|
||||
import ray.cluster_utils
|
||||
import ray.test_utils
|
||||
from ray import resource_spec
|
||||
import setproctitle
|
||||
import subprocess
|
||||
|
||||
from ray.test_utils import (check_call_ray, RayTestTimeoutException,
|
||||
|
||||
@@ -23,6 +23,7 @@ py-spy >= 0.2.0
|
||||
pyyaml
|
||||
redis >= 3.5.0
|
||||
requests
|
||||
setproctitle
|
||||
|
||||
## setup.py extras
|
||||
atari_py
|
||||
|
||||
+2
-1
@@ -143,6 +143,7 @@ install_requires = [
|
||||
"py-spy >= 0.2.0",
|
||||
"pyyaml",
|
||||
"requests",
|
||||
"setproctitle",
|
||||
"redis >= 3.5.0",
|
||||
"opencensus",
|
||||
"prometheus_client >= 0.7.1",
|
||||
@@ -270,7 +271,7 @@ def build(build_python, build_java):
|
||||
# that certain flags will not be passed along such as --user or sudo.
|
||||
# TODO(rkn): Fix this.
|
||||
if not os.getenv("SKIP_THIRDPARTY_INSTALL"):
|
||||
pip_packages = ["psutil", "setproctitle"]
|
||||
pip_packages = ["psutil"]
|
||||
subprocess.check_call(
|
||||
[
|
||||
sys.executable, "-m", "pip", "install", "-q",
|
||||
|
||||
Reference in New Issue
Block a user