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.

fish 3.0 breaks how pipenv shell prepends python path

See original GitHub issue

Issue description

I think this is new since I just updated fish shell and it was the first thing I noticed that was broken. The $PATH upon using pipenv shell seems to put previous $PATH then virtualenv path then $PATH again, but I am not entirely sure. I believe it used to be work fine out of the box with just prepending the virtualenv PATH to my $PATH but after my fish_user_path (which also was not preferable)

Expected result

Have pipenv prepend virtualenv to path in fish shell

Actual result

Has virtualenv python path in between two copies of $PATH for some reason

Steps to replicate

Update to fish 3.0

Other:

Yeah I rolled back fish to 2.7.1 (if anyone has this issue, try brew switch fish 2.7.1) and seems to work. Think its specific to pipenv prepending to path. Also have issues with pipenv prepending to $PATH after $PATH but before the $fish_user_paths stuff so maybe could be done as one fix?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
erinxoconcommented, Jan 30, 2019

For anyone that finds this issue.

brew unlink fish
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/2827b020c3366ea93566a344167ba62388c16c7d/Formula/fish.rb

This will install version 2.7.1 of fish.

0reactions
grahamannettcommented, Mar 26, 2019

i know this is closed but it still seems quite broken for me at the least and only related to pipenv shell with fish 3.0.

Using source /Users/graham/.local/share/virtualenvs/example_virtual_env/bin/activate.fish works (it places the virtualenv python path in front of everything for my path where as using pipenv shell places the virtualenv python path after everything but before $fish_user_paths

I don’t think this is a fish problem as I am using a fresh install and have nothing impacting my path besides stuff in /etc/paths

Edit: Weird. Probably I was wrong. Was writing a function to just source the file for me and testing something out and it magically started working. For anyone having an issue, try changing fish from login to interactive then back to login or leave as interactive?

Otherwise can try something like this (but it doesn’t launch in subshell)

function pipenvshell
    # activate may mess up prompt with 2 virtualenvs
    if set -q VIRTUAL_ENV_DISABLE_PROMPT
        echo "Using Previous VIRTUAL_ENV_DISABLE_PROMPT"
    else
        set -l VIRTUAL_ENV_DISABLE_PROMPT 1
    end

    set -l _curr_wd (basename $PWD)
    source $HOME/.local/share/virtualenvs/$_curr_wd*/bin/activate.fish
end
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fish Shell - Virtualenv path not prepended to PATH - Super User
I have this problem where when I activate a python virtual env, via >pipenv shell , the virtual env path is slotted into...
Read more >
pipenv Documentation - Read the Docs
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the. Python...
Read more >
pipenv Documentation
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the. Python...
Read more >
Release notes — fish-shell 3.5.1 documentation
The prompt and command line are redrawn correctly in response to universal variable changes (#8088). A superfluous error that was produced when setting...
Read more >
Why is pipenv telling me the wrong version of python?
pipenv shell $ python --version ... If you change your project's path, you break such a default mapping and pipenv will no longer...
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