Virtualenv: activate.fish uses unsupported 'source' command

Created on 18 Mar 2016  ·  4Comments  ·  Source: pypa/virtualenv

The activate.fish file currently generated by the virtualenv command use the 'source' command which does not exist in fish. This throws up an error on running the script. An easy solution is to change the source command to a '.'

See the attached images for details:

screen shot 2016-03-19 at 3 10 23 am
the original error

screen shot 2016-03-19 at 3 11 19 am
the edit I made to the activate.fish file

screen shot 2016-03-19 at 3 11 43 am
the result

Most helpful comment

@sjatkins you are sourcing the activate script, designed for bash / zsh / etc, instead of activate.fish

All 4 comments

The fish shell website tells differently.

https://fishshell.com/docs/current/commands.html#source

. (a single period) is an alias for the source command. The use of . is deprecated in favour of source, and . will be removed in a future version of fish.

Who am I to believe?

Sorry, I rushed to a conclusion after reading issue #211 on the fish shell page.

Apparently the same concern was raised in issue #310 and was addressed in the latest version of fish

The issue on my system was because apt-get only installs fish 2.0.0 by default and a separate repository needs to be added in order to get the version (2.2.0) in which the source command was introduced. Adding the PPA repository fish-shell/release-2 and upgrading the fish package fixed the issue. Thanks so much for your help and sorry about the confusion.

Really? I am no fish version 2.3.1 and source of a virtualenv activate file does not work.

source ~/.venvs/base/bin/activate
Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
~/.venvs/base/bin/activate (line 23):     if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
                                                                ^
from sourcing file ~/.venvs/base/bin/activate
    called on standard input

source: Error while reading file '/Users/satkins/.venvs/base/bin/activate'

@sjatkins you are sourcing the activate script, designed for bash / zsh / etc, instead of activate.fish

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeonSpors picture LeonSpors  ·  6Comments

npinto picture npinto  ·  4Comments

mnm678 picture mnm678  ·  7Comments

earthgecko picture earthgecko  ·  4Comments

asottile picture asottile  ·  6Comments