Skip to content

Commit b28c078

Browse files
committed
fix for ubuntu22 and venv using system python
1 parent 14ef238 commit b28c078

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/ibm_ray_config/modules/gen2/ray/defaults.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,12 @@ rsync_filter: []
104104
initialization_commands: []
105105

106106
setup_commands:
107-
# Note: if you're developing Ray, you probably want to create an AMI that
108-
# has your Ray repo pre-cloned. Then, you can replace the pip installs
109-
# below with a git checkout <your_sha> (and possibly a recompile).
110-
# - echo 'export PATH="$HOME/anaconda3/envs/tensorflow_p36/bin:$PATH"' >> ~/.bashrc
111-
# Install ray if not present
112-
- sleep 30 && apt update && apt install python3.8 -y && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py
113-
- test -d ~/.venv || (pip install virtualenv && virtualenv -p /usr/bin/python3.8 ~/.venv && echo source ~/.venv/bin/activate >> ~/.bashrc && echo "source ~/.venv/bin/activate" | cat - ~/.bashrc | tee ~/.bashrc)
107+
# Important to note: Ubuntu22 and Ubuntu20 comes with different python versions preinstalled,
108+
# albeit pointed by the same symlink: /usr/bin/python3.
109+
# Also, if running on Ubuntu22 config the needrestart to restart services automatically instead of interactive mode
110+
- find /etc/needrestart/needrestart.conf >/dev/null 2>1 && sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
111+
- apt update && apt install python3-pip -y
112+
- test -d ~/.venv || (pip install virtualenv && virtualenv -p /usr/bin/python3 ~/.venv && echo source ~/.venv/bin/activate >> ~/.bashrc && echo "source ~/.venv/bin/activate" | cat - ~/.bashrc | tee ~/.bashrc)
114113
- source ~/.venv/bin/activate
115114
- pip install ibm-vpc ibm_platform_services ibm_cloud_sdk_core
116115
- apt install libgl1-mesa-glx -y && pip install pandas tabulate gym tensorboardX dm_tree opencv-python transformers torch

0 commit comments

Comments
 (0)