question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`--completion` flag not recognized in bash

See original GitHub issue

The pipenv --completion command is not working:

$ pipenv --completion
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.

Error: No such option: --completion Did you mean --python?
$ pipenv --support

Pipenv version: '2022.1.8'

Pipenv location: '/home/joan/.local/lib/python3.8/site-packages/pipenv'

Python location: '/usr/bin/python'

Python installations found:

  • 3.10.0: /home/joan/.pyenv/versions/3.10.0/bin/python3
  • 3.8.10: /home/joan/.pyenv/versions/list/bin/python3
  • 3.8.10: /home/joan/.pyenv/versions/PoC/bin/python3
  • 3.8.10: /usr/bin/python3.8
  • 3.8.10: /usr/bin/python3
  • 3.8.10: /usr/bin/python
  • 3.8.10: /bin/python3.8
  • 3.8.10: /bin/python3
  • 3.8.10: /bin/python
  • 3.7.7: /home/joan/.pyenv/versions/3.7.7/bin/python3.7
  • 3.7.6: /home/joan/.pyenv/versions/3.7.6/bin/python3.7
  • 3.7.5: /home/joan/.pyenv/versions/3.7.5/bin/python3.7
  • 3.7.0: /home/joan/.pyenv/versions/3.7.0/bin/python3.7
  • 3.6.15: /home/joan/.pyenv/versions/product-brewer/bin/python3.6
  • 3.6.15: /home/joan/.pyenv/versions/3.6.15/bin/python3.6m
  • 3.6.15: /home/joan/.pyenv/versions/WardrobeClient/bin/python3.6
  • 3.6.10: /home/joan/.pyenv/versions/3.6.10/bin/python3.6m
  • 3.6.7: /home/joan/.pyenv/versions/3.6.7/bin/python3.6m
  • 2.7.18: /home/joan/.pyenv/versions/2.7.18/bin/python2

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.10',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.14.0-1027-oem',
 'platform_system': 'Linux',
 'platform_version': '#30-Ubuntu SMP Mon Mar 7 15:00:29 UTC 2022',
 'python_full_version': '3.8.10',
 'python_version': '3.8',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • PIPENV_PYPI_MIRROR
  • SESSION_MANAGER
  • QT_ACCESSIBILITY
  • COLORTERM
  • XDG_CONFIG_DIRS
  • NVM_INC
  • XDG_MENU_PREFIX
  • GNOME_DESKTOP_SESSION_ID
  • LC_ADDRESS
  • GNOME_SHELL_SESSION_MODE
  • LC_NAME
  • SSH_AUTH_SOCK
  • ANDROID_SDK
  • XMODIFIERS
  • DESKTOP_SESSION
  • LC_MONETARY
  • SSH_AGENT_PID
  • GTK_MODULES
  • PWD
  • PYENV_VIRTUALENV_INIT
  • LOGNAME
  • XDG_SESSION_DESKTOP
  • XDG_SESSION_TYPE
  • GPG_AGENT_INFO
  • XAUTHORITY
  • WINDOWPATH
  • HOME
  • USERNAME
  • IM_CONFIG_PHASE
  • LC_PAPER
  • LANG
  • LS_COLORS
  • XDG_CURRENT_DESKTOP
  • VTE_VERSION
  • GNOME_TERMINAL_SCREEN
  • INVOCATION_ID
  • MANAGERPID
  • NVM_DIR
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • TERM
  • LC_IDENTIFICATION
  • LESSOPEN
  • LIBVIRT_DEFAULT_URI
  • USER
  • GNOME_TERMINAL_SERVICE
  • DISPLAY
  • SHLVL
  • NVM_CD_FLAGS
  • LC_TELEPHONE
  • QT_IM_MODULE
  • LC_MEASUREMENT
  • XDG_RUNTIME_DIR
  • PS1
  • LC_TIME
  • JOURNAL_STREAM
  • XDG_DATA_DIRS
  • PATH
  • GDMSESSION
  • DBUS_SESSION_BUS_ADDRESS
  • NVM_BIN
  • LC_NUMERIC
  • OLDPWD
  • _
  • PIP_SHIMS_BASE_MODULE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_PYPI_MIRROR: http://pypi.edtd.net/EDITED/dev/+simple/

Debug–specific environment variables:

  • PATH: /home/joan/.nvm/versions/node/v10.7.0/bin:/home/joan/.poetry/bin:/home/joan/.pyenv/plugins/pyenv-virtualenv/shims:/home/joan/.pyenv/shims:/home/joan/.pyenv/bin:/home/joan/.poetry/bin:/home/joan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/joan/.fzf/bin:/opt/apache-storm/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/joan/apps/hydra

and here is my env:

$ pip list
Package            Version
------------------ ---------
amqp               2.6.1
botocore           1.19.63
certifi            2021.10.8
chardet            3.0.4
click              8.0.3
distlib            0.3.4
docker             4.4.4
EasyProcess        0.3
filelock           3.4.0
google-auth        2.3.3
idna               3.3
importlib-metadata 4.11.3
itsdangerous       2.0.1
Jinja2             3.0.3
jmespath           0.10.0
kubernetes         20.13.0
limits             1.6
MarkupSafe         2.0.1
oauthlib           3.1.1
orderedmultidict   1.0.1
pip                22.0.4
pipenv             2022.1.8
platformdirs       2.5.1
pyasn1             0.4.8
pyasn1-modules     0.2.8
pyretry            1.0.0
requests-file      1.5.1
requests-oauthlib  1.3.0
rsa                4.8
s3transfer         0.3.7
setuptools         39.0.1
six                1.16.0
soupsieve          2.3.1
tabulate           0.8.9
typing_extensions  4.1.1
urllib3            1.26.7
vine               1.3.0
virtualenv         20.13.3
virtualenv-clone   0.5.7
websocket-client   1.2.1
Werkzeug           2.0.2
zipp               3.7.0

$ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

5reactions
timblaktucommented, Jun 17, 2022

@ttecles you probably did the same as me - upgrade pipenv and notice your shell completion broke. It looks like this breaking change was released in 2021.11.9, and the changelog doesn’t say anything about it directly. I had to create a version check in my .profile to determine how to install pipenv completion, like so:

    # Set up magic shell completion for pipenv (works in bash and zsh)
    # Have to check version bc pipenv changed the implementation
    if version_greater_equal "$(pipenv --version)" "2021.11.9" ; then
        eval "$(_PIPENV_COMPLETE=zsh_source pipenv)"
    else
        eval "$(pipenv --completion)"
    fi

It would have been nice if this sort of thing had been updated in the docs along with this sort of breaking change. I’m also now going to have to make it shell-specific in my .profile…

EDIT: Now it looks like this:

      # Set up magic shell completion for pipenv (works in bash and zsh)-
      # Have to check version bc pipenv changed the implementation
      if version_greater_equal "$(pipenv --version)" "2021.11.9" ; then
          RUNNING_SHELL="$(ps -p$$ -ocmd=)"--
          case $RUNNING_SHELL in
              -zsh) eval "$(_PIPENV_COMPLETE=zsh_source pipenv)";;
              -bash) eval "$(_PIPENV_COMPLETE=bash_source pipenv)";;
              *) echo "SHELL $RUNNING_SHELL not supported for pipenv completions!"
          esac
      else
          # used to work this way for all shells
          eval "$(pipenv --completion)";;
      fi
2reactions
matteiuscommented, Aug 17, 2022

@dlo - The flag as removed before I started working on the project; we have no plans to add it back in to add a deprecation warning and then removing it again.

unless a completion script has been sourced by bash, I’m curious how this is supposed to work by default.

Edited: I was reopening the issue and had a half typed out comment and it posted that. I am not sure – this was before I started and I haven’t used auto completion – I just tried it and not sure if it fully works, I can have it recommend the first commands but say I type pipenv install + tab there are no recommendations. Should there be? Either way it sounds like more thought needs to go into how to move this issue forward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

the flag ' ' is not recognized - bash - Stack Overflow
it doesn't finish exporting the package as there is no "packagebundle.arb" file in the destination folder after the running the command. so i'd ......
Read more >
compgen usage error when attempting to complete "--" flags
I'm attempting to do bash completion for a command, and everything is working as normal with the full word commands, but when I...
Read more >
Bug #1460165 “Bash completion of flags not working in Trusty ...
Before, when a flag was not specified, it completed nonetheless, now if it's not specified, it doesn't complete. This puts a big burden...
Read more >
Programmable Completion Builtins (Bash Reference Manual)
When using the -F or -C options, the various shell variables set by the programmable completion facilities, while available, will not have useful...
Read more >
How to create a Bash completion script - Opensource.com
echo "Command with number $1 was not found in recent history" ... Find the complete list of the available flags in the Bash...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found