DeprecationWarning: the imp module is deprecated in favour of importlib
See original GitHub issueIssue
Latest jedi-vim and Python 3.7.0 throws
Error detected while processing function jedi#init_python[4]..<SNR>23_init_python[27]..jedi#setup_python_imports:
line 25:
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
when opening a python file.
Steps to reproduce
minimal-vimrc:
set nocompatible
let script_dir = fnamemodify(expand('<sfile>'), ':h')
let &runtimepath .= ','.script_dir.','.script_dir.'/after'
syntax on
filetype plugin indent on
- Use above vimrc
- Open python file
- jedi-vim fails to load.
Output of “:verbose JediDebugInfo”
Jedi-vim debug information
Using Python version: 3
- global sys.version:
3.7.0 (default, Jul 9 2018, 12:14:11), [Clang 9.1.0 (clang-902.0.39.2)]
- global site module:
/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py
Jedi path:/Users/x/.vim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.py
- version: 0.12.0
- environment:
<Environment: 2.7.15 in /usr/local>
- sys_path:
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages
/usr/local/Cellar/protobuf/3.6.0/libexec/lib/python2.7/site-packages
- jedi-vim git version: 0.9.0-29-g7cade1f
- jedi git submodule status: bd7c65d9639c2d451d44c6d135b4f6043a918950 pythonx/jedi (v0.12.0)
- parso git submodule status: e6bc924fbabbfa3090044e475c91a7655b9c6e9b pythonx/parso (v0.3.1)
Settings
omnifunc=python3complete#Complete
Last set from /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/ftplugin/python.vim
completeopt=menuone,longest,preview
Last set from ~/.vim/plugged/jedi-vim/plugin/jedi.vim
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 9 2018 13:36:24)
macOS version
Included patches: 1-150
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl -clientserver +dialog_con +find_in_path +keymap +modify_fname +multi_byte +profile +statusline +textobjects +vreplace -xterm_save
+arabic +clipboard +diff +float +lambda +mouse +multi_lang -python -sun_workshop +timers +wildignore
+autocmd +cmdline_compl +digraphs +folding +langmap -mouseshape -mzscheme +python3 +syntax +title +wildmenu
-autoservername +cmdline_hist -dnd -footer +libcall +mouse_dec +netbeans_intg +quickfix +tag_binary -toolbar +windows
-balloon_eval +cmdline_info -ebcdic +fork() +linebreak -mouse_gpm +num64 +reltime +tag_old_static +user_commands +writebackup
+balloon_eval_term +comments +emacs_tags -gettext +lispindent -mouse_jsbterm +packages +rightleft -tag_any_white +vartabs -X11
-browse +conceal +eval -hangul_input +listcmds +mouse_netterm +path_extra +ruby -tcl +vertsplit -xfontset
++builtin_terms +cryptv +ex_extra +iconv +localmap +mouse_sgr +perl +scrollbind +termguicolors +virtualedit -xim
+byte_offset +cscope +extra_search +insert_expand +lua -mouse_sysmouse +persistent_undo +signs +terminal +visual -xpm
+channel +cursorbind +farsi +job +menu +mouse_urxvt +postscript +smartindent +terminfo +visualextra -xsmp
+cindent +cursorshape +file_in_path +jumplist +mksession +mouse_xterm +printer +startuptime +termresponse +viminfo -xterm_clipboard
system vimrc file: "$VIM/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/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -framework AppKit -pagezero_size 10000 -image_base 100000000 -L/usr/local/opt/luajit/lib -lluajit-5.1 -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -lruby.2.5.1 -lobjc
:messages
Messages maintainer: Bram Moolenaar <Bram@vim.org>
"test_integration.py" 2L, 70C
Error detected while processing function jedi#init_python[4]..<SNR>23_init_python[27]..jedi#setup_python_imports:
line 25:
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
:scriptnames
1: ~/.vim/plugged/jedi-vim/vimrc.minimal
2: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/syntax.vim
3: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/synload.vim
4: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/syncolor.vim
5: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/filetype.vim
6: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/ftplugin.vim
7: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/indent.vim
8: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/getscriptPlugin.vim
9: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/gzip.vim
10: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/logiPat.vim
11: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/manpager.vim
12: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/matchparen.vim
13: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/netrwPlugin.vim
14: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/rrhelper.vim
15: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/spellfile.vim
16: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/tarPlugin.vim
17: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/tohtml.vim
18: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/vimballPlugin.vim
19: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/zipPlugin.vim
20: ~/.vim/plugged/jedi-vim/plugin/jedi.vim
21: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/python.vim
22: ~/.vim/plugged/jedi-vim/after/syntax/python.vim
23: ~/.vim/plugged/jedi-vim/autoload/jedi.vim
24: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/ftplugin/python.vim
25: ~/.vim/plugged/jedi-vim/ftplugin/python/jedi.vim
26: ~/.vim/plugged/jedi-vim/after/ftplugin/python/jedi.vim
27: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/indent/python.vim
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
imp module is deprecated in favour of importlib
Open the file with editing privileges named cloudpickle.py which is present at this location \sklearn\externals\joblib\externals\cloudpickle\ ...
Read more >DeprecationWarning: the imp module is deprecated in ...
Hi all,. I had a quick check of the scope of the issue. It seems that there are a total of 10 (6+4)...
Read more >imp — Access the import internals
Deprecated since version 3.4, will be removed in version 3.12: The imp module is deprecated in favor of importlib . ... Return the...
Read more >the imp module is deprecated in favour of importlib
DeprecationWarning: the imp module is deprecated in favour of importlib ; see the module's documentation for alternative uses <class 'DeprecationWarning'> ...
Read more >the imp module is deprecated in favour of importlib : PY- ...
:\Program Files\JetBrains\PyCharm 2018.3\helpers\pycharm\ ; : DeprecationWarning ;; see the module's documentation for alternative uses import imp.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From some more digging, it looks like vim itself is importing
imp
, hence why the line the error is being thrown on makes no sense (/must>not&exist/foo:1
).Looks like it’s tracked upstream here: https://github.com/vim/vim/issues/3117 With a workaround here: https://github.com/vim/vim/issues/3117#issuecomment-402622616
Might be worth patching something into jedi-vim to handle cases of people using an older vim with Python 3.7+
The issue was solved in VIM 8.1.201 https://github.com/vim/vim/issues/3117#issuecomment-406868685
I’m therefore closing this issue. No need for us to fix anything anymore. Just upgrade VIM or use the recommendation at https://github.com/vim/vim/issues/3117#issuecomment-402622616