vim-conda icon indicating copy to clipboard operation
vim-conda copied to clipboard

vim-conda is not compatible with the latest conda env activation mechanism

Open DigitalPig opened this issue 6 years ago • 5 comments

Starting from Conda 4.4, the recommended way of activating conda env has been changed.

Now when I execute CondaChangeEnv command with the latest setup (setting . /opt/conda/etc/profile.d/conda.sh in .bashrc). The vim command complains as follows:

~/.conda/envs/vim_test/lib/python3.6/subprocess.py in check_output(timeout, *popenargs, **kwargs)
    334 
    335     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 336                **kwargs).stdout
    337 
    338 

~/.conda/envs/vim_test/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
    416         if check and retcode:
    417             raise CalledProcessError(retcode, process.args,
--> 418                                      output=stdout, stderr=stderr)
    419     return CompletedProcess(process.args, retcode, stdout, stderr)
    420 

CalledProcessError: Command 'conda info --json' returned non-zero exit status 127.

Changing back to the old export PATH=... solves the above issue. But would it be possible to be compatible with latest conda? Thank you!

DigitalPig avatar May 27 '18 03:05 DigitalPig

If you submit a pull request to fix this I will likely merge it. I don't use Conda anymore, so we should also check with: @jfishe @hstarmans @ryanfreckleton

cjrh avatar Jun 16 '18 04:06 cjrh

I've got the same exception. It seems like if I activate the base environment by running

conda activate base

before opening vim, everything works fine. Of course, adding the old export PATH=... like @DigitalPig said also solves the problem.

I want to contribute but have never coded vimscript before, so not sure if I can do anything.

Nikasa1889 avatar Sep 18 '18 09:09 Nikasa1889

@Nikasa1889 If you submit a PR that fixes this problem, I will merge it and make you a contributor to this repo.

cjrh avatar Sep 18 '18 09:09 cjrh

Maybe the solution would be changing the activating operation from this:

let PATH = ...

to something like this:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/path/to/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/path/to/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/path/to/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/path/to/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

which is the lines that conda currently puts in bashrc.

I have no experience writing vim-script. Is this going to help?

zhiyuanzhai avatar Aug 08 '20 06:08 zhiyuanzhai

If you submit a pull request to fix this I will likely merge it. I don't use Conda anymore, so we should also check with: @jfishe @hstarmans @ryanfreckleton

Hey! Just for interesting: why don't you use conda anymore and what do you use now?

bdrum avatar Feb 20 '22 18:02 bdrum