ami-iit / training-conda-robotics

A repo containing training material related to the use of Conda in robotics context.
MIT License
9 stars 1 forks source link

iCub-CRIS training 2021/06/10 #2

Open traversaro opened 3 years ago

traversaro commented 3 years ago

A first run of the traning based on the material on this repo will be done on 2021/06/10 on IIT. The slides used will be: 2021-06-09-conda-for-scientific-robotics-software-research-and-development.pdf

traversaro commented 3 years ago

Training done, notes:

traversaro commented 3 years ago

@HosameldinMohamed @isorrentino can you report the problems you were having?

traversaro commented 3 years ago

@Giulero feel free to report the zsh problem.

HosameldinMohamed commented 3 years ago

@HosameldinMohamed @isorrentino can you report the problems you were having?

@traversaro what we did after creating the environment and installing icub-models and gazebo-yarp-plugins is open 2 terminals, activate the environment in both run yarpserver in one of them and gazebo in the other one.

Gazebo crashes and gives this error

 >> gazebo --verbose
Gazebo multi-robot simulator, version 11.5.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 11.5.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.240.2.33
[Err] [server_main.cc:57] Ogre Error:ItemIdentityException: Resource with the name Console already exists. in ResourceManager::add at /home/conda/feedstock_root/build_artifacts/ogre_1612037790705/work/OgreMain/src/OgreResourceManager.cpp (line 157)

But this is not producible every time I try it. After the training I've tried it many times. In some times Gazebo was starting normally.

Note: I have already Gazebo installed from the source.

traversaro commented 3 years ago

Thanks @HosameldinMohamed ! Two comments:

traversaro commented 3 years ago

@drdanz reported that it would be useful to know what Miniconda and mamba is. The latter explanation will be necessary especially if we switch to use mamba in the instructions.

traversaro commented 3 years ago

Thinkg to add:

traversaro commented 3 years ago

Link to the video registration: https://youtu.be/DF2aZa1GhYo .

Giulero commented 3 years ago

@Giulero feel free to report the zsh problem.

@traversaro sure!

When I type conda activate robenv (but also with base) I get this output:

pathremove:5: bad substitution
pathremove:5: bad substitution
pathremove:5: bad substitution

If I type it again, in the same terminal (I guess it calls the reactivate command):

pathremove:5: bad substitution
pathremove:5: bad substitution
pathremove:5: bad substitution
pathappend:3: bad substitution
pathappend:3: bad substitution
pathappend:3: bad substitution

Maybe the issue comes from the lines added in the .zshrc:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/icublap127/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/icublap127/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/home/icublap127/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/icublap127/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

and

conda() {
    if [ "$#" -lt 1 ]; then
        "$CONDA_EXE" $_CE_M $_CE_CONDA
    else
        \local cmd="$1"
        shift
        case "$cmd" in
            activate|deactivate)
                __conda_activate "$cmd" "$@"
                ;;
            install|update|upgrade|remove|uninstall)
                CONDA_INTERNAL_OLDPATH="${PATH}"
                __add_sys_prefix_to_path
                "$CONDA_EXE" $_CE_M $_CE_CONDA "$cmd" "$@"
                \local t1=$?
                PATH="${CONDA_INTERNAL_OLDPATH}"
                if [ $t1 = 0 ]; then
                    __conda_reactivate
                else
                    return $t1
                fi
                ;;
            *)
                CONDA_INTERNAL_OLDPATH="${PATH}"
                __add_sys_prefix_to_path
                "$CONDA_EXE" $_CE_M $_CE_CONDA "$cmd" "$@"
                \local t1=$?
                PATH="${CONDA_INTERNAL_OLDPATH}"
                return $t1
                ;;
        esac
    fi
}

present in miniconda3/etc/profile.d/conda.sh, more precisely __conda_activate and __conda_reactivate.

__conda_activate is defined as:

__conda_activate() {
    if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
        # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
        # after conda updated to >= 4.4. See issue #6173.
        PS1="$CONDA_PS1_BACKUP"
        \unset CONDA_PS1_BACKUP
    fi

    \local cmd="$1"
    shift
    \local ask_conda
    CONDA_INTERNAL_OLDPATH="${PATH}"
    __add_sys_prefix_to_path
    ask_conda="$(PS1="$PS1" "$CONDA_EXE" $_CE_M $_CE_CONDA shell.posix "$cmd" "$@")" || \return $?
    rc=$?
    PATH="${CONDA_INTERNAL_OLDPATH}"
    \eval "$ask_conda"
    if [ $rc != 0 ]; then
        \export PATH
    fi
    __conda_hashr
}
HosameldinMohamed commented 3 years ago

@traversaro

  • Did you removed the sourcing of setup.sh of the robotology-superbuild compiled with apt dependencies as suggested by @GiulioRomualdi ?

Not when i wrote this https://github.com/dic-iit/training-conda-robotics/issues/2#issuecomment-858548856.

  • Can you try to remove the ~/.gazebo directory, as this already created problem in the past, and see if the problem disappears (see osrf/gazebo#2604)?

Doing both requests doesn't solve it. Again, some times Gazebo starts normally and others the error happens.

Note: I am not sure if it's relevant, but I am not using Ubuntu based OS. I am using Manjaro!

traversaro commented 3 years ago

@traversaro

  • Did you removed the sourcing of setup.sh of the robotology-superbuild compiled with apt dependencies as suggested by @GiulioRomualdi ?

Not when i wrote this #2 (comment).

  • Can you try to remove the ~/.gazebo directory, as this already created problem in the past, and see if the problem disappears (see osrf/gazebo#2604)?

Doing both requests doesn't solve it. Again, some times Gazebo starts normally and others the error happens.

Note: I am not sure if it's relevant, but I am not using Ubuntu based OS. I am using Manjaro!

Ok, this bug officially graduated to its own discussion: https://github.com/conda-forge/gazebo-feedstock/issues/81 . Please continue the discussion there, thanks!

traversaro commented 3 years ago

Just to clarify, if this @HosameldinMohamed problem was not fixed by removing the superbuild's setup.sh, probably it is a problem different from the problem of @isorrentino or @GiulioRomualdi ?

traversaro commented 3 years ago

@Giulero feel free to report the zsh problem.

@traversaro sure!

Thanks! This error are similar to the one experienced by @lrapetti in https://github.com/robotology/robotology-superbuild/issues/779, let's continue the discussion there. My the way, there is any reason why you install miniconda instead of miniforge as suggested in the docs in this repo and in the robotology-superbuild documentation?

Giulero commented 3 years ago

there is any reason why you install miniconda instead of miniforge as suggested in the docs in this repo

Not really. I was just using miniconda before the training. It's time for a change!

traversaro commented 3 years ago

I just tested zsh after the fixes in https://github.com/robotology/robotology-superbuild/pull/810 and everything seems to work, no pathremove:5: bad substitution error anymore. I just fixed a bit the installation guide in https://github.com/robotology/robotology-superbuild/pull/839, zsh users feel free to review it @lrapetti @Giulero .

traversaro commented 3 years ago

Switch to mamba for docs and presentation: the slow speed of conda is problematic for interactive presentation

This will be fixed by https://github.com/robotology/robotology-superbuild/pull/847 .

traversaro commented 3 years ago

For several users it was not possible to start Gazebo installed from conda @HosameldinMohamed @isorrentino . @GiulioRomualdi then suggested to remove the setup.sh from robotology-superbuild installed with apt, and probably we need to add this in the docs.

This are actually two distinct problem:

traversaro commented 3 years ago
* Document that command prompt is the suggested shell on Windows due to Gazebo and ROS problems

Will be fixed by https://github.com/robotology/robotology-superbuild/pull/850 .