Vim could not load libpython3.7m.a with python3 from Anaconda - python-3.x

I'm trying to use Anaconda python3.7 + vim 8.1 + jedi-vim on Rocks 7.0 (Manzanita) but I get an error saying that libpython3.7m.a cannot be loaded and I can't find a solution.
First things first. I have to compile vim by myself because the vim installed by default has only +python and I have to use python3.
I cloned the git and, following several other suggestions found online I configure vim with
./configure --enable-cscope --enable-multibyte --enable-python3interp=dynamic --with-features=huge --with-python-config-dir=/home/mazzi/miniconda3/lib/python3.7/config-3.7m-x86_64-linux-gnu --with-tlib=ncurses --enable-fail-if-missing --prefix=/home/mazzi/.local
The prefix is due to the fact that I don't have root access and its output of can be found here. Please note that during the whole procedure I had to stay inside a conda environment, otherwise the configuration would fail saying that no python3 was found.
I then make, with this output, and make install with this other output.
I check vim version and everything seems ok.
Finally, I start vim normally (/home/mazzi/.local/bin is on the PATH, before the system paths, and the vim command points to ~/.local/bin/vim) and type :py3 pass but I get the following error:
E370: Could not load library libpython3.7m.a
E263: Sorry, this command is disabled, the Python library could not be loaded.
What can I do?
Additional info
Some of my sources:
https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source (without sudo and just to be clear I did not try YouCompleteMe due to some issues in the past that forced me to go to jedi-vim)
https://gist.github.com/hxhc/778d7c3a3ad491dedf3675a47275a979
Compiling vim 8.0 with Python 3 support resulting in SIGABRT
https://github.com/Valloric/YouCompleteMe/issues/2855#issuecomment-352181535

Related

Flymake config error while opening python file but correctly setup flake

When I'm opening a python file in emacs I get the following error message:
Flymake: Configuration error has occured while running (flake8 >..../xyz_flymake.py). Flymake will be switched OFF.
But on the other hand it seems I've configured all the modules needed for elpy to work properly:
Elpy Configuration
Virtualenv........: None
RPC Python........: 3.5.3 (/usr/bin/python3.5)
Interactive Python: /usr/bin/python3.5 (/usr/bin/python3.5)
Emacs.............: 24.5.1
Elpy..............: 1.10.0
Jedi..............: 0.10.2
Rope..............: 0.10.5
Importmagic.......: 0.1.7
Autopep8..........: 0.1.7
Syntax checker....: flake8 (/usr/local/bin/flake8)
You have not activated a virtual env. While Elpy supports this, it is
often a good idea to work inside a virtual env. You can use M-x
pyvenv-activate or M-x pyvenv-workon to activate a virtual env.
The directory ~/.local/bin/ is not in your PATH. As there is no active
virtualenv, installing Python packages locally will place executables
in that directory, so Emacs won't find them. If you are missing some
commands, do add this directory to your PATH.
Options
`Raised' text indicates buttons; type RET or click mouse-1 on a button
to invoke its action. Invoke [+] to expand a group, and [-] to
collapse an expanded group. Invoke the [Group], [Face], and [Option]
buttons below to edit that item in another window.
How can I resolve this issue?
It is unclear what the configuration error is. It's possible that you're running into one of many issues.
You seem to want to use Python 3.5, but there's no clear indicator of what version of Python Flake8 is running on. It could be that elpy is detecting a mismatch and refusing to use Flake8 when it won't provide you any useful information. (Flake8 must be installed on the same version of Python that the code is intended to run on.)
Elpy seems insistent that you use a virtualenv or that you add ~/.local/bin/ to your PATH. I would advise doing both.
You can create a virtualenv by doing virtualenv ~/.elpy-venv and activate it with source ~/.elpy-venv/bin/activate.
You can edit your Shell's configuration file (e.g., ~/.bashrc, ~/.bash_profile, ~/.zshrc, etc.) to do export PATH="$PATH:~/.local/bin".

ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need to compile YCM before using it

orror in compile prses. how to solve it?
According to this blog post, you just have to compile the YouCompleteMe modules by running the install.sh script in the YCM install.
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
Once this completes you should be able to install the plugin (here's how to do it with Vundle). Once in Vim
:source ~/.vimrc
:PluginInstall
Apparently, when you run ./.install.sh --clang-completer it says that it is "out of date."
I ran python2 install.py and it worked for me. (I believe it was python2.)
Also, I had was using vim and neovim, and I decided to do ./install.sh --clang-completer inside my ~/.vim/bundle/Vundle.vim/ and at the same tim decided to do python2 install.py inside my ~/.configs/nvim/bundle/Vundle.vim/ and the python install installed faster and did the same thing.
The difference might be that you need to "compile vim with pdython support," but the simple fix for that is installing python-nvim (if using neovim), or - I think - vim just comes with python support. (? maybe.)
I encountered the same error message when trying out new neovim installation. In my case, it was because I was using vim-plugin and the plugins are installed in the ~/.vim/plugged instead of ~/.vim/bundle (this is the plugin folder for Vundle before I switched to vim-plug).
Thus, after scratching my head for few hours, turns out I have to run install.sh in the ~/.vim/plugged (not ~/.vim/bundle). I hope this will save someone's time.

VIM installation and Anaconda

I'm using Anaconda and have an environment for Python27 and in the near future, one for Python3.
I ran into trouble with vim using rope, b/c my original build was linked to my /usr/local/vim ( i think..or something close to that).
I realized from reading, that i should re-build vim with:
./configure --enable-pythoninterp --with-python-config-dir=/home/wbg/anaconda/envs/py27/lib/python2.7/config --enable-prefix=/home/wbg
So I'm wondering, if there's a better way to install vim, so that when I change Anaconda environments, my vim will change too.
TIA !
This is an old question, but I find this very useful, so I share it here.
conda forged vim takes care of conda envs and python linking:
conda install -c conda-forge vim
For more information: https://anaconda.org/conda-forge/vim
Vim can be built in four ways:
No Python support (-python, -python3)
Python 2 support only (+python or +python/dyn, -python3)
Python 3 support only (-python, +python3 or +python3/dyn)
Python 2 and 3 support (+python/dyn, +python3/dyn)
I think you should opt for the last option; but, this choice brings some extra headaches. When Python 2 and Python 3 are both supported they must be loaded dynamically. And, you will not be able to use Python 2 or 3 in the same Vim session. You can build with both, but once one version of python is invoked in Vim the other cannot.
On windows, you'll want to enable dynamic loading of the python interpreter. If python is found in the path, it will be useable in vim. This frees you up from worrying where python is installed. For example:
./configure --with-features=huge --enable-pythoninterp=dynamic --enable-python3interp=dynamic
On Debian-based systems, to build both versions of python you'll need to use something like:
./configure --enable-pythoninterp=dynamic --with-python-config-dir=$(shell python-config --configdir) -enable-python3interp=dynamic --with-python3-config-dir=$(shell python3-config --configdir)
(For extra details see: https://askubuntu.com/questions/585237/whats-the-easiest-way-to-get-vim-with-python-3-support).

vim 7.3 upgrade sets runtimepath to nonexistent path

Hi i have vim6 and upgraded to vim7.
I have both versions. vim6 runs fine.
Upgraded vim7 runtimepath has
/usr/local/share/vim/... this path does not exist, contain anyfiles
I am trying to get the colorscheme to work. When I set syntax on, I get that /usr/local/share/vim/syntax/syntax.vim not found error.
So i found the syntax.vim at ~/vim/runtime/syntax/syntax.vim
So I updated the runtimepath using
execute pathogen#infect('bundle/{}', '~/vim/runtime/{}')
the old vim still works, and has updated runtimepath. the new vim73 still has the updated runtimepaths , but when on syntax on it gives an error looking for the file at the old path that never existed.
so how do i remove path from the runtimepath
i also
thanks
edit
upgrade was to 7.4 from 7.3.547
compiled with python as follows:
./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/
make
hack
whats wrong with just ln -s ~/vim/runtime/ /usr/local/share/vim/ ?
or just copy the file that i need to get syntax, and hopefully color ..
With a path of /usr/local/share/..., it looks like you've compiled Vim yourself from the sources. sudo make install should have taken care of the copying of the runtime files to that location. What you did with Pathogen is definitely not the right way to fix it.
Unless you're on a very old or poorly maintained Linux distribution, it should be possible to obtain a current Vim package (that is, a 7.4 version) through your distribution's package manager (on Debian-based systems, it's commonly called vim-gnome). Unless you need to have the bleeding edge version (unlikely in your case with the former Vim 6), or incorporate custom patches, that is the easy and recommended approach.

no python3 support for brew macvim

For some reason macvim installed with brew doesn't have the python3 support. Here is how I installed it:
brew install macvim --with-cscope --with-python3
Whenever I run
:echo has('python3')
The result is 0, meaning there is no python3 support. Does anybody know what is the problem? Any help is appreciated.
Python 3 is deliberately disabled in the macvim recipe in homebrew.
You can, however, run "brew edit macvim" and fix up the recipe so it works.
I recommend the following actions (which have worked for me):
Use the current MacVim 7.4 snapshot 72 (update the url and sha1). brew still has older snapshot 71.
sha1 '3fb5b09d7496c8031a40e7a73374424ef6c81166'
Delete all the patches from the end of the recipe. The last line should be __END__. None of the patches are necessary anymore - ruby support was fixed upstream in snapshot 72.
depends_on :python3 => :recommended
in the install function, when its messing with the args, fixup the python section like so:
args << "--enable-python3interp=yes" if build.with? 'python3'
ENV.prepend 'LDFLAGS', "-L#{python3.libdir} -F#{python3.framework} -framework Ruby" if python3 && python3.brewed?
Ensure you use a homebrew python3 and if you have upgraded to Mavericks, re-brew absolutely everything - the stdc++ library has changed and you cannot mix old and new when linking.
brew it with:
$ brew install --HEAD macvim
$ mvim --version # to ensure it has all the right things linked
I've run through ultisnips and vinarise, both of which work and neither of which caused the window to mysteriously disappear as previously lamented in the recipe for macvim & python3. I've also done other basic testing with :py3 command. No issues seen (yet)

Resources