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
Ubuntu 16.04: ycmd crashing because of install.py picking wrong Python version #2729
Comments
This is actually wrong. YCM does not require that the client and the server run on the same Python version, i.e. one can run the client with Python3 while the server run under Python2 and vice versa. The important thing is that when we start the server we use the same Python binary that was used during the building of the server. To do that in the |
As @vheon correctly points out, this should all just work these days. Could you let us know what you have set in
It's pretty easy: run I regularly run a python3 ycmd with a python2 Vim. And vice versa. |
@puremourning nice, it didn't occur to me to try I didn't set Any ideas on why |
Well that's suspicious. To confirm, after running The |
Agreed, and somehow I'm unable to repro that anymore. Regarding the CI environment -- I'm pretty sure that it doesn't get to have the problem of several Python versions being available (in headers+libs form), hence it doesn't trigger the |
We are using pyenv on Travis so they are at least two Python: one from system and another from pyenv. We don't get the error simply because we are using the
From my experience, the FindPythonLibs module from CMake is quite buggy. That's why we set all the variables mentioned above in the |
…pleters, r=vheon [READY] Write python used during build before installing completers If ycmd compilation is successful but installing a completer fails, we don't create the `PYTHON_USED_DURING_BUILDING` file. This can be an issue if the user gives up on the completer installation and the client uses the Python from this file to start ycmd (like YCM does). This could explain issue ycm-core/YouCompleteMe#2729. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/808) <!-- Reviewable:end -->
…pleters, r=vheon [READY] Write python used during build before installing completers If ycmd compilation is successful but installing a completer fails, we don't create the `PYTHON_USED_DURING_BUILDING` file. This can be an issue if the user gives up on the completer installation and the client uses the Python from this file to start ycmd (like YCM does). This could explain issue ycm-core/YouCompleteMe#2729. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/808) <!-- Reviewable:end -->
…pleters, r=vheon [READY] Write python used during build before installing completers If ycmd compilation is successful but installing a completer fails, we don't create the `PYTHON_USED_DURING_BUILDING` file. This can be an issue if the user gives up on the completer installation and the client uses the Python from this file to start ycmd (like YCM does). This could explain issue ycm-core/YouCompleteMe#2729. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/808) <!-- Reviewable:end -->
So I am dealing with the issue of trying to get YCM to run using only
(hint, there is no Going to the YCM folder to run
Checking the stderr-log shows:
Steps to reproduce the issue:
If this should be its own issue, please tell me and I will create one. Edit:
|
@Kentoseth Did you install the sudo apt-get install python3-dev |
So I self-diagnosed this issue after finding this: link The problem is cmake 2.8 . Follow these instructions:
then run: and voila, it works! |
@micbou see my answer above. |
Added instructions for cmake3 - Updated Linux64 instructions for older systems where cmake(2.8) might be causing compilation issues. - Using cmake3 may likely address issues (in certain scenarios) # PR Prelude Thank you for working on YCM! :) **Please complete these steps and check these boxes (by putting an `x` inside the brackets) _before_ filing your PR:** - [x] I have read and understood YCM's [CONTRIBUTING][cont] document. - [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document. - [ ] I have included tests for the changes in my PR. If not, I have included a rationale for why I haven't. - [x] **I understand my PR may be closed if it becomes obvious I didn't actually perform all of these steps.** # Why this change is necessary and useful This is a non-code PR adding instructions to the README.md file for situations where `cmake` may be the issue. The instructions simply specify that under certain scenarios, using `cmake3` instead of `cmake` may address the compilation-issues of YCM (eg. on older systems like Ubuntu 14.04). A reference to this issue can be found under the discussion here: [link](#2729 (comment)) [cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md [code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2792) <!-- Reviewable:end -->
Honestly, I got a bit lost in all those Python3-related discussions and PRs that you have here.
Here's a problem I had, its error messages and how to solve it.
On Ubuntu 16.04 xenial,
vim
is Py3-only (-python +python3
). That means, no support for Python 2.7 plugins.On my system, where I compile a lot of people's softwares, there are both
python3.5-dev
andpython2.7-dev
installed.In this situation, the YCM build process (
./install.py --all
) selects py2.7 by default. With the vim support remark above, one can immediately see that this selection is incorrect. Nevertheless, the build completes without error; just doesn't work at all afterwards.Ycm client log says 'Connection refused':
ycmd
error log says:A-ha! "compiled for Python 2 but loaded in Python 3", great!
How do we compile for Python 3 then? Turns out, not so easy with the
./install.py
concoction.Re-run the build, now with
--build-dir BUILD
argument. This creates a directory calledBUILD
. Now, commandccmake BUILD
, and meet the CMake manual build configuration tool (may need toapt install cmake-curses-gui
, whatever).It presents a
USE_PYTHON2=ON
option. Nice, flip it! Hit c to configure. Whoopsies:Doesn't work, damn it!
Okay, it looks like we'll have to resort to typing in library paths manually... In
ccmake
, hit t (or just edit theBUILD/CMakeCache.txt
directly; I guess vimers are not into fancy GUIs), find and set these variables:Hit c, g,
(cd BUILD; ninja)
or(cd BUILD; make)
if you don't have Ninja... aaaand, done.:YcmRestartServer
and you're ready to roll!P.S. Not an actual bug report. Any similarities, explicit or implied, are purely coincidental.
Many thanks for the awesome plugin!
The text was updated successfully, but these errors were encountered: