Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DigitalPig opened this issue May 27, 2018 · 5 comments

Comments

@DigitalPig
Copy link

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!

@cjrh
Copy link
Owner

cjrh commented Jun 16, 2018

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

@Nikasa1889
Copy link

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.

@cjrh
Copy link
Owner

cjrh commented Sep 18, 2018

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

@zhiyuanzhai
Copy link

zhiyuanzhai commented Aug 8, 2020

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?

@bdrum
Copy link

bdrum commented Feb 20, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants