Reputation: 223
I've followed these instructions, in order to install YouCompleteMe in Vim, but when I issue:
./install.py --clang-completer
The following error message comes up:
Searching Python 2.7 libraries...
ERROR: found static Python library (/usr/local/lib/python2.7/config/libpython2.7.a) but a dynamic one is required. You must use a Python compiled with the --enable-shared flag. If using pyenv, you need to run the command:
export PYTHON_CONFIGURE_OPTS="--enable-shared"
before installing a Python version.
Traceback (most recent call last):
File "./install.py", line 44, in <module>
Main()
File "./install.py", line 33, in Main
subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', u'/home/anmol/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py', '--clang-completer']' returned non-zero exit status 1
and now I'm stuck, what should I do?
Upvotes: 11
Views: 7486
Reputation: 2703
I checked YouCompleteMe's build system and it uses a custom build script that uses the Python module distutils
to find the paths to Python's library and include directories. Your /usr/local/
installation of Python is probably included in your PATH
variable before the official /usr
installation so just running python
probably runs your custom installation, making distutils
return its directories.
To check whether this is true, try running which python
. I assume it will return something like /usr/local/bin/python
.
At this point, I see several options (in order of preference).
Try running YCM's install script by specifying which Python executable should run it explicitly: /usr/bin/python ./install.py --clang-completer
If you use any additional completers with YCM, you should add the appropriate flags to the above line (e.g. --js-completer
for JavaScript completion).
Edit the script third_party/ycmd/build.py
in YouCompleteMe's plugin directory to hardcode the paths for your custom Python installation. For instance, you could replace the existing FindPythonLibraries
function with the following:
def FindPythonLibraries():
return ('/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so',
'/usr/include/python2.7')
Note that this will make it harder to update YouCompleteMe since you'll have to ensure it doesn't get overwritten when you update its source.
dpkg -S /usr/local/lib/python2.7/config/libpython2.7.a
. This command will tell you which package installed that file, unless you installed it manually (bypassing the package manager)./usr/local
Python installation while ensuring you have a Python from the official repositories installed (packages python2.7
and libpython2.7
).In the long run, you would probably be better off by using the official Python packages.
Upvotes: 25
Reputation: 1066
The plugin builds for me on the same operating system. The relevant line from the configuration looks like this:
Found PythonLibs: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
The shared object can be identified as belonging to libpython2.7
package:
apt-file search /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
libpython2.7: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
So I would check if you have the file named, if not try sudo apt install libpython2.7
, and otherwise try moving away the static version, or let us know how you installed Python.
Upvotes: 0