:warning: This repository contains the old (yet to be deprecated) way of using ROS+conda. As of Feb 2021 you are advised to use the RoboStack ROS Conda packages instead (see this blog post). This wrapper is left here as a fallback for when packages you need are not yet available on the RobotStack. |
---|
This wrapper solves some known problems/conflicts you might experience while trying to use ROS Kinetic/Melodic/Noetic inside a Conda environment (see this ROS topic).
Clone the repository to your user home directory and cd into the .ros_conda_wrapper
folder.
git clone https://github.com/rickstaa/.ros_conda_wrapper.git
cd .ros_conda_wrapper
install.sh
script to install the ROS Conda wrapper.For the manual installation instructions see this issue.
To uninstall the ROS Conda wrapper run the uninstall.sh
script before removing the .ros_conda_wrapper
repository.
All of the original conda
commands work as expected. Additionally, a --ros-wrapper
command has been added. This command takes the following options:
activate
: Activates the ROS Conda wrapper.deactivate
: Deactivates the ROS Conda wrapper.init <CONDA_ENVIRONMENT>
: Initializes a given Conda environment to work with ROS.deinit <CONDA_ENVIRONMENT>
: De-initializes a given ROS Conda environment to work.-h, --help
: Displays usage information.-v, --version
: ROS Conda wrapper version.-s, --show-settings
: Shows the current settings.:information_source: The conda --ros-wrapper init
command does not create the environment itself. It only performs some actions such that ROS will work inside a python 3 Conda environment.
The following commands can be used to make a Conda environment ROS compatible:
conda create -n example_env python==3.6
conda --ros-wrapper activate
conda --ros-wrapper init example_env
conda activate example_env
Please note that this command installs the bare minimum of packages required to run ROS inside a Conda environment. If you need additional ROS packages, you can install them using the regular conda install <PACKAGE_NAME>
command. Check the Conda package repository to see if they are available for CONDA.
The following commands can be used to transform a ROS Conda Wrapper environment back to a normal Conda environment:
conda --ros-wrapper deinit example_env
conda --ros-wrapper deactivate
The ROS Conda wrapper adds the following environment variables:
ROS_CONDA_WRAPPER
: Specifies whether the ROS Conda wrapper is installed.ROS_CONDA_WRAPPER_ACTIVE
: Specifies whether the ROS Conda wrapper is activated.ROS_CONDA_WRAPPER_ERROR
: Anaconda is not initiated or installed.The .conda_wrapper
script creates an alias which wraps the original activate
and deactivate
Conda executable arguments. Following this wrapper modifies the PATH
and PYTHONPATH
such that the right python binaries are used. Additionally, the conda rosinit <NAME_OF_YOUR_ENVIRONMENT>
command can be used to set up an environment in such a way that ROS works inside the environment. This is done by installing some additional python packages ROS needs (see this blog post by @wolfv).
ROS Noetic was build for python3 and therefore does not support python2 packages.
ROS Melodic was build for python2 and therefore in the past did not support python3. Currently all the main ROS Melodic packages have been ported to support python3. You might however still encounter third-party packages which do not support python3.
ROS kinetic does not support python3. Further, there are no plans to port the ROS kinetic python2 packages too python3 (see ROS REP 3).
Please feel free to open an issue if you run into problems or have suggestions.
Feel free to open an issue if you have ideas on how to make this GitHub action better or if you want to report a bug! All contributions are welcome. rocket Please consult the contribution guidelines for more information.