davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.27k stars 370 forks source link

Fails to launch on NetBSD with hashlib python errors #1122

Closed llamallama closed 2 months ago

llamallama commented 2 months ago

Issue

Steps to reproduce

With a fresh vim install with jedi-vim cloned (including submodules) into ~/.vim/pack/plugins/start/jedi-vim, I get the following errors when running vim test.py

Error detected while processing BufNewFile Autocommands for "*.py"..FileType Autocommands for "*"..function <SNR>4_LoadFTPlugin[18]..script /home/chris/.vim_runtime/pack/plugins/start/jedi-vim/ftplugin/python/jedi
.vim[1]../home/chris/.vim_runtime/pack/plugins/start/jedi-vim/autoload/jedi.vim[261]..function jedi#init_python[13]..BufNewFile Autocommands for "*.py"..FileType Autocommands for "*"..function <SNR>4_LoadFTPlugin[
18]..script /home/chris/.vim_runtime/pack/plugins/start/jedi-vim/ftplugin/python/jedi.vim[1]../home/chris/.vim_runtime/pack/plugins/start/jedi-vim/autoload/jedi.vim[261]..function jedi#init_python[4]..<SNR>119_ini
t_python[6]..jedi#setup_python_imports:
line   18:
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
ERROR:root:code for hash blake2b was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2b
ERROR:root:code for hash blake2s was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2s
ERROR:root:code for hash sha3_224 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_224
ERROR:root:code for hash sha3_256 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_384
ERROR:root:code for hash sha3_512 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_512
ERROR:root:code for hash shake_128 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_128
ERROR:root:code for hash shake_256 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_256
Error detected while processing BufNewFile Autocommands for "*.py"..FileType Autocommands for "*"..function <SNR>4_LoadFTPlugin[18]..script /home/chris/.vim_runtime/pack/plugins/start/jedi-vim/ftplugin/python/jedi
.vim:
line   40:
E117: Unknown function: jedi#configure_call_signatures

minimal.vimrc file used

set nocompatible

let script_dir = fnamemodify(expand('<sfile>'), ':h')
let &runtimepath .= ','.script_dir.','.script_dir.'/after'

" Put your config changes here.
" let g:jedi#show_call_signatures=1

syntax on
filetype plugin indent on

Output of “:verbose JediDebugInfo”


#### Jedi-vim debug information

##### jedi-vim version

 - jedi-vim git version: v0.11.2-4-g9bd79ee
 - jedi git submodule status:  4e175ca82bbd680cb90f462545c10a8b1c0b5f2e pythonx/jedi (v0.19.1)
 - parso git submodule status:  ee5edaf22ff3941cbdfa4efd8cb3e8f69779fd56 pythonx/parso (v0.8.3)

##### Global Python

Using Python version 3 to access Jedi.
 - global sys.executable: ``
 - global sys.version: `3.11.7 (main, Mar 11 2024, 01:07:07) [GCC 10.5.0]`
 - global site module: `/usr/pkg/lib/python3.11/site.py`
ERROR: could not import the "jedi" Python module: ImportError: /usr/pkg/lib/python3.11/lib-dynload/_struct.so: Undefined PLT symbol "PyTuple_New" (symnum = 2)
  Traceback (most recent call last):
    File "/home/chris/.vim/pack/plugins/start/jedi-vim/pythonx/jedi_vim.py", line 116, in <module>
      import jedi
    File "/home/chris/.vim/pack/plugins/start/jedi-vim/pythonx/jedi/jedi/__init__.py", line 32, in <module>
      from jedi.api import Script, Interpreter, set_debug_function, preload_module
    File "/home/chris/.vim/pack/plugins/start/jedi-vim/pythonx/jedi/jedi/api/__init__.py", line 13, in <module>
      import parso
    File "/home/chris/.vim/pack/plugins/start/jedi-vim/pythonx/parso/parso/__init__.py", line 42, in <module>
      from parso.grammar import Grammar, load_grammar
    File "/home/chris/.vim/pack/plugins/start/jedi-vim/pythonx/parso/parso/grammar.py", line 13, in <module>
      from parso.cache import parser_cache, load_module, try_to_save_module
    File "/home/chris/.vim/pack/plugins/start/jedi-vim/pythonx/parso/parso/cache.py", line 10, in <module>
      import pickle
    File "/usr/pkg/lib/python3.11/pickle.py", line 33, in <module>
      from struct import pack, unpack
    File "/usr/pkg/lib/python3.11/struct.py", line 13, in <module>
      from _struct import *

##### Settings

\`\`\`
  omnifunc=python3complete#Complete
        Last set from /usr/pkg/share/vim/vim90/ftplugin/python.vim line 42
  completeopt=menuone,longest,popup
        Last set from ~/.vim/pack/plugins/start/jedi-vim/plugin/jedi.vim line 38
\`\`\`

#### :version
\`\`\`
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 27 2024 20:13:46)
Included patches: 1-2122
Modified by morr@NetBSD.org
Compiled by chris@ibook-bsd.int.pipetogrep.org
Huge version without GUI.  Features included (+) or not (-):
+acl               -clientserver      +diff              +folding           +langmap           +mouse_dec         +num64             +reltime           +syntax            +title             +wildmenu
+arabic            -clipboard         +digraphs          -footer            +libcall           -mouse_gpm         +packages          +rightleft         +tag_binary        -toolbar           +windows
+autocmd           +cmdline_compl     -dnd               +fork()            +linebreak         -mouse_jsbterm     +path_extra        -ruby              -tag_old_static    +user_commands     +writebackup
+autochdir         +cmdline_hist      -ebcdic            +gettext           +lispindent        +mouse_netterm     -perl              +scrollbind        -tag_any_white     +vartabs           -X11
-autoservername    +cmdline_info      +emacs_tags        -hangul_input      +listcmds          +mouse_sgr         +persistent_undo   +signs             -tcl               +vertsplit         +xattr
-balloon_eval      +comments          +eval              +iconv             +localmap          -mouse_sysmouse    +popupwin          +smartindent       +termguicolors     +vim9script        -xfontset
+balloon_eval_term +conceal           +ex_extra          +insert_expand     -lua               +mouse_urxvt       +postscript        -sodium            +terminal          +viminfo           -xim
-browse            +cryptv            +extra_search      +ipv6              +menu              +mouse_xterm       +printer           -sound             +terminfo          +virtualedit       -xpm
++builtin_terms    +cscope            -farsi             +job               +mksession         +multi_byte        +profile           +spell             +termresponse      +visual            -xsmp
+byte_offset       +cursorbind        +file_in_path      +jumplist          +modify_fname      +multi_lang        -python            +startuptime       +textobjects       +visualextra       -xterm_clipboard
+channel           +cursorshape       +find_in_path      +keymap            +mouse             -mzscheme          +python3           +statusline        +textprop          +vreplace          -xterm_save
+cindent           +dialog_con        +float             +lambda            -mouseshape        +netbeans_intg     +quickfix          -sun_workshop      +timers            +wildignore
   system vimrc file: "/usr/pkg/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/pkg/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -I/usr/include -I/usr/pkg/include/python3.11 -O2 -I/usr/include -I/usr/pkg/include/python3.11 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-zrelro -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -Wl,--as-needed -o vim -lm -lelf -ltermcap -liconv -lintl -L/usr/pkg/lib/python3.11/config-3.11 -lpython3.11 -lintl -lpthread -lutil -lm
\`\`\`

#### :messages
\`\`\`
Error detected while processing /home/chris/.vim/pack/plugins/start/jedi-vim/minimal.vimrc[9]../usr/pkg/share/vim/vim90/syntax/syntax.vim[44]..BufRead Autocommands for "*.py"..FileType Autocommands for "*"..Syntax
 Autocommands for "*"..function <SNR>3_SynSet[25]..script /home/chris/.vim/pack/plugins/start/jedi-vim/after/syntax/python.vim[1]../home/chris/.vim/pack/plugins/start/jedi-vim/autoload/jedi.vim[261]..function jedi
#init_python[13]../home/chris/.vim/pack/plugins/start/jedi-vim/minimal.vimrc[9]../usr/pkg/share/vim/vim90/syntax/syntax.vim[44]..BufRead Autocommands for "*.py"..FileType Autocommands for "*"..Syntax Autocommands 
for "*"..function <SNR>3_SynSet[25]..script /home/chris/.vim/pack/plugins/start/jedi-vim/after/syntax/python.vim[1]../home/chris/.vim/pack/plugins/start/jedi-vim/autoload/jedi.vim[261]..function jedi#init_python[4
]..<SNR>9_init_python[6]..jedi#setup_python_imports:
line   18:
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
ERROR:root:code for hash blake2b was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2b
ERROR:root:code for hash blake2s was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2s
ERROR:root:code for hash sha3_224 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_224
ERROR:root:code for hash sha3_256 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_256
ERROR:root:code for hash sha3_384 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_384
ERROR:root:code for hash sha3_512 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_512
ERROR:root:code for hash shake_128 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_128
ERROR:root:code for hash shake_256 was not found.
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.11/hashlib.py", line 307, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_256
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 27 2024 20:13:46)
\`\`\`
<details><summary>:scriptnames</summary>

\`\`\`
  1: ~/.vim/pack/plugins/start/jedi-vim/minimal.vimrc
  2: /usr/pkg/share/vim/vim90/syntax/syntax.vim
  3: /usr/pkg/share/vim/vim90/syntax/synload.vim
  4: /usr/pkg/share/vim/vim90/syntax/syncolor.vim
  5: /usr/pkg/share/vim/vim90/colors/lists/default.vim
  6: /usr/pkg/share/vim/vim90/filetype.vim
  7: /usr/pkg/share/vim/vim90/syntax/python.vim
  8: ~/.vim/pack/plugins/start/jedi-vim/after/syntax/python.vim
  9: ~/.vim/pack/plugins/start/jedi-vim/autoload/jedi.vim
 10: /usr/pkg/share/vim/vim90/ftplugin.vim
 11: /usr/pkg/share/vim/vim90/indent.vim
 12: /usr/pkg/share/vim/vim90/plugin/getscriptPlugin.vim
 13: /usr/pkg/share/vim/vim90/plugin/gzip.vim
 14: /usr/pkg/share/vim/vim90/plugin/logiPat.vim
 15: /usr/pkg/share/vim/vim90/plugin/manpager.vim
 16: /usr/pkg/share/vim/vim90/plugin/matchparen.vim
 17: /usr/pkg/share/vim/vim90/plugin/netrwPlugin.vim
 18: /usr/pkg/share/vim/vim90/plugin/rrhelper.vim
 19: /usr/pkg/share/vim/vim90/plugin/spellfile.vim
 20: /usr/pkg/share/vim/vim90/plugin/tarPlugin.vim
 21: /usr/pkg/share/vim/vim90/plugin/tohtml.vim
 22: /usr/pkg/share/vim/vim90/plugin/vimballPlugin.vim
 23: /usr/pkg/share/vim/vim90/plugin/zipPlugin.vim
 24: ~/.vim/pack/plugins/start/jedi-vim/plugin/jedi.vim
 25: /usr/pkg/share/vim/vim90/ftplugin/python.vim
 26: ~/.vim/pack/plugins/start/jedi-vim/ftplugin/python/jedi.vim
 27: ~/.vim/pack/plugins/start/jedi-vim/after/ftplugin/python/jedi.vim
 28: /usr/pkg/share/vim/vim90/indent/python.vim
\`\`\`
</details>

<!--
Please execute `:redir @+> | silent verb JediDebugInfo | redir END` in a
Python buffer to copy debug information into your clipboard.
Then paste it here.
-->
davidhalter commented 2 months ago

Since this is an issue with your hashlib package (Jedi does not seem involved here), I will close.

My guess is that something is broken with your Python and import hashlib generates errors when used within VIM. It might not even work in normal Python. Usually I advice people to reinstall VIM/Python, but I'm not sure that helps here. In hashlib there's a comment:

# try them all, some may not work due to the OpenSSL
# version not supporting that algorithm.

It also seems that all of these errors are just printed, so they are just annoying. However it seems that pickle can not be imported (see traceback). This is of course something that should work and it definitely means that there's something completely wrong with the Python you are working with. I'm happy to try to help here, but I'll still close, because there's nothing left to do. But feel free to keep commenting.

llamallama commented 2 months ago

Thank you for the reply.

My guess is that something is broken with your Python and import hashlib generates errors when used within VIM. It might not even work in normal Python.

From a fresh install of Python 3.11 in NetBSD 10 I entered the hashlib example from here. https://docs.python.org/3/library/hashlib.html. This tells me at least that hashlib works in Python outside of vim.

-bash-5.2$ python3.11
Python 3.11.7 (main, Mar 11 2024, 01:07:07) [GCC 10.5.0] on netbsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> m = hashlib.sha256()
>>> m.update(b"Nobody inspects")
>>> m.update(b" the spammish repetition")
>>> m.digest()
b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06'
>>> m.hexdigest()
'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'

It also seems that all of these errors are just printed, so they are just annoying.

Apologies. I wasn't sure what was or was not helpful.

However it seems that pickle can not be imported (see traceback). This is of course something that should work and it definitely means that there's something completely wrong with the Python you are working with.

Testing here (still outside of vim) I get.

-bash-5.2$ python3.11
Python 3.11.7 (main, Mar 11 2024, 01:07:07) [GCC 10.5.0] on netbsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> animals = ['tiger', 'lion', 'giraffe']
>>> pickle.dumps(animals)
b'\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00]\x94(\x8c\x05tiger\x94\x8c\x04lion\x94\x8c\x07giraffe\x94e.'

Does this mean we can at least rule out the base Python install as the culprit here?

I'm happy to try to help here, but I'll still close, because there's nothing left to do. But feel free to keep commenting.

Thank you. I'm happy to keep providing information. I know this is an obscure case, but having jedi-vim running here would make my odd obsession with niche Unix systems a bit more comfortable. :)

Is there any other information I can provide you with?

davidhalter commented 2 months ago

It also seems that all of these errors are just printed, so they are just annoying.

Apologies. I wasn't sure what was or was not helpful.

No worries, I was just going through this to tell you that hashlib is not really an issue, pickle is.


It feels like you have an issue with Python in VIM. So something seems to be going wrong when VIM is loading Python (which is kind of a weird "embedding". I don't know what one would call that technically, but it's not a separate process. To debug this you can for example try :python3 import pickle. That will probably result in an error.

I'm not sure why this happens in your case, but we have seen quite a few cases with broken VIM/Python interaction. Most of theses cases can probably not relate to yours, most of them were on MacOS as far as I can remember it. These cases usually fixed themselves by reinstalling VIM.

llamallama commented 2 months ago

You’re right. It is an issue with NetBSD’s vim. When importing hashlib and pickle from python in vim I get the exact same errors. Unfortunately, reinstalling is not the answer here as it happens on a fresh install in all of my test scenarios.

At least I know where to direct my attention now. Thank you for your insight and thanks for work on jedi and jedi-vim!