You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
Could there be an option which controls the version of python to be used. #18
I have set the homebrew installed python as the default python interpreter in my MAC OSX. However, lldb.vim seems uncompatible with it because of that lldb python module can only be used with the python which is shipped with system.
I hope there could be an option that allows me to select which version python to run. In that way, the vim runtime python can be separated from the python lldb.nvim works with.
I encountered a new problem, if I set let g:python_host_prog = '/usr/bin/python2' another plugin die. different plugins need different versions of python...
Majority plugins can cooperate with any version of python. However, lldb module only works fine with the default. That is why I open a new issue to post my will of lldb.nvim.
different plugins need different versions of python...
LLDB's python module can work with any version of python2 (I think -- greater than 2.6). Making it available with the version installed through homebrew might be tricky.
In my system, LLDB's python files are in this directory: /usr/lib/python2.7/site-packages/lldb. If I had a different (newer) version of python installed in /usr/local/, I would create a symlink like this:
Sorry, I forgot to note that the lldb module in my system is shipped with Xcode. On Linux system, lldb works properly. Maybe, Apple's lldb is different.
The lldb library locates at /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python.
After making symbol link, when I import lldb in python which is installed through homebrew it reports:
Fatal Python error: PyThreadState_Get: no current thread
[1] 87589 abort python
and a window pops up with Python quit unexpectedly. Click Reopen to open the application again. Click Report to see more detailed information and send a report to Apple. filled in.
So symlinking will not work (sorry). I guess the only path left is to install LLDB from homebrew (I think it comes with LLVM). And while at it, try to install the latest version, 3.7.
It's probably impossible to make Xcode's LLDB compatible with brew python (as explained here). If you simply have to use brewed python with Neovim, you'll have to brew LLDB too, packaged with LLVM (?):
brew install llvm --with-python --with-lldb
But if you can make do with system python in just Neovim (leaving PATH intact), set the global variable g:python_host_prog to system python path (/usr/bin/python2) in init.vim, and do /usr/bin/pip2 install neovim so that system python gets the Neovim client module. In this case, you can probably also set PYTHONPATH appropriately in init.vim without messing with your bash/zsh environment:
Ok, I'll probably use the system python then. I just noticed, that there is no pip2 in /usr/bin/. What can I do about this? And I should probably uninstall neovim from my current pip and pip3 (since these pip's are from homebrew, right?
You don't need to uninstall neovim from pip, it will just stay there unused. pip3 neovim installation will be used by Neovim's python3 plugins, if you have any (eg. deoplete).
I used /usr/bin/pip2 to emphasize that neovim module should be installed from system's python2 pip (not 3); it is probably named /usr/bin/pip then...
Ok, I'm really confused right now. I installed pip with easy_install in /Library/Python/2.7/site-packages/. When I write which pip I still get /usr/local/bin/pip- the homebrew pip. pip --version shows pip 7.1.2 from /Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg (python 2.7). Is /Library/Python/2.7/.../ the homebrew pipor the system pip? Sorry, I just spend to much time figuring this out and I think I'm just confused right now...
@LastSecondsToLive I'm not sure! I've never used a Mac, sorry! @JayBusch Help! Do you have /usr/bin/pip? If yes, how did you get it (Did you ever [re]install pip itself)? If not, what do you get for which pip (with your modified PATH)?
@LastSecondsToLive, if you have brew python installed, before you operating naive python, maybe you have to execute brew unlink python before and brew link python after. I don't remember if the naive python shipped with pip, if not, you need to install it manually.
@d0u9 I just did a factory reset (I messed something) up. So I'm good to go I think. Are this the steps I should do (I have nothing else than the default software at the moment)? I really don't want to mess something up again...
Install brew
Install neovim, python (including pip) and python3 (including pip3) via brew
Disable SIP and create mymodule.pth in /usr/lib/python2.7/dist-packages.
Append /usr/local/lib/python2.7/site-packages/ (the path to the brewed python) to mymodule.pth. mymodule.pth will only contain this line of text right?
Enable SIP again (in general I'm PRO-Protection)
Install neovim (the python module) with the brewed python/pip - not the brewed python3
Set let g:python_host_prog = '/usr/bin/python2' in my init.nvim.
Now neovim should use the native python which has access to LLDB and has access to the shared library of the brewed python which in turn has access to the 'neovim' module. This seems like something easy to mess up, but I'll try my best.
Questions:
I don't need to link/unlink brew python in this order, right?
I don't need access to a native pip (OS X doesn't ship with pip), right - I use the brewed python/pip once to install the neovim module?
And is it save to not install python3 (including pip3) via brew - since we don't need it for this?
mymodule.pth will only contain this line of text right?
Yes, only one line in this file. If you want to test whether it works properly, you can import any libraries which are installed by brew python's pip into the naive python.
I don't need to link/unlink brew python in this order, right?
I am not very sure if this is a prerequisite step. Maybe, this step is only necessary for installing YouCompleteMe.
I don't need access to a native pip (OS X doesn't ship with pip), right - I use the brewed python/pip once to install the neovim module?
Yes, if you want to use brew python instead of naive python, you do not oblige to install pip for naive python at all.
And is it save to not install python3 (including pip3) via brew - since we don't need it for this?
Python3 is unnecessary I think. I haven't try any thing about python3.
BTW, It seems that brew python now is updated to 2.7.11 compare to the naive python 2.7.10. I am not certain about the effect which may be brought by the difference of these two versions of python.
BTW, It seems that brew python now is updated to 2.7.11 compare to the naive python 2.7.10. I am not certain about the effect which may be brought by the difference of these two versions of python.
Since neovim module is completely written in python (as opposed to one which loads a shared library such as lldb module), it's much more probable to just work across versions.
And yeah, python3 is not necessary for this plugin.
Sorry for the late reply; not totally caught up either, but here's what I think you were asking.
I do not have /usr/bin/pip
My pip according to "which pip" is in /usr/local/bin
It should be noted though that although I installed Python via homebrew, I installed NeoVim via source from GitHub.
I am also getting a Python crash now that I have installed YouCompleteMe, and have not had time to look into it. I imagine it is a result of YouCompleteMe is linked to the Python binary not on my path. I'll look into it further this week as time allows.
Ok, I finally got it (I didn't even need to disable SIP or do something special).
This is how to get lldb.nvim on OS X:
Install homebrew.
Install neovim via homebrew (See this - Since I installed it via homebrew, I can't be sure if it'll work with another neovim build).
Install python via homebrew (brew install python).
The just brewed python will be located under /usr/local/bin/python. Homebrew will install pip as well when installing python. This brewed pip will be located under /usr/local/bin/pip2.
Be sure that the default pip/pip2 is the brewed pip (which pip and which pip2 should return /usr/local/bin/pip respectively /usr/local/bin/pip2 - otherwise modify your $PATH). Check the same for the python.
Install neovim python module with the just brewed pip2 (pip2 install neovim). Pythonshould now be able to import neovim (Optional: Test in Python Interactive Mode).
The naive python (located under /usr/bin/python is not able to import LLDB. To change this we add this to our .bash_profile:
NOTE: Only the naive python located under usr/bin/python will be able to import the LLDB python module (with import lldb) - our default python is the brewedpython located under /usr/local/bin/python.
The naive python still doesn't have access to the brewedneovim module. We change this by easily adding:
to our .bash_profile. Now the naive python is able to access the LLDB module and is able to access the neovim module (which was installed with a brewedpip). Our default python is still the brewedpython. That's fine. But neovim should use the naive python with all it's possibilities to import LLDB & neovim modules.
To let neovim use the naive python. Add this to your .config/nvim/init.vim:
let g:python_host_prog = '/usr/bin/python2.7'
DONE.
This took me quite a while now and I really hope this post will save some people time in the future :) Thanks to @d0u9, @critiqjo and @JayBusch for the tips and tricks, which finally brought me here.
@LastSecondsToLivePYTHONPATH environment can be accessed both by python3 and python2. So, if you set this environment only to a python2 library path, python3 will report error when you import libraries due to that python3 also accesses python2's library.
I encountered this problem before, and asked THIS question. Creating a file and fill it with path of brew python's library seems a safe way to restrict such impact.
@d0u9 That makes sense!
It didn't work at first, but I created the mymodule.pth in the wrong folder. It has to be located in /Library/Python/2.7/site-packages (not/usr/lib/python2.7/dist-packages). mymodule.pth contains the line /usr/local/lib/python2.7/site-packages and it's working!
Thank you really much. This will prevent me from messing up python3 in the future.
@LastSecondsToLive Step 6 should be unnecessary due to this (where the plugin itself tries to locate the module and add it to sys.path). Try executing the test script (without step 6).
Activity
critiqjo commentedon Dec 9, 2015
As I said earlier (in #16), did you try setting
g:python_host_prog?d0u9 commentedon Dec 10, 2015
I encountered a new problem, if I set
let g:python_host_prog = '/usr/bin/python2'another plugin die. different plugins need different versions of python...Majority plugins can cooperate with any version of python. However, lldb module only works fine with the default. That is why I open a new issue to post my will of lldb.nvim.
critiqjo commentedon Dec 10, 2015
LLDB's python module can work with any version of python2 (I think -- greater than 2.6). Making it available with the version installed through homebrew might be tricky.
In my system, LLDB's python files are in this directory:
/usr/lib/python2.7/site-packages/lldb. If I had a different (newer) version of python installed in/usr/local/, I would create a symlink like this:which should probably make it work...
d0u9 commentedon Dec 10, 2015
Sorry, I forgot to note that the lldb module in my system is shipped with Xcode. On Linux system, lldb works properly. Maybe, Apple's lldb is different.
The lldb library locates at
/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python.After making symbol link, when I import lldb in python which is installed through homebrew it reports:
and a window pops up with
Python quit unexpectedly. Click Reopen to open the application again. Click Report to see more detailed information and send a report to Apple.filled in.critiqjo commentedon Dec 11, 2015
A bit of searching around landed me here: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Common-Issues.md#python-segmentation-fault-11-on-import-some_python_module
So symlinking will not work (sorry). I guess the only path left is to install LLDB from homebrew (I think it comes with LLVM). And while at it, try to install the latest version, 3.7.
critiqjo commentedon Dec 12, 2015
@d0u9 May be doing this instead of symlinking will work.
(If only I could get my hands on an Apple! I would go on a testing spree!)
LastSecondsToLive commentedon Dec 20, 2015
@d0u9 How did you finally fixed the problem? I'm stuck in the exact same situation at the moment (I need to link the
Xcode lldbto the brew python.).d0u9 commentedon Dec 20, 2015
@LastSecondsToLive, Sorry, I tried a lot but failed to make
Xcode lldbcompatible with brew python.LastSecondsToLive commentedon Dec 20, 2015
@d0u9 So I guess I'll need to install
neovimtogether with theneovim python modulesvia the system python? Is there any way I can use thelldb.nvim?critiqjo commentedon Dec 20, 2015
It's probably impossible to make Xcode's LLDB compatible with brew python (as explained here). If you simply have to use brewed python with Neovim, you'll have to brew LLDB too, packaged with LLVM (?):
But if you can make do with system python in just Neovim (leaving
PATHintact), set the global variableg:python_host_progto system python path (/usr/bin/python2) ininit.vim, and do/usr/bin/pip2 install neovimso that system python gets the Neovim client module. In this case, you can probably also setPYTHONPATHappropriately ininit.vimwithout messing with your bash/zsh environment:LastSecondsToLive commentedon Dec 20, 2015
Ok, I'll probably use the system python then. I just noticed, that there is no
pip2in/usr/bin/. What can I do about this? And I should probably uninstallneovimfrom my currentpipandpip3(since thesepip's are from homebrew, right?critiqjo commentedon Dec 20, 2015
You don't need to uninstall
neovimfrompip, it will just stay there unused.pip3neovim installation will be used by Neovim's python3 plugins, if you have any (eg. deoplete).I used
/usr/bin/pip2to emphasize thatneovimmodule should be installed from system's python2 pip (not 3); it is probably named/usr/bin/pipthen...LastSecondsToLive commentedon Dec 20, 2015
Hm. No
pipin/usr/bin/neither. Do I need to install a newpip/pip2?LastSecondsToLive commentedon Dec 20, 2015
Ok, I'm really confused right now. I installed
pipwitheasy_installin/Library/Python/2.7/site-packages/. When I writewhich pipI still get/usr/local/bin/pip- thehomebrew pip.pip --versionshowspip 7.1.2 from /Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg (python 2.7). Is/Library/Python/2.7/.../thehomebrew pipor the systempip? Sorry, I just spend to much time figuring this out and I think I'm just confused right now...critiqjo commentedon Dec 20, 2015
@LastSecondsToLive I'm not sure! I've never used a Mac, sorry!
@JayBusch Help! Do you have
/usr/bin/pip? If yes, how did you get it (Did you ever [re]installpipitself)? If not, what do you get forwhich pip(with your modifiedPATH)?4 remaining items
LastSecondsToLive commentedon Dec 21, 2015
Wow, I'll try this! Tomorrow I think - It's 3:57AM in Germany - I'll report tomorrow.
LastSecondsToLive commentedon Dec 21, 2015
@d0u9 I don't need to do the previous steps if I go with the compromise, right?
d0u9 commentedon Dec 21, 2015
@LastSecondsToLive, if you have brew python installed, before you operating naive python, maybe you have to execute
brew unlink pythonbefore andbrew link pythonafter. I don't remember if the naive python shipped with pip, if not, you need to install it manually.d0u9 commentedon Dec 21, 2015
@LastSecondsToLive Yes, if you don't want to mess up your library of naive python, follow my second reply.
LastSecondsToLive commentedon Dec 21, 2015
@d0u9 I just did a factory reset (I messed something) up. So I'm good to go I think. Are this the steps I should do (I have nothing else than the default software at the moment)? I really don't want to mess something up again...
brewneovim,python (including pip)andpython3 (including pip3)viabrewmymodule.pthin/usr/lib/python2.7/dist-packages./usr/local/lib/python2.7/site-packages/ (the path to the brewed python)tomymodule.pth.mymodule.pthwill only contain this line of text right?neovim(thepython module) with the brewedpython/pip- not the brewedpython3g:python_host_prog = '/usr/bin/python2'in myinit.nvim.Now
neovimshould use the nativepythonwhich has access toLLDBand has access to the shared library of the brewedpythonwhich in turn has access to the 'neovim' module. This seems like something easy to mess up, but I'll try my best.Questions:
I don't need to
link/unlinkbrew python in this order, right?I don't need access to a
native pip(OS X doesn't ship withpip), right - I use the brewedpython/piponce to install the neovim module?And is it save to not install
python3 (including pip3)via brew - since we don't need it for this?@d0u9 Thank you so much already for your effort!
d0u9 commentedon Dec 21, 2015
Yes, only one line in this file. If you want to test whether it works properly, you can import any libraries which are installed by brew python's
pipinto the naive python.I am not very sure if this is a prerequisite step. Maybe, this step is only necessary for installing YouCompleteMe.
Yes, if you want to use brew python instead of naive python, you do not oblige to install pip for naive python at all.
Python3 is unnecessary I think. I haven't try any thing about python3.
BTW, It seems that brew python now is updated to 2.7.11 compare to the naive python 2.7.10. I am not certain about the effect which may be brought by the difference of these two versions of python.
critiqjo commentedon Dec 21, 2015
Since
neovimmodule is completely written in python (as opposed to one which loads a shared library such aslldbmodule), it's much more probable to just work across versions.And yeah, python3 is not necessary for this plugin.
Thanks @d0u9
JayBusch commentedon Dec 21, 2015
Sorry for the late reply; not totally caught up either, but here's what I think you were asking.
I do not have /usr/bin/pip
My pip according to "which pip" is in /usr/local/bin
It should be noted though that although I installed Python via homebrew, I installed NeoVim via source from GitHub.
I am also getting a Python crash now that I have installed YouCompleteMe, and have not had time to look into it. I imagine it is a result of YouCompleteMe is linked to the Python binary not on my path. I'll look into it further this week as time allows.
LastSecondsToLive commentedon Dec 22, 2015
Ok, I finally got it (I didn't even need to disable
SIPor do something special).This is how to get lldb.nvim on OS X:
Install
homebrew.Install
neovimviahomebrew(See this - Since I installed it viahomebrew, I can't be sure if it'll work with anotherneovimbuild).Install
pythonviahomebrew(brew install python).The just brewed
pythonwill be located under/usr/local/bin/python.Homebrewwill installpipas well when installingpython. This brewedpipwill be located under/usr/local/bin/pip2.Be sure that the default
pip/pip2is the brewedpip(which pipandwhich pip2should return/usr/local/bin/piprespectively/usr/local/bin/pip2- otherwise modify your$PATH). Check the same for thepython.Install
neovim python modulewith the just brewedpip2(pip2 install neovim).Pythonshould now be able to importneovim(Optional: Test in Python Interactive Mode).The naive
python(located under/usr/bin/pythonis not able to importLLDB. To change this we add this to our.bash_profile:NOTE: Only the naive
pythonlocated underusr/bin/pythonwill be able to import theLLDB python module(withimport lldb) - our defaultpythonis the brewedpythonlocated under/usr/local/bin/python.The naive
pythonstill doesn't have access to the brewedneovimmodule. We change this by easily adding:to our
.bash_profile. Now the naivepythonis able to access theLLDBmodule and is able to access theneovimmodule (which was installed with a brewedpip). Our defaultpythonis still the brewedpython. That's fine. Butneovimshould use the naivepythonwith all it's possibilities to importLLDB&neovimmodules.To let
neovimuse the naivepython. Add this to your.config/nvim/init.vim:DONE.
This took me quite a while now and I really hope this post will save some people time in the future :) Thanks to @d0u9, @critiqjo and @JayBusch for the tips and tricks, which finally brought me here.
d0u9 commentedon Dec 23, 2015
@LastSecondsToLive
PYTHONPATHenvironment can be accessed both by python3 and python2. So, if you set this environment only to a python2 library path, python3 will report error when you import libraries due to that python3 also accesses python2's library.I encountered this problem before, and asked THIS question. Creating a file and fill it with path of brew python's library seems a safe way to restrict such impact.
LastSecondsToLive commentedon Dec 23, 2015
@d0u9 That makes sense!
It didn't work at first, but I created the
mymodule.pthin the wrong folder. It has to be located in/Library/Python/2.7/site-packages(not/usr/lib/python2.7/dist-packages).mymodule.pthcontains the line/usr/local/lib/python2.7/site-packagesand it's working!Thank you really much. This will prevent me from messing up
python3in the future.critiqjo commentedon Dec 23, 2015
@LastSecondsToLive Step 6 should be unnecessary due to this (where the plugin itself tries to locate the module and add it to
sys.path). Try executing the test script (without step 6).Add a FAQ for Mac users
revolter commentedon Jan 28, 2017
@LastSecondsToLive, Step 7 doesn't work, still get the
Fatal Python error: PyThreadState_Get: no current threaderror.