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.

Add way to force a particular environment shell

See original GitHub issue

Arch recommends users to keep a bash-compatible shell as default [0]. I’m using the method of execing fish from my .bashrc.

pipenv fails on pipenv shell, apparently because it thinks that the bash activate should be executed

Spawning environment shell (/bin/bash). Use 'exit' to leave.
~/s/tmp  source /home/me/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate
~/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate (line 23): Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
    if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
                          ^
from sourcing file ~/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate
	called on standard input

source: Error while reading file “/home/me/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate”

If I replace activate with activate.fish, the pipenv works as expected.

Could there be a flag or, even better yet, a config option to force the default environment shell?

[0] https://wiki.archlinux.org/index.php/Fish#Not_setting_fish_as_default_shell

Describe you environment
  1. OS Type Linux tp 4.13.7-1-ARCH #1 SMP PREEMPT Sat Oct 14 20:13:26 CEST 2017 x86_64 GNU/Linux
  2. Python version: $ python -V Python 3.6.2
  3. Pipenv version: $ pipenv --version pipenv, version 8.2.7

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
techalchemycommented, Oct 25, 2017

@kehugter in compat mode your shell is determined by the SHELL environment variable, so you can just export $SHELL in your .bashrc or run the subshell with SHELL=/usr/bin/fish pipenv shell and it should work. Let me know if this helps

0reactions
techalchemycommented, Oct 25, 2017

Yes, as with all shell configurations you should include interactive settings in interactive shells only. That information is mentioned in the docs in the context of fish, but as a user who is concerned about edge cases of people trying to run an interactive pipenv shell on a non interactive shell, well that use case isn’t possible so you shouldn’t change the variable. If you want to be safe however you can follow the bash instructions about testing for interactivity before setting the value: see here

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Read and Set Environmental and Shell Variables on ...
In this guide, we will discuss how to interact with the environment and read or set environmental and shell variables interactively and through ......
Read more >
Linux environment variable tips and tricks | Enable Sysadmin
To make permanent changes to the environment variables for all new accounts, go to your /etc/skel files, such as .bashrc , and change...
Read more >
How to permanently set environmental variables
You can add it to the file .profile or your login shell profile file (located in your home directory). To change the environmental...
Read more >
Setting an environment variable before a command in Bash is ...
So, what's a good way to do this on a single line? I'm thinking something on the order of: FOO=bar (somecommand someargs |...
Read more >
How to Set, List and Manage Linux Environment Variables
#Use .profile to Make Environment Variables Permanent for Login Shells · Change directory to the user's home directory cd ~ · Open .profile...
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