Monday, March 25, 2024

Help with pynvim for neovim needed

Hello all,


could some patient soul could help me out? I am at the point to give up.

macOS Sonoma 14.4 Intel (2018)

Homebrew newest upgrade

vimr 0.44.0

I am not Python coder (old school: Perl!). So forgive me my innocence. I suppose the modul pynvim should be installed outside of Homebrew?

First what is in my config-file?

~/.config/nvim/init.vim

let g:python3_host_prog='/usr/local/bin/python3'
let g:loaded_python_provider = 0
set pyxversion=3


In Vimr or Neovim :checkhelth I get:

## Python 3 provider (optional)

- INFO: Using: g:python3_host_prog = "/usr/local/bin/python3"
- INFO: Executable: /usr/local/bin/python3
- ERROR: Command error (job=20, exit code 1): `'/usr/local/bin/python3' -c 'import

stderr: Traceback (most recent call last): File "<string>", line 1, in <module>M
- INFO: Python version: 3.12.2
- INFO: pynvim version: unable to load neovim Python module
- ERROR: pynvim is not installed.

Error: unable to load neovim Python module
- ADVICE:

- Run in shell: /usr/local/bin/python3 -m pip install pynvim

But this advice to install with pip (or pip3) is meanwhile deprecated. My attempts to install it, little excerpt look like this:

$ which python
python not found

$ which python3
/usr/local/bin/python3
$ which pip3
/usr/local/bin/pip3

$ brew uninstall python3 # if I remember well with -force
$ brew install python3
$ ll `which python3`
lrwxr-xr-x 1 mstep admin 42B 24 Mar 18:20 /usr/local/bin/python3@ -> ../Cellar/python@3.12/3.12.2_1/bin/python3
$ ll `which pip3`
lrwxr-xr-x 1 mstep admin 39B 24 Mar 18:20 /usr/local/bin/pip3@ -> ../Cellar/python@3.12/3.12.2_1/bin/pip3

$ /usr/local/bin/python3 -m pip install pynvim
error: externally-managed-environment

$ brew install python3
× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.

If you wish to install a non-brew-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.

If you wish to install a non-brew packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Same error with:
$ pip3 install pynvim
$ pip3 install --upgrade pynvim

I tried to copy the pynvim from python3.11 to python3.12 (don't shout on me!)

$ cp -r python3.11/site-packages/pynvim python3.12/site-packages
$ cp -r python3.11/site-packages/pynvim-0.5.0.dist-info python3.12/site-packages

Ok! that means I have to create a virtual environment for python-packages!
Where you suggest to put the python packages? What path to use for the virtualenv of python?

I tried with:

$ brew install pipx
$ pipx install pynvim
No apps associated with package pynvim or its dependencies. If you are attempting to install a library, pipx should
not be used. Consider using pip or a similar tool instead.

Please a little hint! I would be very grateful for any help


marek






--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/9B85DBD0-C60D-4DA8-88C3-74749960BF70%40googlemail.com.

No comments:

Post a Comment