Description
Hi!
Thanks for this wrapper. I became aware of this wrapper from one of the ROS Answers posts when I was looking for help with conda and ROS.
I have been running into a few problems. I would appreciate any help you can provide.
System: Mac OS Big Sur 11.2. M1 ARM macbook.
Shell: echo $SHELL
- /bin/zsh
Conda version: Miniforge, v4.9.2
Python version inside conda env: 3.8
ROS version and distribution: ROS2 Foxy. Workspace is inside $HOME directory.
Since the shell is zsh and the code uses bash, I simply changed the occurrences of bash
to zsh
in scripts install.sh
and ros_conda_wrapper_rc
. Please correct me if it is not as simple as renaming.
(base) ➜ .ros_conda_wrapper git:(master) ✗ sh install.sh
-- Installing the ROS Conda wrapper --
ROS Conda wrapper file added to your home directory.
A backup will be made to: /Users/dross/.zshrc-ros_conda_wrapper.bak
sed: illegal option -- -
usage: sed script [-Ealnru] [-i extension] [file ...]
sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]
ros_conda_wrapper_rc file source command installed to your .zshrc file.
Ros Conda wrapper successfully installed.
For this change to become active, you have to open a new terminal.
Note: I have already initialised the Conda environment and added the conda init
command to .zshrc
.
My .zshrc now has these lines -
# >>> ros_conda_wrapper initialize >>>
if [ -f "/Users/dross/.ros_conda_wrapper_rc" ]; then
. "/Users/dross/.ros_conda_wrapper_rc"
fi
# <<< ros_conda_wrapper initialize <<<
And instead of .zprofile
, .bash_profile
has these lines -
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniforge/base/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniforge/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
Upon opening a new shell, I get this -
**_ros_conda_main:31: command not found: dirname
_ros_conda_main:32: command not found: dirname**
WARNING: It appears that anaconda was not initiated before this wrapper was sourced. Please make sure anaconda is initiated in your .zshrc file before running the ros_conda_wrapper.
(base) ➜ ~
In fact, some general commands don't work -
zsh: command not found: ls
(base) ➜ ~ vim
zsh: command not found: nvim
(base) ➜ ~ time
shell 0.13s user 0.11s system 0% cpu 5:11.10 total
children 0.34s user 0.15s system 0% cpu 5:11.10 total
(base) ➜ ~ conda --version
__add_sys_prefix_to_path:6: command not found: dirname
__add_sys_prefix_to_path:7: command not found: dirname
conda 4.9.2
Since the script fails here, --ros-wrapper
argument doesn't work. The consequent steps to activate and initialise with a conda env are also unsuccessful.
Can you please help?
Also, in my limited hacking of your script I saw that wrapper works even with ROS2. Is this correct?
I use ROS2 Foxy, built from source as instructed here.
If not, what further steps should I need to make it work?
Thank you.