I frequently use ray for distributed computing. For most libraries, I can get away with using pip under the following shell.nix:
let
pkgs = import <nixpkgs> {};
in
pkgs.mkShell {
buildInputs = (with pkgs.python3.pkgs; [
pip
setuptools
]) ++ (with pkgs ; [
cmake
]);
shellHook = ''
alias pip="PIP_PREFIX='$(pwd)/_build/pip_packages' TMPDIR='$HOME' \pip"
export PYTHONPATH="$(pwd)/_build/pip_packages/lib/python3.7/site-packages:$PYTHONPATH"
export TMPDIR=$HOME/.cache
export PATH="$(pwd)/_build/pip_packages/bin:$PATH"
unset SOURCE_DATE_EPOCH
'';
}
However, when I attempt to use ray after pip install ray
, I get the following error:
Python 3.7.7 (default, Mar 10 2020, 06:34:06)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ray
>>> ray.init()
2020-04-30 20:40:38,683 INFO resource_spec.py:212 -- Starting Ray with 8.15 GiB memory available for workers and up to 4.09 GiB for objects. You can adjust these settings with ray.init(memory=<bytes>, object_store_memory=<bytes>).
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/worker.py", line 750, in init
ray_params=ray_params)
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/node.py", line 164, in __init__
self.start_head_processes()
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/node.py", line 627, in start_head_processes
self.start_redis()
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/node.py", line 451, in start_redis
fate_share=self.kernel_fate_share)
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/services.py", line 757, in start_redis
fate_share=fate_share)
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/services.py", line 931, in _start_redis_instance
fate_share=fate_share)
File "/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/services.py", line 502, in start_ray_process
preexec_fn=preexec_fn if sys.platform != "win32" else None)
File "/nix/store/vs4vj1yzqj1bkcqkf3b6sxm6jfy1gb4j-python3-3.7.7/lib/python3.7/subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "/nix/store/vs4vj1yzqj1bkcqkf3b6sxm6jfy1gb4j-python3-3.7.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/core/src/ray/thirdparty/redis/src/redis-server': '/home/mjlbach/Repositories/interactive_physics/_build/pip_packages/lib/python3.7/site-packages/ray/core/src/ray/thirdparty/redis/src/redis-server'
To clarify, the binary is located there, but it does not successfully execute.
I’m guessing this is an issue related to the bundled redis. I’m not really sure where to start. There’s an open packaging issue, but I was hoping there was a way to run this via nix-shell. Package request: ray (python package) · Issue #72175 · NixOS/nixpkgs · GitHub