Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 04 20:21
    @puremourning banned @dylanusdt:matrix.org
Johnathan Middleton
@johnmiddleton12
I can't run any ycm commands because it doesn't load at vim startup
Boris Staletic
@bstaletic
What about :messages?
Johnathan Middleton
@johnmiddleton12
Traceback (most recent call last):
File "<string>", line 27, in <module>
ModuleNotFoundError: No module named 'ycm'
Type :qa and press <Enter> to exit Vim
E492: Not an editor command: YcmToggleLogs
Press ENTER or type command to continue
Add, before that line, print(sys.path) and see if it contains ~/vimfiles/bundle/YouCompleteMe/python/

Wait... in this comment: https://github.com/ycm-core/YouCompleteMe/issues/3843#issuecomment-769890543

You've shown Windows paths.

But in :messages you're showing Unix paths.
Johnathan Middleton
@johnmiddleton12
I added the line in youcompleteme.vim and this is now the output of :messages
['\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\python', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests-futures', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\ycmd', '\c\Users\jpmaw\vimfiles\bun
dle\YouCompleteMe\third_party\requests_deps\idna', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\chardet', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\urllib3\src', '\c\Users\
\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\certifi', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\requests', '\\?\C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\python36.zip'
, 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\DLLs', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\lib', 'C:\Program Files\Git\usr\bin', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36', 'C:\Users\j
pmaw\AppData\Local\Programs\Python\Python36\lib\site-packages', '_vimpath']
Traceback (most recent call last):
File "<string>", line 28, in <module>
ModuleNotFoundError: No module named 'ycm'
Boris Staletic
@bstaletic
But where is the \c\Users\ thing coming from, if vim is loading stuff from /usr/share? Which OS are you on?
Johnathan Middleton
@johnmiddleton12
I'm on windows 10, running vim in git bash
Boris Staletic
@bstaletic
That might be causing trouble. Python seems to be confused between Windows and Unix paths.
I don't remember any user trying that before...
Johnathan Middleton
@johnmiddleton12
Ok.. is there any way I can specify which paths to use?
Boris Staletic
@bstaletic
You can influence sys.path with $PYTHONPATH. You can even set it in your vimrc with let $PYTHONPATH=...
Johnathan Middleton
@johnmiddleton12
I just tried that, and it didn't seem to do anything.
I'm wondering if there's any way I can install python locally in the git bash installation?
Boris Staletic
@bstaletic

I just tried that, and it didn't seem to do anything.

Did sys.path change?

I'm wondering if there's any way I can install python locally in the git bash installation?

It has been a long time since I used git bash or Windows. Does "git bash" come with apt?

Johnathan Middleton
@johnmiddleton12
['\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\python', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests-futures', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\ycmd', '\c\Users\jpmaw\vimfiles\bun
dle\YouCompleteMe\third_party\requests_deps\idna', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\chardet', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\urllib3\src', '\c\Users\
\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\certifi', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\requests', '\\?\C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\python36.zip'
, 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\DLLs', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\lib', 'C:\Program Files\Git\usr\bin', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36', 'C:\Users\j
pmaw\AppData\Local\Programs\Python\Python36\lib\site-packages', '_vimpath']
This is new output of sys.path
So same I think
I don't think it does
Because it's just a git unix terminal basically
Boris Staletic
@bstaletic
Hm... What happens in python's shell? What is in sys.path? Does it contain Windows or Unix paths?
Johnathan Middleton
@johnmiddleton12
How do I check that?
Boris Staletic
@bstaletic
Execute python (the same python that vim uses) and run print(__import__('sys').path)
Or python -c "print(__import__('sys').path)"
Johnathan Middleton
@johnmiddleton12
['', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\python36.zip', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\DLLs', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\lib', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\lib\site-packages']
Also I get this error when trying python commands in vim - E319: Sorry, the command is not available in this version
But my vim installation has python3 support
Boris Staletic
@bstaletic

Also I get this error when trying python commands in vim - E319: Sorry, the command is not available in this version

Because that's python2. For python3 you use :python3.

Johnathan Middleton
@johnmiddleton12
Oh ok yes that worked
['\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\python', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests-futures', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\ycmd', '\c\Users\jpmaw\vimfiles\bun
dle\YouCompleteMe\third_party\requests_deps\idna', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\chardet', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\urllib3\src', '\c\Users\
\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\certifi', '\c\Users\jpmaw\vimfiles\bundle\YouCompleteMe\third_party\requests_deps\requests', '\\?\C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\python36.zip'
, 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\DLLs', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36\lib', 'C:\Program Files\Git\usr\bin', 'C:\Users\jpmaw\AppData\Local\Programs\Python\Python36', 'C:\Users\j
pmaw\AppData\Local\Programs\Python\Python36\lib\site-packages', '_vimpath']
This is what I get from executing py3 import sys; print(sys.path) in vim
Boris Staletic
@bstaletic

I'm getting confused with paths again. Inside vim we saw... yes, \c\Users\whatever

But inside python, we have seen C:\Users\whatever.

Does git bash come with its own python?

Johnathan Middleton
@johnmiddleton12
Not that I know of, It's always been that whatever version of python I have in the env variables has been the one that runs in git bash
Boris Staletic
@bstaletic

Okay, with some hacking, we'll be able to get it to work.

From "home", open python, insert the path to YCM/python directory into sys.path and then import ycm. Can you make that work?

Johnathan Middleton
@johnmiddleton12
Ok I tried what I think u said I went into cmd, navigated to home directory, then used python to append the path to ycm, then imported ycm.
All that worked, but the error remains in vim
*append ycm to the sys.path
Boris Staletic
@bstaletic
But I meant from the git bash. Can you import ycm successfully inside git bash's python? If you can, I think we can get vim to do that as well.
Johnathan Middleton
@johnmiddleton12
Ok yes I was able to do that
I had to launch python with python -i inside git bash, not sure if that would cause a problem to vim
Boris Staletic
@bstaletic
I hope not. Now try this.
  1. Start vim. Ignore YCM crashing.
  2. :py3 << EOF
  3. import sys
  4. Insert the same path you've inserted previously, into sys.path
  5. EOF
  6. :py3 import ycm
Johnathan Middleton
@johnmiddleton12
Ok I'm pretty sure that did something
the last command runs and doesn't do anything
Boris Staletic
@bstaletic

WOOHOO! You managed to import ycm.

Place steps 2 to 6 in your vimrc.

Johnathan Middleton
@johnmiddleton12
Ummm
Now i get no module named ycmd
Boris Staletic
@bstaletic
I expected that. YCM inserts more than one path to be able to work, and so will you have to. Let me fetch the full list.
This is how the paths look on my machine:
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/python
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/requests-futures
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/ycmd
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/requests_deps/idna
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/requests_deps/chardet
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/requests_deps/urllib3/src
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/requests_deps/certifi
/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/third_party/requests_deps/requests
Johnathan Middleton
@johnmiddleton12
OK! Ycm is up but I instantly get the error message: