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

ImportError: cannot import name _remove_dead_weakref #214

Closed
2 of 6 tasks
bearzyj opened this issue Sep 8, 2018 · 6 comments
Closed
2 of 6 tasks

ImportError: cannot import name _remove_dead_weakref #214

bearzyj opened this issue Sep 8, 2018 · 6 comments
Labels

Comments

@bearzyj
Copy link

bearzyj commented Sep 8, 2018

Information that requested to open a LeaderF issue

  • vim or neovim?

    • vim
    • neovim
  • Output of vim --version or nvim --version: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 29 2017 18:37:46)

  • Output of :echo has("python"): 1

  • Output of :echo has("python3"): 0

  • Output of :echo &pythondll(only vim, not neovim):/System/Library/Frameworks/Python.framework/Python

  • Output of :echo &pythonthreedll(only vim, not neovim): (Nothing outputed)

  • Output of :py print(sys.version): 2.7.10 (default, Oct 6 2017, 22:29:07)
    [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]

  • Output of :py3 print(sys.version): E319: Sorry, the command is not available in this version

  • Output of :echo g:Lf_Debug_Cmd:

  • Operating system:

    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Configurations related to LeaderF in vimrc: (No special configuration)

  • Extra information
    macOS: High Sierra 10.13.6
    Used "brew install python2" and "brew install python3"
    Now run "brew list | grep python", could see "python" and "python@2"
    In bash, "python --version" is Python 2.7.15, "python3 --version" is Python 3.7.0

Describe your question, feature request, or bug.

When use "LeaderfFunction", it reports error:
Error detected while processing /Users/yingjzh2/.vim/bundle/LeaderF/autoload/leaderf/Function.vim:
line 14:
Traceback (most recent call last):
File "", line 1, in
File "/Users/yingjzh2/.vim/bundle/LeaderF/autoload/leaderf/python/leaderf/functionExpl.py", line 12, in
import multiprocessing
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/init.py",
line 65, in
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/util.py", line
37, in
import weakref
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Error detected while processing function leaderf#Function#startExpl[2]..leaderf#LfPy:
line 1:
Traceback (most recent call last):
File "", line 1, in
NameError: name 'functionExplManager' is not defined

Steps to reproduce

Just use vim-plugin install Leaderf, and then open vim, and try "LeaderfFunction"

Actual behaviour

Show python import errors

Expected behaviour

Show tags

@bearzyj
Copy link
Author

bearzyj commented Sep 8, 2018

So now in my macOS, there are 3 python:

  • Apple-supplied: /usr/bin/python
  • brew-installed : /usr/local/bin/python
  • brew-installed : /usr/local/bin/python3

Manually tried and found that from _weakref import _remove_dead_weakref failed only with: "Apple-supplied: /usr/bin/python"

Considered that the vim is also Apple-supplied, so tried "py from _weakref import _remove_dead_weakref" also failed.

So, is there anyway to allow Apple-supplied vim (8.0) use brew-installed-python ?

@bearzyj
Copy link
Author

bearzyj commented Sep 8, 2018

Since in vim, echo &pythondll shows /System/Library/Frameworks/Python.framework/Python

I manualy set pythondll = '/usr/local/Cellar/python\@2/2.7.15_1/Frameworks/Python.framework/Python'

Then "py from _weakref import _remove_dead_weakref" still failed......

@Yggdroot
Copy link
Owner

Yggdroot commented Sep 8, 2018

This issue is not related to LeaderF, please google it to find the solution. For example, https://askubuntu.com/questions/981663/python2-7-broken-by-weakref-import-error-please-help.

@bearzyj
Copy link
Author

bearzyj commented Sep 8, 2018

@Yggdroot The way to solve it on macOS, could be "brew install vim".

However then, new problems happened without ctags.

Does LeaderF must work with "ctags" ? Can it works with "gtags" ?

Thanks.

@bearzyj
Copy link
Author

bearzyj commented Sep 8, 2018

Well, read "doc/leaderf.txt", from this section:

g:Lf_Ctags g:Lf_Ctags
Use this option to specify the ctags executable you use. If ctags is not
in one of the directories in your $PATH environment variable, you should
set it by yourself. e.g., >
let g:Lf_Ctags = "/usr/local/universal-ctags/ctags"
<
Default value is "ctags".

seems we must install ctags.

Tried let g:Lf_Ctags='/usr/local/bin/gtags', doesn't work.

Well. Thanks. This issue can be closed.
Just, if possible, please let LeaderF support gtags, then ctags can be uninstanlled.

@bearzyj
Copy link
Author

bearzyj commented Sep 8, 2018

Oh, my hope to let LeaderF support gtags is just the same as : #191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants