Closed coffeebe4code closed 1 year ago
However, ultisnips makes use of a very esoteric way to execute its python code.
What makes you think that? UltiSnips is using only the :python3
command to execute all of its Python code. It never uses anything else. It hence should behave exactly like any other Vim plugin that uses Python.
@coffeebe4code Thanks for writing that, it will definitely be useful as a reference for future users. However, UltiSnips does nothing besides running :python3
, i.e. it does nothing esoteric and the problems people have with Python are usually Neovim related and in rare cases broken Vim installations.
This isn't necessarily an issue with ultisnips. However, ultisnips makes use of a very esoteric way to execute its python code. It requires a lot of pieces and stars to be aligned. When searching for how to get Vim/Windows/Ultisnips/Python all working in harmony, I found I was not alone, this issue exists for others in other OS's as well.
If for whatever reason ultisnips is having an issue finding python. Something like "Could not load library..." You can read how to troubleshoot it here, and I bet this is relatively future proof
I don't have an exact guide for all, but you will need to follow these general guidelines. I will uppercase MUST for things that are a must have. SHOULD for things that should work.
Vim First
You MUST have vim installed that is linked against python. If you don't have vim installed, any
g
version of vim SHOULD have it. so installinggvim
. If you already have vim installed do this.You MUST see some sort of output like
You MUST check the actual link command as well.
This was the windows output. The output will use linking semantics for your distribution. so something like
libpython.so
for mac and linux. Take note of the highest, or whichever specific version of python you want to use. in this case python311 (python 3.11)I entirely gave up trying to get any of the dynamic portion working. Vim and Ultisnips just weren't finding the version of python I had installed. It was through choco, and python installed
3.12
. Which is very surprisingSo here is the crux of this whole conversation. The version of python you installed had to equal the actual linked version! Theoretically, the pythonx or
-DDynamic_Python3
SHOULD work, but this was never the case for me.Python
You MUST have python installed. Theoretically, if your version of vim is linked with dynamic python3, and you see python3/dyn or python3x or even pythonx, this SHOULD work.
If you have not installed python, install python. At this point I recommend it being the specific one that is linked so
python311.dll
in the case of windows. I imagine Linux/mac would be something likelibpython.3.11.so
If you are here like me and already had 3.12. you can install python 3.11 specifically. There are lots of ways to do this, I installed python with choco so I ran this to work with 3.11
choco install python --version=3.11.0
I submitted YES to ALL, so that it would update my environment paths.You MUST have python on your path.
If your version is not the specific version you are looking for, then you may need to update your path to point to the specific version.
Please let me know if any of this wasn't clear, or if some things were inaccurate. I just figured this would be a good place for this to live.