python-rope / ropevim

vim mode that uses rope library to provide features like python refactorings and code-assists
GNU General Public License v2.0
245 stars 34 forks source link

vim module missing #56

Closed cottrell closed 7 years ago

cottrell commented 7 years ago

Seems to be missing from the requirements. Which module named vim is this using?

$ python -c 'import ropevim'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/.../site-packages/ropevim-0.7.0-py3.5.egg/ropevim.py", line 13, in <module>
    import vim
ImportError: No module named 'vim
mcepl commented 7 years ago

Yes, ropevim is not useable outside of the Python embedded in vim. http://vimhelp.appspot.com/if_pyth.txt.html#python-vim

NOTABUG

cottrell commented 7 years ago

These kind of errors happen when starting vim the ropevim plugin installed. The errors seem to be coming from the Anaconda python that I use by default. Probably ropevim or vim (on OSX) are not isolating themselves properly from my env.

kreedz commented 7 years ago

I have the same issue.

herberthamaral commented 4 years ago

For any of you trying to use ropevim with pyenv, here's how I've done it:

  1. Find out which python version your vim is compiled with (vim --version | grep python should give you an idea).
  2. Install ropevim dependencies using the equivalent pip. For example, let's suppose this is my vim --version output:
...
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,
-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,
--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo
-lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig
-lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo  -lselinux  -lcanberra
-lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib
-L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt 
-L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil
-lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread
-lgmp -ldl -lcrypt -lm

As you can see, my vim was compiled with python 3.5 that is installed at /usr/bin/python3.5. You may install ropevim dependencies by executing /usr/bin/python3.5 -m pip install rope ropevim rope ropemode. Things should work "normally" after that.

Please bear in mind that by running ropevim in vim's embedded python will limit you to that python version, i.e. you can't expect ropevim to work when you're editing later python version scripts.