Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab completion not working with conda 4.8.3 in Ubuntu 20.04 #9975

Open
1 task
lucacerone opened this issue Jun 2, 2020 · 5 comments
Open
1 task

Tab completion not working with conda 4.8.3 in Ubuntu 20.04 #9975

lucacerone opened this issue Jun 2, 2020 · 5 comments
Labels
stale::recovered [bot] recovered after being marked as stale

Comments

@lucacerone
Copy link

lucacerone commented Jun 2, 2020

I'm submitting a...

  • [ X] bug report
  • feature request

Current Behavior

I followed the steps at https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/enable-tab-completion.html to enable bash tab completion in Ubuntu 20.04.

When I write conda ins and hit tab nothing happens
(I also tried to log out and login)

Because I suspected that the issue could be caused by setting auto_activate_base: False I have tried to activate conda's base environment with

conda activate base

and run manually in the shell

eval "$(register-python-argcomplete conda)"

but even like so tab completion doesn't work.

Note that for other tools using the same mechanism for tab completion e.g. pipx (https://pypi.org/project/pipx/) I have no issues.

For example, in .bashrc file I have

# Enable pipx tab completion
eval "$(register-python-argcomplete pipx)"

and completions works fine for pipx.

Steps to Reproduce

Follow the steps at https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/enable-tab-completion.html
in an Ubuntu 20.04 machine

Expected Behavior

I expect the command to be completed upon hitting TAB.

Environment Information

`conda info`

     active environment : None
            shell level : 0
       user config file : /home/luca/.condarc
 populated config files : /home/luca/.condarc
          conda version : 4.8.3
    conda-build version : not installed
         python version : 3.7.6.final.0
       virtual packages : __glibc=2.31
       base environment : /home/luca/miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/luca/miniconda3/pkgs
                          /home/luca/.conda/pkgs
       envs directories : /home/luca/miniconda3/envs
                          /home/luca/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.3 requests/2.23.0 CPython/3.7.6 Linux/5.4.0-33-generic ubuntu/20.04 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

`conda config --show-sources`

==> /home/luca/.condarc <==
auto_activate_base: False

`conda list --show-channel-urls`

# packages in environment at /home/luca/miniconda3:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
argcomplete               1.11.1                     py_1    defaults
bash-completion           2.10                          1    conda-forge
ca-certificates           2020.4.5.1           hecc5488_0    conda-forge
certifi                   2020.4.5.1       py37hc8dfbb8_0    conda-forge
cffi                      1.14.0           py37h2e261b9_0    defaults
chardet                   3.0.4                 py37_1003    defaults
conda                     4.8.3            py37hc8dfbb8_1    conda-forge
conda-bash-completion     1.5                           1    conda-forge
conda-package-handling    1.6.1            py37h7b6447c_0    defaults
cryptography              2.9.2            py37h1ba5d50_0    defaults
idna                      2.9                        py_1    defaults
importlib-metadata        1.6.0                    py37_0    defaults
importlib_metadata        1.6.0                         0    defaults
ld_impl_linux-64          2.33.1               h53a641e_7    defaults
libedit                   3.1.20181209         hc058e9b_0    defaults
libffi                    3.2.1                hd88cf55_4    defaults
libgcc-ng                 9.1.0                hdf63c60_0    defaults
libstdcxx-ng              9.1.0                hdf63c60_0    defaults
ncurses                   6.2                  he6710b0_1    defaults
openssl                   1.1.1g               h516909a_0    conda-forge
pip                       20.0.2                   py37_3    defaults
pycosat                   0.6.3            py37h7b6447c_0    defaults
pycparser                 2.20                       py_0    defaults
pyopenssl                 19.1.0                   py37_0    defaults
pysocks                   1.7.1                    py37_0    defaults
python                    3.7.6                h0371630_2    defaults
python_abi                3.7                     1_cp37m    conda-forge
readline                  7.0                  h7b6447c_5    defaults
requests                  2.23.0                   py37_0    defaults
ruamel_yaml               0.15.87          py37h7b6447c_0    defaults
setuptools                46.1.3                   py37_0    defaults
six                       1.14.0                   py37_0    defaults
sqlite                    3.31.1               h62c20be_1    defaults
tk                        8.6.8                hbc83047_0    defaults
tqdm                      4.46.0                     py_0    defaults
urllib3                   1.25.8                   py37_0    defaults
wheel                     0.34.2                   py37_0    defaults
xz                        5.2.5                h7b6447c_0    defaults
yaml                      0.1.7                had09818_2    defaults
zipp                      3.1.0                      py_0    defaults
zlib                      1.2.11               h7b6447c_3    defaults

@lucacerone
Copy link
Author

lucacerone commented Jun 2, 2020

If it can be of help, I also tried to increase debugging with bash set -x command.

I opened a new terminal, typed set -x and this the debug of eval "$(register-python-argcomplete conda)"

luca@laptop:~$ eval "$(register-python-argcomplete conda)"
++ register-python-argcomplete conda
+ eval '
# Run something, muting output or redirecting it to the debug stream
# depending on the value of _ARC_DEBUG.
__python_argcomplete_run() {
    if [[ -z "$_ARC_DEBUG" ]]; then
        "$@" 8>&1 9>&2 1>/dev/null 2>&1
    else
        "$@" 8>&1 9>&2 1>&9 2>&1
    fi
}

_python_argcomplete() {
    local IFS=$'\''\013'\''
    local SUPPRESS_SPACE=0
    if compopt +o nospace 2> /dev/null; then
        SUPPRESS_SPACE=1
    fi
    COMPREPLY=( $(IFS="$IFS" \
                  COMP_LINE="$COMP_LINE" \
                  COMP_POINT="$COMP_POINT" \
                  COMP_TYPE="$COMP_TYPE" \
                  _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \
                  _ARGCOMPLETE=1 \
                  _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \
                  __python_argcomplete_run "$1") )
    if [[ $? != 0 ]]; then
        unset COMPREPLY
    elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "$COMPREPLY" =~ [=/:]$ ]]; then
        compopt -o nospace
    fi
}
complete -o nospace -o default -o bashdefault -F _python_argcomplete conda'
++ complete -o nospace -o default -o bashdefault -F _python_argcomplete conda

And when I type conda ins and then hit TAB, the following is shown:

luca@laptop:~$ conda ins+ local $'IFS=\v'
+ local SUPPRESS_SPACE=0
+ compopt +o nospace
+ SUPPRESS_SPACE=1
+ COMPREPLY=($(IFS="$IFS"                   COMP_LINE="$COMP_LINE"                   COMP_POINT="$COMP_POINT"                   COMP_TYPE="$COMP_TYPE"                   _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS"                   _ARGCOMPLETE=1                   _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE                   __python_argcomplete_run "$1"))
++ IFS=$'\v'
++ COMP_LINE='conda ins'
++ COMP_POINT=9
++ COMP_TYPE=33
++ _ARGCOMPLETE_COMP_WORDBREAKS=' 	
"'\''><=;|&(:'
++ _ARGCOMPLETE=1
++ _ARGCOMPLETE_SUPPRESS_SPACE=1
++ __python_argcomplete_run conda
++ [[ -z '' ]]
++ conda
+ [[ 0 != 0 ]]
+ [[ 1 == 1 ]]
+ [[ '' =~ [=/:]$ ]]

@lucacerone
Copy link
Author

I also did the same as above, but having activated conda base environment first.

I opened a new terminal and run:

conda activate base
set -x
eval "$(register-python-argcomplete conda)"

which displayed

++ register-python-argcomplete conda
+ eval '
# Run something, muting output or redirecting it to the debug stream
# depending on the value of _ARC_DEBUG.
__python_argcomplete_run() {
    if [[ -z "$_ARC_DEBUG" ]]; then
        "$@" 8>&1 9>&2 1>/dev/null 2>&1
    else
        "$@" 8>&1 9>&2 1>&9 2>&1
    fi
}

_python_argcomplete() {
    local IFS=$'\''\013'\''
    local SUPPRESS_SPACE=0
    if compopt +o nospace 2> /dev/null; then
        SUPPRESS_SPACE=1
    fi
    COMPREPLY=( $(IFS="$IFS" \
                  COMP_LINE="$COMP_LINE" \
                  COMP_POINT="$COMP_POINT" \
                  COMP_TYPE="$COMP_TYPE" \
                  _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \
                  _ARGCOMPLETE=1 \
                  _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \
                  __python_argcomplete_run "$1") )
    if [[ $? != 0 ]]; then
        unset COMPREPLY
    elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "$COMPREPLY" =~ [=/:]$ ]]; then
        compopt -o nospace
    fi
}
complete -o nospace -o default -o bashdefault -F _python_argcomplete conda'
++ complete -o nospace -o default -o bashdefault -F _python_argcomplete conda

(it looks the same to me)

and then I typed conda ins and hit TAB and the following was displayed

conda ins+ local $'IFS=\v'
+ local SUPPRESS_SPACE=0
+ compopt +o nospace
+ SUPPRESS_SPACE=1
+ COMPREPLY=($(IFS="$IFS"                   COMP_LINE="$COMP_LINE"                   COMP_POINT="$COMP_POINT"                   COMP_TYPE="$COMP_TYPE"                   _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS"                   _ARGCOMPLETE=1                   _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE                   __python_argcomplete_run "$1"))
++ IFS=$'\v'
++ COMP_LINE='conda ins'
++ COMP_POINT=9
++ COMP_TYPE=33
++ _ARGCOMPLETE_COMP_WORDBREAKS=' 	
"'\''><=;|&(:'
++ _ARGCOMPLETE=1
++ _ARGCOMPLETE_SUPPRESS_SPACE=1
++ __python_argcomplete_run conda
++ [[ -z '' ]]
++ conda
+ [[ 0 != 0 ]]
+ [[ 1 == 1 ]]
+ [[ '' =~ [=/:]$ ]]

which again looks the same output as before to me (even though now the base environment is active)

@fergalm
Copy link

fergalm commented Aug 11, 2020

I'm experiencing at the same problem. There appears to be a solution on #9178

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Jul 19, 2022
@AMR-
Copy link

AMR- commented Jul 20, 2022

For those having this issue, consider looking at https://github.com/tartansandal/conda-bash-completion

@github-actions github-actions bot added stale::recovered [bot] recovered after being marked as stale and removed stale [bot] marked as stale due to inactivity labels Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale::recovered [bot] recovered after being marked as stale
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants