Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taskwiki fails with AttributeError: module 'vim' has no attribute 'find_module' #183

Closed
beuerle opened this issue Aug 7, 2018 · 11 comments

Comments

@beuerle
Copy link
Contributor

beuerle commented Aug 7, 2018

Since some updates (I'm on Arch Linux) I am no longer able to use taskwiki (most recent revision). I get the following error message when opening any vimwiki file:

Error detected while processing /home/user/dotfiles/vim/bundle/taskwiki/ftplugin/vimwiki/taskwiki.vim:
line   31:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/dotfiles/vim/bundle/taskwiki/taskwiki/main.py", line 15, in <module>
    from taskwiki import cache as cache_module
  File "/home/user/dotfiles/vim/bundle/taskwiki/taskwiki/cache.py", line 5, in <module>
    from taskwiki import viewport
  File "/home/user/dotfiles/vim/bundle/taskwiki/taskwiki/viewport.py", line 6, in <module>
    from taskwiki import vwtask
  File "/home/user/dotfiles/vim/bundle/taskwiki/taskwiki/vwtask.py", line 10, in <module>
    from taskwiki import util
  File "/home/user/dotfiles/vim/bundle/taskwiki/taskwiki/util.py", line 6, in <module>
    import pkg_resources
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3123, in _initialize_master_working_set
    for dist in working_set
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3123, in <genexpr>
    for dist in working_set
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2633, in activate
    declare_namespace(pkg)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2170, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2090, in _handle_ns
    loader = importer.find_module(packageName)
AttributeError: module 'vim' has no attribute 'find_module'
$ python --version
Python 3.7.0
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug  1 2018 12:30:25)
Included patches: 1-194
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    +tcl/dyn
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl/dyn          +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           +python/dyn        +viminfo
+conceal           +linebreak         +python3/dyn       +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       +lua/dyn           +ruby/dyn          +writebackup
+dialog_con_gui    +menu              +scrollbind        +X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       +xim
+dnd               +mouse             +startuptime       -xpm
-ebcdic            +mouseshape        +statusline        +xsmp_interact
+emacs_tags        +mouse_dec         -sun_workshop      +xterm_clipboard
+eval              +mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/uuid -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/libdrm -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread  -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.28/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.28/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.28/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm     

Any ideas?

@beuerle beuerle changed the title taskwiki fails with AttributeError: module 'vim' has no attribute 'find_module' error taskwiki fails with AttributeError: module 'vim' has no attribute 'find_module' Aug 7, 2018
@beuerle
Copy link
Contributor Author

beuerle commented Aug 7, 2018

Probably an issue with vim (+python). Closing now.

@beuerle beuerle closed this as completed Aug 7, 2018
@bbugyi200
Copy link

bbugyi200 commented Aug 7, 2018

@beuerle Were you able to get this working? I'm experiencing the same issue.

@bbugyi200
Copy link

bbugyi200 commented Aug 7, 2018

For anyone else that stumbles across this problem, I was able to silence these errors by making a few changes to the util.py module. Specifically, by commenting out both the import to pkg_resources and the following lines (which make use of this package):

https://github.com/tbabej/taskwiki/blob/b5caafd302e2467656447a1cebc2e37773a9fa3b/taskwiki/util.py#L373-L379

It looks like this only disables a dependency check for tasklib. So no major damage done.

@beuerle
Copy link
Contributor Author

beuerle commented Aug 8, 2018

@bbugyi200 no, I wasn't. But after the update(s) I got the same error with the python-mode vim plugin, so I reckon it has nothing to do with taskwiki?

[..]
line    1:
    loader = importer.find_module(packageName)
Press ENTER or type command to continue
Error detected while processing /home/user/dotfiles/vim/bundle/python-mode/autoload/pymode/lint.vim:
line    1:
AttributeError: module 'vim' has no attribute 'find_module'

The problem is connected to recent (vim+) python update. Not sure why exactly, and I don't have the time right now to figure it out.

@beuerle beuerle reopened this Aug 8, 2018
@beuerle
Copy link
Contributor Author

beuerle commented Aug 8, 2018

@bbugyi200:

For anyone else that stumbles across this problem, I was able to silence these errors by making a few changes to the util.py module. Specifically, by commenting out both the import to pkg_resources and the following lines (which make use of this package):

I can confirm that this patch works.

@tbabej
Copy link
Collaborator

tbabej commented Aug 9, 2018

Upgraded to Python 3.7, but I can't reproduce this guys.

@beuerle
Copy link
Contributor Author

beuerle commented Aug 14, 2018

Updated vim today from

VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug  1 2018 12:30:25)
Included patches: 1-194

to

VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 13 2018 14:59:01)
Included patches: 1-279

but the problem still persists.

@geblanco
Copy link

I have the same issue but didn't try the patch, instead, as the problem is python 3.7 related, you can set let g:taskwiki_use_python2 = 1 on your vimrc so that taskwiki uses python2, seems to solve the problem for me.

@fanovpn
Copy link

fanovpn commented Nov 9, 2018

This seems to be reproducible if you have python 3, vim, and at least one python module in your site-packages which has a namespace_packages.txt file in it's egg-info (in ArchLinux, the python-matplotlib pacman package is one example that will trigger this). In which case, attempting to import pkg_resource inside vim will fail (e.g., vim --clean -c ':py3 import pkg_resource').

Aside from importing pkg_resources and triggering the bug, it doesn't seem to be a problem in taskwiki.

@tbabej
Copy link
Collaborator

tbabej commented Nov 13, 2018

@fanovpn I just wanted to chime in (after checking the setuptool issue): good work tracking this one down guys.

@jan--f
Copy link

jan--f commented Jun 6, 2019

A recent vim version fixes this. This one works for me:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun  5 2019 09:19:36)
Included patches: 1-1467

@beuerle beuerle closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants