Be sure to check the existing issues (both open and closed!).
Describe the issue briefly here.
When running pipenv shell
on latest version the following happens:
/usr/bin/env: ‘bash’: No such file or directory
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
┌── [01:14:01] [tristan957@c-3po] [~/Projects/digit-al-tunes]
└─‖ . /home/tristan957/.local/share/virtualenvs/digit-al-tunes-Br68lvpa/bin/activate
bash: basename: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
bash: tput: command not found
() ┌── [01:14:01] [tristan957@c-3po] [~/Projects/digit-al-tunes]
└─‖
Please run $ python -m pipenv.help
, and paste the results here.
$ python -m pipenv.help output
Pipenv version: '11.10.0'
Pipenv location: '/home/tristan957/.local/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python3'
Other Python installations in PATH
:
2.7
: /usr/bin/python2.7
2.7
: /usr/bin/python2.7
3.6
: /usr/bin/python3.6m
3.6
: /usr/bin/python3.6
2.7.14
: /usr/bin/python
2.7.14
: /usr/bin/python2
3.6.4
: /usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.4',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.15-63.current',
'platform_system': 'Linux',
'platform_version': '#1 SMP PREEMPT Sat Apr 7 08:32:34 UTC 2018',
'python_full_version': '3.6.4',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
LS_COLORS
XDG_MENU_PREFIX
LANG
HISTIGNORE
HISTCONTROL
MANAGERPID
DISPLAY
INVOCATION_ID
EDITOR
COLORTERM
XDG_VTNR
SSH_AUTH_SOCK
XDG_SESSION_ID
XDG_GREETER_DATA_DIR
USER
DESKTOP_SESSION
GOPATH
QT_QPA_PLATFORMTHEME
INPUTRC
PWD
HOME
JOURNAL_STREAM
GIT_PS1_SHOWDIRTYSTATE
XDG_SESSION_TYPE
XDG_DATA_DIRS
XDG_SESSION_DESKTOP
TILIX_ID
DBUS_STARTER_ADDRESS
GTK_MODULES
TERM
SHELL
VTE_VERSION
GNOME_KEYRING_CONTROL
XDG_SEAT_PATH
QT_IM_MODULE
XMODIFIERS
DBUS_STARTER_BUS_TYPE
XDG_CURRENT_DESKTOP
XDG_SEAT
SHLVL
JENV_LOADED
GDMSESSION
GNOME_DESKTOP_SESSION_ID
LOGNAME
DBUS_SESSION_BUS_ADDRESS
XDG_RUNTIME_DIR
XAUTHORITY
XDG_SESSION_PATH
XDG_CONFIG_DIRS
PATH
PS1
PS3
PS2
PS4
HISTSIZE
SESSION_MANAGER
_
OLDPWD
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
PYTHONUNBUFFERED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
: /home/tristan957/.jenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/snap/bin:/home/tristan957/go/bin:/home/tristan957/.jenv/bin:/home/tristan957/.local/bin:/home/tristan957/.cargo/bin:/home/tristan957/.yarn/bin
SHELL
: /bin/bash
EDITOR
: vim
LANG
: en_US.utf8
PWD
: /home/tristan957/Projects/digit-al-tunes
Contents of Pipfile
('/home/tristan957/Projects/digit-al-tunes/Pipfile'):
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
PyGObject = "*"
pydocstyle = "*"
pyserial = "*"
[dev-packages]
"flake8" = "*"
[requires]
python_version = "3.6"
Contents of Pipfile.lock
('/home/tristan957/Projects/digit-al-tunes/Pipfile.lock'):
{
"_meta": {
"hash": {
"sha256": "d03ba088eb2cc3d1b721d27e6f23b4ca1866c965d5495a631970740897eb09e1"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"pycairo": {
"hashes": [
"sha256:5bb321e5d4f8b3a51f56fc6a35c143f1b72ce0d748b43d8b623596e8215f01f7"
],
"version": "==1.16.3"
},
"pydocstyle": {
"hashes": [
"sha256:08a870edc94508264ed90510db466c6357c7192e0e866561d740624a8fc7d90c",
"sha256:4d5bcde961107873bae621f3d580c3e35a426d3687ffc6f8fb356f6628da5a97",
"sha256:af9fcccb303899b83bec82dc9a1d56c60fc369973223a5e80c3dfa9bdf984405"
],
"index": "pypi",
"version": "==2.1.1"
},
"pygobject": {
"hashes": [
"sha256:f704f4be3b4ae3cae70acf82ac64a8c7c44d3acad2d33e9849056ac317345f5e"
],
"index": "pypi",
"version": "==3.28.2"
},
"pyserial": {
"hashes": [
"sha256:6e2d401fdee0eab996cf734e67773a0143b932772ca8b42451440cfed942c627",
"sha256:e0770fadba80c31013896c7e6ef703f72e7834965954a78e71a3049488d4d7d8"
],
"index": "pypi",
"version": "==3.4"
},
"six": {
"hashes": [
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
],
"version": "==1.11.0"
},
"snowballstemmer": {
"hashes": [
"sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128",
"sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89"
],
"version": "==1.2.1"
}
},
"develop": {
"flake8": {
"hashes": [
"sha256:7253265f7abd8b313e3892944044a365e3f4ac3fcdcfb4298f55ee9ddf188ba0",
"sha256:c7841163e2b576d435799169b78703ad6ac1bbb0f199994fc05f700b2a90ea37"
],
"index": "pypi",
"version": "==3.5.0"
},
"mccabe": {
"hashes": [
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
],
"version": "==0.6.1"
},
"pycodestyle": {
"hashes": [
"sha256:1ec08a51c901dfe44921576ed6e4c1f5b7ecbad403f871397feedb5eb8e4fa14",
"sha256:5ff2fbcbab997895ba9ead77e1b38b3ebc2e5c3b8a6194ef918666e4c790a00e",
"sha256:682256a5b318149ca0d2a9185d365d8864a768a28db66a84a2ea946bcc426766",
"sha256:6c4245ade1edfad79c3446fadfc96b0de2759662dc29d07d80a6f27ad1ca6ba9"
],
"version": "==2.3.1"
},
"pyflakes": {
"hashes": [
"sha256:08bd6a50edf8cffa9fa09a463063c425ecaaf10d1eb0335a7e8b1401aef89e6f",
"sha256:8d616a382f243dbf19b54743f280b80198be0bca3a5396f1d2e1fca6223e8805"
],
"version": "==1.6.0"
}
}
}
Not get bash errors
When possible, provide the verbose output (--verbose
), especially for locking and dependencies resolving issues.
Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
PyGObject = "*"
pydocstyle = "*"
pyserial = "*"
[dev-packages]
"flake8" = "*"
[requires]
python_version = "3.6"
Include a tput
command in your bashrc (PS1). Watch the magic happen.
This does not happen on version 11.9.0
ok @tristan957 sorry for the issues, I just verified we actually didn't change _anything_ about the shell command between these versions
I was able to confirm that tput is not causing this issue by using it in bashrc with pipenv shell
. It seems more likely that the first line is the best indicator of what's going wrong here: /usr/bin/env: ‘bash’: No such file or directory
What exactly does your .bashrc
contain? This seems like a configuration issue
I'll post my bashrc in a second. I don't understand why pipenv would launch fine in the previous version but break on the next version
```
if [ $EUID -ne 0 ]; then
user_char='‖' # '⋮' # '$'
else
user_char='#'
fi
export PS1='[$(tput setaf 51)]$(tput bold)┌── [$(tput setaf 208)][\t] [$(tput setaf 76)][\u@\h] [$(tput setaf 214)][\w][$(tput setaf 39)]$(__git_ps1 " [%s]")\n[$(tput setaf 51)][$(tput bold)]└─$user_char [$(tput sgr0)]'
export PS2='[$(tput setaf 51)]$(tput bold)└─$user_char [$(tput sgr0)]'
export PS3='[$(tput setaf 51)]$(tput bold)└─$user_char [$(tput sgr0)]'
export PS4='[$(tput setaf 51)]$(tput bold)└─$user_char [$(tput sgr0)]'
PROMPT_DIRTRIM=3
export EDITOR="vim"
alias permissions="stat -c '%a %n'"
alias ls="ls --color"
export LS_COLORS=$LS_COLORS:"di=1:ex=4:ow=1:"
alias diff="diff --color=auto"
alias mkdir="mkdir -p"
alias ga="git add"
alias gc="git commit"
alias gck="git checkout"
alias gpl="git pull"
alias gps="git push"
alias fetch-yml="../common/Scripts/yauto.py" # url
alias update-yml="/usr/share/ypkg/yupdate.py" # version-number url
alias get-make="echo 'include ../Makefile.common' > Makefile" # Makefile in current package directory
export GOPATH="$HOME/go"
JENVBIN="$HOME/.jenv/bin"
PIPBIN="$HOME/.local/bin"
RUSTBIN="$HOME/.cargo/bin"
YARNBIN="$HOME/.yarn/bin"
export PATH="$PATH:$GOPATH/bin:$JENVBIN:$PIPBIN:$RUSTBIN:$YARNBIN"
export HISTCONTROL=ignoredups
export HISTSIZE=1000000
shopt -s histappend
if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_COMPAT_DIR-}" ]; then
# Check for recent enough version of bash.
if [ ${BASH_VERSINFO[0]} -gt 4 ] || \
[ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; 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
bind "set show-all-if-ambiguous on"
bind "TAB:menu-complete"
bind '"\e[Z":menu-complete-backward' # Shift-tab
bind "set menu-complete-display-prefix on"
bind "set completion-ignore-case on"
bind "set bell-style none"
bind "set skip-completed-text on"
bind '"\e[A": history-search-backward' # up-arrow
bind '"\e[B": history-search-forward' # down-arrow
bind "set expand-tilde on"
bind '"\b": kill-whole-line' # Ctrl-backspace
bind '"\ed": backward-kill-word' # Alt-d
bind '"\eD": shell-kill-word' # Alt-D
if type "direnv" > /dev/null 2>&1; then
eval "$(direnv hook bash)"
fi
if type "jenv" > /dev/null 2>&1; then
eval "$(jenv init -)"
fi
source $HOME/dotfiles/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
bash_profile
source ~/.bashrc
Thanks, gonna try to reproduce
Let me know what else you may need
Hey @tristan957 so I copied your entire bashrc and I couldn't reproduce this. Everything works fine for me.
does it work if you use pipenv shell --fancy
?
I can only guess this is some script in the background or something, I'm not really sure. P.s. awesome prompt and such, love it
Thanks for the comment on the prompt. I would still like to find the cause of this issue. The only script I am running with my prompt is the git_prompt.sh file from git themselves. There is something between 11.9 and 11.10 that is not working. I like pipenv and would like to continue using it with up to date features.
Ok so here is something I learned. I created a new project using pipenv 11.10 and everything worked fine. Why is my project that started on 11.9 not able to be used by pipenv 11.10. Could my virtualenv possibly be corrupted somehow?
It’s possible, but what if you create one with pipenv 11.9 and then upgrade? That might help determine for sure
Interesting. Did not receive an error. I'm just going to recreate the dev environment then
Ok I don't know how to fix this. I deleted the virtualenv and the pipfiles and reinstalled/instantiated the environment and no dice.
Try removing all of your pip and pipenv caches, Possibly bad wheel or
something...
On Sat, Apr 14, 2018 at 2:30 PM Tristan Partin notifications@github.com
wrote:
Ok I don't know how to fix this. I deleted the virtualenv and the pipfiles
and reinstalled/instantiated the environment and no dice.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pypa/pipenv/issues/1959#issuecomment-381361989, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABhjqzrIOaKM6yTDEHdfvr966O1Qo4X5ks5tomp5gaJpZM4TRMwA
.
That did not make a difference unfortunately
I mean as long as we have no idea what part of your bashrc actually causes this problem it will be quite hard to troubleshoot. You probably should comment out one line at a time and start there. Alternatively you can try pipenv shell —fancy
which I believe leaves your prompt and such alone
I commented out every single line in my bashrc and this issue still occurs. I also only commented out PS1-4 and still got a bash issue.
/usr/bin/env: ‘bash’: No such file or directory
/usr/bin/env/ bash
exists on my system
@tristan957 you have a ~/.profile
right? What does that contain?
I have a ~/.bash_profile
. I am using GNU Stow to manage dotfiles so my bash_profile
is a symlink to my ~/dotfiles/bash/.bash_profile
which says:
source $HOME/.bashrc
@tristan957 I got that, but do you have a ~/.profile
? Separately from your bash_profile
.
Wait yes I do
source /usr/share/defaults/etc/profile
sourced file
# Begin /usr/share/defaults/etc/profile
if [ -d /usr/share/defaults/etc/profile.d ] ; then
for script in /usr/share/defaults/etc/profile.d/*.sh
do
source $script
done
unset script
fi
if [ -d /etc/profile.d ] ; then
for script in /etc/profile.d/*.sh
do
source $script
done
unset script
fi
# End /usr/share/defaults/etc/profile
The following files are located in the profile.d
directory
10-path.sh 50-history.sh 50-umask.sh vte.sh
10-xdg.sh 50-prompt.sh 70-flatpak.sh
50-budgie-accessibility.sh 50-qt-theming.sh 70-snapd.sh
50-dircolors.sh 50-readline.sh bash_completion.sh
Would you like any info on any of these?
No but just touch ~/.profile
and see if the problem goes away
Then you can add one at a time directly and explicitly and see which causes the issue (and let us know so we can let others know!)
Ok so I completely deleted the ~/.profile
and still experienced the same tput
errors.
Something that may not have been mentioned before is this error. I recommented out my PS1-PS4
. Following error upon invocation of pipenv shell
is bash: basename: command not found
. When I am in a regular shell:
which basename
/bin/basename
Thoughts?
What is PATH
inside and spawned subshell? Does it include /bin
?
When in pipenv shell
: /home/tristan957/.local/share/virtualenvs/digit-al-tunes-Br68lvpa/bin:$PATH:$HOME/.local/share/virtualenvs/digit-al-tunes-Br68lvpa/bin:/home/tristan957/.local/bin:/home/tristan957/go/bin:/home/tristan957/.cargo/bin:/home/tristan957/.yarn/bin
When in regular shell: /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/snap/bin:/home/tristan957/.local/bin:/home/tristan957/go/bin:/home/tristan957/.cargo/bin:/home/tristan957/.yarn/bin
I have found the error! I was exporting PATH
in my .env
file because I was under the impression the virtualenv bin
did not get added to PATH
. I deleted my .env
file and the issue has been resolved.
Probably something wrong with your .env
file because a lot of built-in paths got deleted, but as long as it works.
I mean the .env worked under 11.9, but not under 11.10
python-dorenv did get an upstream upgrade recently. It’s probably worth looking into if this is a regression. Would you mind sharing you .env
?
Sorry for the delay. Finals + new internship. Here is the contents of my .env file:
export PATH=$PATH:$HOME/.local/share/virtualenvs/digit-al-tunes-Br68lvpa/bin
Ran into a similar problem today. Running pipenv shell
was yielding this:
localhost:projectX kepler$ pipenv shell
Loading .env environment variables…
Spawning environment shell (/bin/bash). Use 'exit' to leave.
bash-3.2$ . /Users/kepler/.virtualenvs/projectX-CsqcXApa/bin/activate
bash: basename: command not found
() bash-3.2$
which resulted in a completely broken shell.
My .env
had this line:
PATH=$PATH:.
Removing it made everything work again:
localhost:projectX kepler$ pipenv shell
Loading .env environment variables…
Spawning environment shell (/bin/bash). Use 'exit' to leave.
bash-3.2$ . /Users/kepler/.virtualenvs/projectX-CsqcXApa/bin/activate
(projectX-CsqcXApa) bash-3.2$
So it seems pipenv is really sensitive to PATH
.
Sorry for not digging deeper into this, but I hope this information helps debugging the issue.
No worries, but yes it will be very sensitive to you overriding your path variable, as pipenv needs to find paths to things like python. If you override the path variable with something that isn't resolved properly, it won't be able to find paths correctly
I agree caution needs to be taken. However, I tried with simply PATH=$PATH
and it was enough for causing the error, which was unexpected.
I then suspected the environment variables aren't first resolved by the loading mechanism in pipenv, and confirmed it when PATH=$PATH:/usr/bin
worked without the problem above. So it seems the variables in .env
override variables in the environment.
I then checked python-dotenv
behavior and figured out two facts. First, by default it doesn't override existing vars. If the .env
file is loaded with the override flag, then it does, but it overrides them verbatim, i.e., with no cascaded resolution (so os.environ['PATH'] == '$PATH'
in the first case above).
And this raised the second fact: my usage of .env
for setting PATH
was broken to begin with. I didn't notice it before because it took me several days to restart the pipenv shell and actually test the code.
In the end, all this points out to pipenv overriding environment variables with .env
ones by default, which causes the issue here with improperly set variables.
It doesn't necessarily mean this behavior is wrong, but having a preventive check in order to show a more meaningful error message would have helped me out a lot debugging my error. :)
@kepler thanks! That saved me some time. I was using dotenv
for zsh
which sources my .env
file. This was causing similar issues where I would get No such file or directory
issues regarding my $PATH
environment variable that happened to be exported in my .env
file.
Long story short it's some sort of PATH
issue.
Most helpful comment
I have found the error! I was exporting
PATH
in my.env
file because I was under the impression the virtualenvbin
did not get added toPATH
. I deleted my.env
file and the issue has been resolved.