Thursday, March 28, 2024

Re: Help with pynvim for neovim needed

> What I did not understand, why this pynvim is under Python3.11 and not under active Python3.12.

Maybe the pip command was installed under Python 3.11. Afterwards python3 was updated to Python 3.12, but pip still relies on python3.11 ?
For example, here

less `which pip` | head -2

shows

#!/usr/bin/python3.11
Le mercredi 27 mars 2024 à 19:59:36 UTC+1, Marek Stepanek a écrit :
Thx Enno for the reply. I meanwhile could resolve the problem. I activated a virtual environment for Python with the help of https://python.land/virtual-environments/virtualenv#google_vignette

Here shortly the commands I entered (if somebody is looking for this problem):

being the the folder of /usr/local/Cellar

mkdir -p python/myenv
virtualenv python/myenv
created virtual environment CPython3.11.8.final.0-64 in 793ms
creator CPython3macOsBrew(dest=/usr/local/Cellar/python/myenv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/mstep/Library/Application Support/virtualenv)
added seed packages: pip==24.0, setuptools==69.1.0, wheel==0.42.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

source python/myenv/bin/activate

pip3 install --upgrade pynvim
Collecting pynvim
Using cached pynvim-0.5.0-py2.py3-none-any.whl.metadata (469 bytes)
Collecting msgpack>=0.5.0 (from pynvim)
Downloading msgpack-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl.metadata (9.1 kB)
Collecting greenlet>=3.0 (from pynvim)
Using cached greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl.metadata (3.8 kB)
Using cached pynvim-0.5.0-py2.py3-none-any.whl (45 kB)
Using cached greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl (271 kB)
Downloading msgpack-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 2.4 MB/s eta 0:00:00
Installing collected packages: msgpack, greenlet, pynvim
Successfully installed greenlet-3.0.3 msgpack-1.0.8 pynvim-0.5.0

/usr/local/bin/python3 -m pip install pynvim


/usr/local/Cellar/python/myenv/bin $ pip3 install --upgrade pynvim
Requirement already satisfied: pynvim in /usr/local/Cellar/python/myenv/lib/python3.11/site-packages (0.5.0)
Requirement already satisfied: msgpack>=0.5.0 in /usr/local/Cellar/python/myenv/lib/python3.11/site-packages (from pynvim) (1.0.8)
Requirement already satisfied: greenlet>=3.0 in /usr/local/Cellar/python/myenv/lib/python3.11/site-packages (from pynvim) (3.0.3)

What I did not understand, why this pynvim is under Python3.11 and not under active Python3.12. I have had to adapt my init.vim with:

let g:python3_host_prog='/usr/local/bin/python3' => let g:python3_host_prog='/usr/local/bin/python3.11'

VimR and Neovim is working now.


Thx for your patience


marek


> On 26. Mar 2024, at 10:38, Enno <enno....@gmail.com> wrote:
>
> It is not clear what is to be achieved, but for Python support in Vim one should ensure that `!python3 -V`, and `:python3 import sys; print(sys.version)")` coincide. For Neovim, I'd refer to the experts at https://github.com/neovim/neovim/issues/
>
> Le lundi 25 mars 2024 à 17:55:45 UTC+1, Marek Stepanek a écrit :
> 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/pyt...@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/pyt...@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+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4e1f60e4-af0e-4f69-a2d7-e159f0013c49n%40googlegroups.com.


--
--
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/74755507-a210-4abb-99ed-72f0220c060en%40googlegroups.com.

Wednesday, March 27, 2024

Re: Help with pynvim for neovim needed

Thx Enno for the reply. I meanwhile could resolve the problem. I activated a virtual environment for Python with the help of https://python.land/virtual-environments/virtualenv#google_vignette

Here shortly the commands I entered (if somebody is looking for this problem):

being the the folder of /usr/local/Cellar

mkdir -p python/myenv
virtualenv python/myenv
created virtual environment CPython3.11.8.final.0-64 in 793ms
creator CPython3macOsBrew(dest=/usr/local/Cellar/python/myenv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/mstep/Library/Application Support/virtualenv)
added seed packages: pip==24.0, setuptools==69.1.0, wheel==0.42.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

source python/myenv/bin/activate

pip3 install --upgrade pynvim
Collecting pynvim
Using cached pynvim-0.5.0-py2.py3-none-any.whl.metadata (469 bytes)
Collecting msgpack>=0.5.0 (from pynvim)
Downloading msgpack-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl.metadata (9.1 kB)
Collecting greenlet>=3.0 (from pynvim)
Using cached greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl.metadata (3.8 kB)
Using cached pynvim-0.5.0-py2.py3-none-any.whl (45 kB)
Using cached greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl (271 kB)
Downloading msgpack-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 2.4 MB/s eta 0:00:00
Installing collected packages: msgpack, greenlet, pynvim
Successfully installed greenlet-3.0.3 msgpack-1.0.8 pynvim-0.5.0

/usr/local/bin/python3 -m pip install pynvim


/usr/local/Cellar/python/myenv/bin $ pip3 install --upgrade pynvim
Requirement already satisfied: pynvim in /usr/local/Cellar/python/myenv/lib/python3.11/site-packages (0.5.0)
Requirement already satisfied: msgpack>=0.5.0 in /usr/local/Cellar/python/myenv/lib/python3.11/site-packages (from pynvim) (1.0.8)
Requirement already satisfied: greenlet>=3.0 in /usr/local/Cellar/python/myenv/lib/python3.11/site-packages (from pynvim) (3.0.3)

What I did not understand, why this pynvim is under Python3.11 and not under active Python3.12. I have had to adapt my init.vim with:

let g:python3_host_prog='/usr/local/bin/python3' => let g:python3_host_prog='/usr/local/bin/python3.11'

VimR and Neovim is working now.


Thx for your patience


marek


> On 26. Mar 2024, at 10:38, Enno <enno.nagel@gmail.com> wrote:
>
> It is not clear what is to be achieved, but for Python support in Vim one should ensure that `!python3 -V`, and `:python3 import sys; print(sys.version)")` coincide. For Neovim, I'd refer to the experts at https://github.com/neovim/neovim/issues/
>
> Le lundi 25 mars 2024 à 17:55:45 UTC+1, Marek Stepanek a écrit :
> 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/pyt...@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/pyt...@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/4e1f60e4-af0e-4f69-a2d7-e159f0013c49n%40googlegroups.com.


--
--
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/5166613D-059C-4D23-BA95-AF3DA7F63261%40googlemail.com.

Tuesday, March 26, 2024

Re: Help with pynvim for neovim needed

This mailing list is dedicated to Vim. If you use Neovim, use their official support channels.

On Tuesday, March 26, 2024 at 10:38:35 AM UTC+1 Enno wrote:
It is not clear what is to be achieved, but for Python support in Vim one should ensure that `!python3 -V`, and `:python3 import sys; print(sys.version)")` coincide. For Neovim, I'd refer to the experts at https://github.com/neovim/neovim/issues/

Le lundi 25 mars 2024 à 17:55:45 UTC+1, Marek Stepanek a écrit :
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/pyt...@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/pyt...@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/0e4f6c7e-dd13-41fa-b9a6-2f8c64ab6646n%40googlegroups.com.

Re: Help with pynvim for neovim needed

It is not clear what is to be achieved, but for Python support in Vim one should ensure that `!python3 -V`, and `:python3 import sys; print(sys.version)")` coincide. For Neovim, I'd refer to the experts at https://github.com/neovim/neovim/issues/

Le lundi 25 mars 2024 à 17:55:45 UTC+1, Marek Stepanek a écrit :
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/pyt...@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/pyt...@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/4e1f60e4-af0e-4f69-a2d7-e159f0013c49n%40googlegroups.com.

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.

Saturday, March 23, 2024

Re: Nested Classes — thoughts and workarounds

Ooph! Thank you!!

I wish I knew about your libparser before I started down the regex jungle trying to parse the protobuf structure. I will finish this as a v1 with caveman regex then port to libparser for a v2.

SearchResponseResult is a good idea as well.

Thank you.


- Igbanam

On Sat, Mar 23, 2024 at 1:41 PM Lifepillar <lifepillar@lifepillar.me> wrote:
On 2024-03-22, Igbanam Ogbuluijah <xigbanam@gmail.com> wrote:
> Hello community,
>
> I've been playing with some idea which has brought me to needing Nested
> Classes in Vim. I am curious what you think about this? Would this be too
> much for Vimscript? If not, what current workarounds would you suggest?

I don't think Vim 9 script needs or would gain anything for such
extensions.

> Context: I'm taking a stab at parsing protobuf definitions into Vim 9
> classes. Nested messages in the protobuf demands
><https://arc.net/l/quote/qfcssecm> nested structs/classes.

Something like:

  message SearchResponse {
    message Result {
      string url = 1;
      string title = 2;
      repeated string snippets = 3;
    }
    repeated Result results = 1;
  }

becomes two classes/structs `SearchResponse` and `SearchResponse_Result`
in the target languages I've looked at. In Vim, you could do the same:

    interface Message
    endinterface

    class SearchResponseResult implements Message
      var url: string
      var title: string
      var snippets: list<string>
    endclass

    class SearchResponse implements Message
      var results: list<SearchResponseResult>
    endclass

That seems the most straightforward approach to me.

If you don't care about typing (but wouldn't that defeat the purpose of
protobuf?), you may simply use dictionaries, which can be arbitrarily
nested.

If your problem is parsing, libparser might help:

    https://github.com/lifepillar/vim-devel

Protobuf's grammar seems simple enough. You might even go fancy and
generate parsers from messages, which would be able to parse the
corresponding messages.

I don't see any reason to keep using Vim legacy script for new Vim
scripts.

Hope this helps,
Life.

--
--
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/utmm5o%2412c1%241%40ciao.gmane.io.

--
--
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/CAOmRJrdJvbou%3Di0k6iWePH_uvzfVBsf1Wkbt5Jc0s%2BRTkbNjqA%40mail.gmail.com.

Re: Nested Classes — thoughts and workarounds

On 2024-03-22, Igbanam Ogbuluijah <xigbanam@gmail.com> wrote:
> Hello community,
>
> I've been playing with some idea which has brought me to needing Nested
> Classes in Vim. I am curious what you think about this? Would this be too
> much for Vimscript? If not, what current workarounds would you suggest?

I don't think Vim 9 script needs or would gain anything for such
extensions.

> Context: I'm taking a stab at parsing protobuf definitions into Vim 9
> classes. Nested messages in the protobuf demands
><https://arc.net/l/quote/qfcssecm> nested structs/classes.

Something like:

message SearchResponse {
message Result {
string url = 1;
string title = 2;
repeated string snippets = 3;
}
repeated Result results = 1;
}

becomes two classes/structs `SearchResponse` and `SearchResponse_Result`
in the target languages I've looked at. In Vim, you could do the same:

interface Message
endinterface

class SearchResponseResult implements Message
var url: string
var title: string
var snippets: list<string>
endclass

class SearchResponse implements Message
var results: list<SearchResponseResult>
endclass

That seems the most straightforward approach to me.

If you don't care about typing (but wouldn't that defeat the purpose of
protobuf?), you may simply use dictionaries, which can be arbitrarily
nested.

If your problem is parsing, libparser might help:

https://github.com/lifepillar/vim-devel

Protobuf's grammar seems simple enough. You might even go fancy and
generate parsers from messages, which would be able to parse the
corresponding messages.

I don't see any reason to keep using Vim legacy script for new Vim
scripts.

Hope this helps,
Life.

--
--
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/utmm5o%2412c1%241%40ciao.gmane.io.