tartansandal / conda-bash-completion

Bash completion support for conda
GNU General Public License v3.0
152 stars 7 forks source link

Not working on Ubuntu 21.10 #12

Closed kuntiik closed 2 years ago

kuntiik commented 2 years ago

Hi, I have the following config: Ubuntu 21.10 Kernel 5.15.25 Bash version 5.1.8(1)-release conda list bash-completion -> bash-completion 2.11 0 conda-forge conda-bash-completion 1.5 1 conda-forge source $CONDA_ROOT/etc/profile.d/bash_completion.sh not working

bash -vx $CONDA_ROOT/etc/profile.d/bash_completion.sh # shellcheck shell=sh disable=SC1091,SC2039,SC2166 # Check for interactive bash and that we haven't already been sourced. if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then

# Check for recent enough version of bash.
if [ "${BASH_VERSINFO[0]}" -gt 4 ] ||
    [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then
    [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &&
        . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
    if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
        # Source completion code.
        . /usr/share/bash-completion/bash_completion
    fi
fi

fi

Any suggestions, where the problem is? Thank you.

tartansandal commented 2 years ago

Hi, did you activate your base environment first? There are activation hooks that set everything up, because it turns out to be way more complicated than you might think.

On Wed, 2 Mar 2022, 11:31 pm kuntiik, @.***> wrote:

Hi, I have the following config: Ubuntu 21.10 Kernel 5.15.25 Bash version 5.1.8(1)-release conda list bash-completion -> bash-completion 2.11 0 conda-forge conda-bash-completion 1.5 1 conda-forge source $CONDA_ROOT/etc/profile.d/bash_completion.sh not working

bash -vx $CONDA_ROOT/etc/profile.d/bash_completion.sh

shellcheck shell=sh disable=SC1091,SC2039,SC2166

Check for interactive bash and that we haven't already been sourced.

if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then

Check for recent enough version of bash.

if [ "${BASH_VERSINFO[0]}" -gt 4 ] || [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then

Source completion code.

    . /usr/share/bash-completion/bash_completion
fi

fi

fi

  • '[' 'x5.1.8(1)-release' '!=' x -a x '!=' x -a x = x ']'

Any suggestions, where the problem is? Thank you.

— Reply to this email directly, view it on GitHub https://github.com/tartansandal/conda-bash-completion/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZMOH72DNRHIKBZAVJWYNDU55NRFANCNFSM5PXJ3OLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

tartansandal commented 2 years ago

Hi @kuntiik. Have you had any luck solving your issue?

tartansandal commented 2 years ago

Hi @kuntiik . Having a second look at your comments above and noticed in the output to bash -vx $CONDA_ROOT/etc/profile.d/bash_completion.sh the following line:

...
# Source completion code.
. /usr/share/bash-completion/bash_completion
...

That definitely explains why the completion is not working. There is something odd about your conda installation. The file that gets sourced should be relative to your $CONDA_ROOT. I would expect it to look something like:

...
# Source completion code.
. /home/kal/anaconda3/share/bash-completion/bash_completion
...

unless you have set CONDA_ROOT=/usr which would be very odd and counter to conda's design. With what you have, you are sourcing the system version of bash-completion. The conda version is specially patched to look in some additional places for the completion code, so you need to be sourcing that.

tartansandal commented 2 years ago

Hi @kuntiik. I haven't had any response from you for a while, so I'm going to assume the issue is resolved and can close it. If this is not the case, please feel free to reopen the issue.

kuntiik commented 2 years ago

Hi, sorry been off-grid for a while. The issue is solved. Sadly I can not say what helped me solve this, but it is no longer an issue. Thank You.