pandysong / ghost-text.vim

support for ghost-text in regular vim
MIT License
34 stars 4 forks source link

Missing websockets package #1

Closed vtemian closed 5 years ago

vtemian commented 5 years ago

After a fresh install, I get the following error


line   21:
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/Users/<>/.vim/plugged/ghost-text.vim/python3/vim_ghost_text.py", line 7, in <module>
    from single_server import start_server
  File "/Users/<>/.vim/plugged/ghost-text.vim/python3/single_server.py", line 1, in <module>
    import server_thread
  File "/Users/<>/.vim/plugged/ghost-text.vim/python3/server_thread.py", line 4, in <module>
    import websocket_server
  File "/Users/<>/.vim/plugged/ghost-text.vim/python3/websocket_server.py", line 1, in <module>
    import websockets
ModuleNotFoundError: No module named 'websockets'````

I don't know which python vim is using (system/virtualenv or his own) and where should this dependency be.
pandysong commented 5 years ago

Right. You may install manually in system:

python3 -m pip install websockets

once installed, you may run in vim:

:py3 import websockets

To see if it pops up error.

I feel virtualenv will not work unless vim runs from virtualenv. But I did not try that.

I will update document for this.

pandysong commented 5 years ago

Thanks for raising the issue: Improved document at: https://github.com/pandysong/ghost-text.vim/commit/ddf3c1a1376a2a62025301966e68700dcc000944

vtemian commented 5 years ago

Thanks!

sideshowbarker commented 3 years ago

In my macOS environment, I started getting that No module named 'websockets' error after a brew upgrade updated my vim.

And when I tried a normal pip install of websockets, I got back Requirement already satisfied

So I ran vim --version and noticed in the output there was this:

-L/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin

So because of that, I tried running the install for websockets this way:

/usr/local/opt/python@3.9/bin/pip3 install websockets

…and that fixed the problem. That installed websockets in the place my latest macOS+brew vim now seems to expect it.


P.S. I guess this is due to the fact that python@3.9 from brew is installed “keg-only”, with no symlinks in /usr/local. So, in my environment, running python3 gives me python3.8 (which is symlinked in /usr/local) — but my vim instead finds and uses python3.9 from /usr/local/opt/python@3.9