Skip to content

Wrong Python version somehow is used #1581

@dmitry-kabanov

Description

@dmitry-kabanov

Hi, I have Vim 9.1 installed via the Linuxbrew package manager in Ubuntu 24.04. It is linked against Python 3.13 which is also installed via Linuxbrew.

I work on a project that uses Conda to have project-specific Python, so that in the project directory my $PATH looks like this:

➜ where python3
$HOME/sw/miniforge3/envs/um02-open-interfaces/bin/python3
/home/linuxbrew/.linuxbrew/bin/python3
/usr/bin/python3
/bin/python3

where the first pytho3n is project-specific, while the second is the one that Vim is linked to.

However, someohow UltiSnips uses the project-specific Python and crashes because of that.
When I start Vim, and do the following command:

py3 import UltiSnips

I get the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "$HOME/.vim/plugged/ultisnips/pythonx/UltiSnips/__init__.py", line 6, in <module>
    from UltiSnips.snippet_manager import UltiSnips_Manager
  File "$HOME/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 14, in <module>
    from UltiSnips import err_to_scratch_buffer
  File "$HOME/.vim/plugged/ultisnips/pythonx/UltiSnips/err_to_scratch_buffer.py", line 8, in <module>

    from bdb import BdbQuit
  File "$HOME/sw/miniforge3/envs/um02-open-interfaces/lib/python3.13/bdb.py", line 7, in <module>
    from inspect import CO_GENERATOR, CO_COROUTINE, CO_ASYNC_GENERATOR
  File "$HOME/sw/miniforge3/envs/um02-open-interfaces/lib/python3.13/inspect.py", line 146, in <modul
e>
    import dis
  File "$HOME/sw/miniforge3/envs/um02-open-interfaces/lib/python3.13/dis.py", line 8, in <module>
    from opcode import *
  File "$HOME/sw/miniforge3/envs/um02-open-interfaces/lib/python3.13/opcode.py", line 12, in <module>

    import _opcode
ImportError: $HOME/sw/miniforge3/envs/um02-open-interfaces/lib/python3.13/lib-dynload/_opcode.cpython
-313-x86_64-linux-gnu.so: undefined symbol: _Py_GetExecutor

If I start vim like this:

PATH=/home/linuxbrew/.linuxbrew/bin:$PATH vim

then it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions