Skip to content

Commit a79ca10

Browse files
committed
optimize the script for safer behavior
1 parent 41a6f21 commit a79ca10

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

Host_Setup/RoboStack/ros_conda_install_unix.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -e
4+
35
# define color
46
RED='\033[0;31m'
57
GREEN='\033[0;32m'
@@ -72,7 +74,7 @@ else
7274
echo -e "${BLUE}Found Conda in $CONDA_EXE${NC}, install Mamba to base environment"
7375
eval "$($CONDA_EXE shell.bash hook)"
7476
conda activate base
75-
conda install mamba -c conda-forge --yes
77+
conda install -n base mamba -c conda-forge --yes
7678
mamba init --all
7779

7880
# manually enable mamba
@@ -102,9 +104,9 @@ echo -e "${BLUE}Finish Settting up RoboStack Env${NC}"
102104

103105
conda activate ros_base
104106

105-
mamba install compilers cmake pkg-config make ninja -c conda-forge --override-channels --yes
107+
mamba install -n ros_base compilers cmake pkg-config make ninja -c conda-forge --override-channels --yes
106108

107-
mamba install catkin_tools -c conda-forge -c robostack -c robostack-experimental --yes
109+
mamba install -n ros_base catkin_tools -c conda-forge -c robostack -c robostack-experimental --yes
108110

109111
# reload environment to activate required scripts before running anything
110112
# on Windows, please restart the Anaconda Prompt / Command Prompt!
@@ -113,13 +115,13 @@ conda activate ros_base
113115

114116

115117
# if you want to use rosdep, also do:
116-
mamba install rosdep -c conda-forge -c robostack -c robostack-experimental --yes
118+
mamba install -n ros_base rosdep -c conda-forge -c robostack -c robostack-experimental --yes
117119
rosdep init # note: do not use sudo!
118120
rosdep update
119121

120122
echo -e "${BLUE}Install Dependency${NC}"
121123

122-
mamba install numpy scipy matplotlib networkx shapely jupyter notebook -c conda-forge --yes
124+
mamba install -n ros_base numpy scipy matplotlib networkx shapely jupyter notebook -c conda-forge --yes
123125

124126

125127
echo -e "${BLUE}Install PySpline${NC}"
@@ -128,7 +130,7 @@ if [[ $OS == 'Darwin' ]]; then
128130
if [[ $ARCH == 'arm64' ]]; then
129131
echo -e "${GREEN} You are using Mac OS with Apple Silicon${NC}"
130132
# this avoid segfault when importing hppfcl
131-
mamba install eigenpy=2.7.10 --yes -c conda-forge
133+
mamba install -n ros_base eigenpy=2.7.10 --yes -c conda-forge
132134
pip install osx_arm/pyspline-1.5.2-py3-none-any.whl
133135
elif [[ $ARCH == 'x86_64' ]]; then
134136
echo -e "${GREEN} You are using Mac OS with X86${NC}"
@@ -159,10 +161,10 @@ fi
159161

160162
echo -e "${BLUE}Install Jax${NC}"
161163
# Instal Jax https://github.com/google/jax#conda-installation
162-
mamba install jax=0.3.22 'jaxlib=0.3.22=cpu*' -c conda-forge --yes
164+
mamba install -n ros_base jax=0.3.22 'jaxlib=0.3.22=cpu*' -c conda-forge --yes
163165

164166
echo -e "${BLUE}Install Hpp-FCL${NC}"
165167

166-
mamba install -c conda-forge hpp-fcl --yes
168+
mamba install -n ros_base -c conda-forge hpp-fcl --yes
167169

168170
echo -e "${Green}Finished! Reopen a new terminal to see if everything works. ${NC}"

Host_Setup/RoboStack/ros_conda_install_unix_new.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -e # exit on error
4+
35
# define color
46
RED='\033[0;31m'
57
GREEN='\033[0;32m'
@@ -70,7 +72,7 @@ else
7072
echo -e "${BLUE}Found Conda in $CONDA_EXE${NC}, install Mamba to base environment"
7173
eval "$($CONDA_EXE shell.bash hook)"
7274
conda activate base
73-
conda install mamba -c conda-forge --yes
75+
conda install -n base mamba -c conda-forge --yes
7476
mamba init --all
7577

7678
# manually enable mamba
@@ -101,9 +103,9 @@ echo -e "${BLUE}Finish Settting up RoboStack Env${NC}"
101103

102104
conda activate ros_base2
103105

104-
mamba install compilers cmake pkg-config make ninja -c conda-forge --override-channels --yes
106+
mamba install -n ros_base2 compilers cmake pkg-config make ninja -c conda-forge --override-channels --yes
105107

106-
mamba install catkin_tools -c conda-forge -c robostack-staging --yes
108+
mamba install -n ros_base2 catkin_tools -c conda-forge -c robostack-staging --yes
107109

108110

109111
# reload environment to activate required scripts before running anything
@@ -112,21 +114,21 @@ conda deactivate
112114
conda activate ros_base2
113115

114116
# if you want to use rosdep, also do:
115-
mamba install rosdep -c conda-forge -c robostack-staging --yes
117+
mamba install -n ros_base2 rosdep -c conda-forge -c robostack-staging --yes
116118
rosdep init # note: do not use sudo!
117119
rosdep update
118120

119121
echo -e "${BLUE}Install Dependency${NC}"
120122

121-
mamba install numpy scipy matplotlib jupyter notebook networkx shapely -c conda-forge --yes
123+
mamba install -n ros_base2 numpy scipy matplotlib jupyter notebook networkx shapely -c conda-forge --yes
122124

123125
echo -e "${BLUE}Install PySpline${NC}"
124126
# Mac OS
125127
if [[ $OS == 'Darwin' ]]; then
126128
if [[ $ARCH == 'arm64' ]]; then
127129
echo -e "${GREEN} You are using Mac OS with Apple Silicon${NC}"
128130
# this avoid segfault when importing hppfcl
129-
# mamba install eigenpy=2.7.10 --yes -c conda-forge
131+
# mamba install -n ros_base2 eigenpy=2.7.10 --yes -c conda-forge
130132
pip install osx_arm/pyspline-1.5.2-py3-none-any.whl
131133
elif [[ $ARCH == 'x86_64' ]]; then
132134
echo -e "${GREEN} You are using Mac OS with X86${NC}"
@@ -157,10 +159,10 @@ fi
157159

158160
echo -e "${BLUE}Install Jax${NC}"
159161
# Instal Jax https://github.com/google/jax#conda-installation
160-
mamba install jax=0.4.2 'jaxlib=0.4.2=cpu*' -c conda-forge --yes
162+
mamba install -n ros_base2 jax=0.4.2 'jaxlib=0.4.2=cpu*' -c conda-forge --yes
161163

162164
echo -e "${BLUE}Install Hpp-FCL${NC}"
163165

164-
mamba install -c conda-forge hpp-fcl --yes
166+
mamba install -n ros_base2 -c conda-forge hpp-fcl --yes
165167

166168
echo -e "${Green}Finished! Reopen a new terminal to see if everything works. ${NC}"

0 commit comments

Comments
 (0)