fisadev / vim-isort

Vim plugin to sort python imports using https://github.com/timothycrosley/isort
MIT License
219 stars 32 forks source link

Error under python 3.7 #32

Closed tpazderka closed 5 years ago

tpazderka commented 5 years ago

I am getting an error on startup of Vim running/compiled with Py3.7.

Error detected while processing /home/tomas/.vim/bundle/vim-isort/plugin/python_vimisort.vim:
line  104:
Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/home/tomas/.local/lib/python3.7/site-packages/isort/__init__.py", line 26, in <module>
    from .isort import SortImports  # noqa: F401
  File "/home/tomas/.local/lib/python3.7/site-packages/isort/isort.py", line 41, in <module>
    from .finders import FindersManager
  File "/home/tomas/.local/lib/python3.7/site-packages/isort/finders.py", line 24, in <module>
    from pip._internal.download import PipSession
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_internal/index.py", line 24, in <module>
    from pip._internal.download import HAS_TLS, is_url, path_to_url, url_to_path
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_internal/download.py", line 39, in <module>
    from pip._internal.utils.logging import indent_log
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_internal/utils/logging.py", line 9, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 21, in <module>
    from pip._vendor import pkg_resources
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3123, in _initialize_master_working_set
    for dist in working_set
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3123, in <genexpr>
    for dist in working_set
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2633, in activate
    declare_namespace(pkg)
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2170, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/tomas/.local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2090, in _handle_ns
    loader = importer.find_module(packageName)
AttributeError: module 'vim' has no attribute 'find_module'
Press ENTER or type command to continue
nqiu commented 5 years ago

here has the same complaint, not solved yet.

But on another of my mac book, it runs ok

asgoel commented 5 years ago

+1 any ideas?

cmcginty commented 5 years ago

Did the vim python module API change? Also reported here:

https://github.com/tbabej/taskwiki/issues/183

fisadev commented 5 years ago

Hi! I finally found the solution to this: it's an issue with the isort package under python3.7. They have already solved it, so you just need to upgrade your installed isort to the latest version :) Just to be clear: you need to upgrade isort, not vim-isort.