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
PYTHONPATH handling in neovim breaks YouCompleteMe #64048
Comments
There are a couple resolutions that come to mind:
|
I would like to update the ycmd nix expression, they don't really do releases, so I'm not sure what point would be a good point to do a checkout. For now, that PR should resolve this issue. |
This still has some remaining issues. When opening a python source file, the following message is printed:
(I'm on Ubuntu right now, so I'm fairly sure a python2.7 from the store would have been resolved if I were on NixOS; I think that can be ignored as an orthogonal issue for this report)
Here's where See also: https://github.com/ycm-core/YouCompleteMe#configuring-through-vim-options I think an easy fix will be patching YouCompleteMe to remove the Again, other plugins and neovim scripts will be subject to similar issues whenever the plugin host launches a python interpreter that doesn't match. Maybe a reasonable solution would be to somehow monkey patch the python subprocess apis in the two python plugin hosts so that any spawned subprocesses don't inherit the plugin environment (the odds that they would utilize any of the packages would seem slim to me). Maybe that would fix more than it would break. |
Removing the environment variable (and perhaps restoring it after) here should do the trick: https://github.com/ycm-core/YouCompleteMe/blob/04c3505129cd80b92f1b6177dca8aecc55cb0760/python/ycm/youcompleteme.py#L187 |
It would be nice if there was a I'm not convinced that's a perfect solution, but right now wherever we use a python environment via @FRidh, as maintainer of the CPython interpreters, what are your thoughts? |
I'll take a look when i get home. I mean, python2 is being phased out soon, so if it's just compatible upgrades among the packages in the ycmd closure, then it shouldn't be too much of an issue. I was hoping that bumping the ycmd to python3 would be enough. |
Leaking of |
#64634 is now in staging. |
in case it helps anyone, my current workaround is: { nixpkgs, python }: # the python passed here is 'python38Full'
with nixpkgs;
with vimPlugins;
nixpkgs.neovim.override {
vimAlias = true;
configure = {
packages.YouCompleteMe.start = [ YouCompleteMe ]; # autocompletion
# ... other packages elided for clarity ...
customRC = (nixpkgs.lib.concatStringsSep "\n"
[ (builtins.readFile ./vimrc)
''
let g:ycm_python_binary_path = '${python}/bin/python'
''
]
);
};
} |
I marked this as stale due to inactivity. → More info |
sounds like this was resolved, but this issue was forgotten. |
Issue description
Here's an
strace
ofnvim
where the YouCompleteMe plugin (running python3 as the plugin host innvim
, presumably; see trace below) attempts to start theycmd
server (a python2 program):It would seem that the neovim package does something such that when a python3 neovim plugin starts a python2 program, the python2 program's idea of
PYTHONHOME
is set to the environment created for the remote plugin host.This can be confirmed running this in
nvim
:That will print the
/nix/store/xxwxhdpasj6mcv3mvxdd4n3hyp13izd0-python3-3.7.2-env
path from above.Steps to reproduce
Note that the ycm plugin complains about the server shutting down. Look through the traces to see the aforementioned "ImportError: No module named site" message.
Technical details
"x86_64-linux"
Linux 5.0.0-17-generic, Ubuntu, 19.04 (Disco Dingo)
yes
no
nix-env (Nix) 2.1.3
"nixpkgs"
"nixpkgs"
/nix/var/nix/profiles/per-user/cstrahan/channels/nixpkgs
The text was updated successfully, but these errors were encountered: