Friday, March 11, 2016

How to debug neovim python remote plugin

I really really really want to have debugger integration with my Vim setup and while the plugins for old Vim were a little wacky, the new architecture of NeoVim seems promising, so I decided to give lldb.nvim a go.

It didn't work. This is a (epic boring)  story of how I debugged and fixed the issues.

Step 1: update

Update your neovim to the latest release to avoid fighting issues that have already been solved. At the time of writing, I used:
  • nvim 0.1.2 from Homebrew
  • OS X 10.10.5
  • XCode 7.0
  • lldb-340.4.70

Step 2: Diagnose

PyThreadState_get error

If you're on OS X, chances are you have more than one Python version installed and that's where the trouble comes from. If you get this error message

>>> import lldb
Fatal Python error: PyThreadState_Get: no current thread

it's most likely because you're trying to import a module that has been linked with a different version of Python. The lldb module comes with the XCode developer tools and was linked with the default system version of Python which lives in (remember this)


so this is the python version you should use to run the lldb.nvim remote plugin. On my system, BTW, lldb module lives in


Step 3: Install neovim Python module

The neovim module has probably already been installed with neovim but perhaps not in the correct Python version. You can try to  import neovim in the system Python. If it fails, you'll need to install it using easy_install or pip:

sudo /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python -m easy_install neovim

This will install the neovim package into the system Python distribution (needs sudo) using the easy_install tool.

Step 4: Configure neovim to use the system Python

In your neovim config file, add this line:

let g:python_host_prog = '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python'

This ensures that neovim will start the system Python (which has access to lldb and neovim modules) to host the plugin. After this, you should be all set!

Step 5: Using $PYTHONPATH?

If you do use $PYTHONPATH with your non-system Python, you'll have trouble as well. Before launching the system Python from nvim, you'll need to clean this variable otherwise the packages will interfere with the system Python's packages.

I do that using a small wrapper script ~/syspython2 which gets invoked from nvim as the g:python_host_prog

# running the OS X system python. Required to import the lldb module.
export PYTHONPATH="/Applications/"

# enable these for debugging
#echo "--" >> ~/syspython2.log
#echo "$@" >> ~/syspython2.log
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python "$@"

Step 6: Diagnose

Still having trouble?

  • Don't forget to run :UpdateRemotePlugins
  • Enable logging in the ~/syspython2 script
  • Check using pstree | less if neovim is launching the correct Python binary
  • Double-check you can import neovim and lldb modules from the system Python
  • Make sure lldb.neovim is installed correctly - the file lldb.nvim/rplugin/python/ must exist
  • NeoVim also tries to load Python 3 plugins, you may need to do the same for Python 3
  • Try to debug /usr/local/Cellar/neovim/0.1.2/share/nvim/runtime/autoload/remote/host.vim  using debugging vim methods
  • More info about lldb Python module here on StackOverflow


  1. Thanks a million trillion times! I was getting suicidal,
    Here's one hundred smilies:
    :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)

  2. lldb works smooth with the default macOS python (/usr/bin/python). Which is also used in LLDB Python Reference:
    But there is a need to install all the dependencies and even pip itself for this version. My workaround was:
    1) installing pip with /usr/bin/python using (no luck with easy_install):
    run the downloaded: sudo /usr/bin/python
    2) installing the 'six' module (sudo /usr/bin/python -m pip install six)
    3) installing neovim, but 'pip install' for each dependency:
    sudo /usr/bin/python -m pip install greenlet
    sudo /usr/bin/python -m pip install msgpack-python
    sudo /usr/bin/python -m pip install futures
    sudo /usr/bin/python -m pip install trollius
    sudo /usr/bin/python -m pip install neovim
    4) adding 'export PYTHONPATH=/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python' to my ~/.bash_profile
    5) setting nvim's python to /usr/bin/python
    let g:python_host_prog = '/usr/bin/python'
    But this is clean Python on my system, all the modules that I previously installed is in /System/Library/Frameworks/Python.framework/... so it's not so great.

    1. Sorry, PYTHONPATH should be set as:

  3. Thanks for your great tutorial. I had problem with addressing python host like this:
    let g:python_host_prog = '~/syspython2'
    This should be:
    let g:python_host_prog = '/Users/username/syspython2'
    With this configuration it works :)

  4. Thank you. Excited to use lldb in neovim now!

  5. This comment has been removed by the author.

  6. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

    Data Science In Banglore With Placements
    Data Science Course In Bangalore
    Data Science Training In Bangalore
    Best Data Science Courses In Bangalore
    Data Science Institute In Bangalore

    Thank you..

  7. Nice knowledge gaining article. This post is really the best on this valuable topic.
    Data Science Course in Bangalore

  8. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website.
    Data Science Training in Bangalore

  9. It is the level of shared understandings required in our most inconsequential forms of social interaction which necessarily require that individuals assume complicated shared knowledge that is too complex for even the must sophisticated forms of artificial intelligence as conceived to date, in which propositions are either true or false and premises must follow deductively. artificial intelligence training in hyderabad

  10. really this is awesome post. Truly, one of the best posts I've ever witnessed to see in my whole life. Wow, just keep it up.Learn Data Science Course in Hyderabad

  11. I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site.Learn Best Data Science Training in Hyderabad

  12. This comment has been removed by the author.

  13. really awesome post this is. Truly, one of the best posts I've ever witnessed to see in my whole life. Wow, just keep it up.Learn best Business Analytics Course in Hyderabad

  14. This is actually the data I'm searching for, I was unable to have requested a less difficult perused with extraordinary tips this way... Much appreciated!
    artificial intelligence course in delhi

  15. I feel very impressed by the information shared and I really learned a lot from it thank you.
    Data Science Course in Hyderabad

  16. Big data is on the rise and so is the requirement for professionals with skills. The training enables folk to pursue an interesting career as a Data Scientist. data science course in hyderabad

  17. Awesome blog with excellent information and fantastic writing skills found very useful thanks for Sharing you.Data Analytics Course Online 360DigiTMG

  18. Very informative message! There is so much information here that can help any business get started with a successful social media campaign!

    Business Analytics Course in Bangalore

  19. It was only after the advent of Big Data that the world realized the tremendous force behind Data. This is a completely new profession with promising career growth and immense possibilities. Industries need Data Scientists in a large number, but there aren't enough currently and this is why the opportunities for fresher are almost endless. data science course syllabus

  20. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post.
    data science institute in hyderabad

  21. First off, data science training helps candidates choose better career paths. Therefore, these jobs are offered across the world. This training will help you be more skillful, proficient and technological aware. data science course syllabus

  22. Great Article. Thank you for sharing! Really an awesome post data science course in Hyderabad

  23. This is an excellent article. I like this topic. This site has many advantages. I have found a lot of interesting things on this site. It helps me in so many ways. Thanks for posting this again.

    Data Analytics Course in Bangalore

  24. This is a great motivational article. In fact, I am happy with your good work. They publish very supportive data, really. Continue. Continue blogging. Hope you explore your next post
    certification of data science

  25. As always your articles do inspire me. Every single detail you have posted was great.
    data science certification in noida

  26. Your content is very unique and understandable useful for the readers keep update more article like this.
    data scientist course in noida

  27. Happy to visit your blog, I am by all accounts forward to more solid articles and I figure we as a whole wish to thank such huge numbers of good articles, blog to impart to us.
    data scientist course

  28. Really Nice Information It's Very Helpful All courses Checkout Here.
    data science in malaysia

  29. Fantastic blog extremely good well enjoyed with the incredible informative content which surely activates the learners to gain the enough knowledge. Which in turn makes the readers to explore themselves and involve deeply in to the subject. Wish you to dispatch the similar content successively in future as well.

    Data Science Training in Raipur

  30. I really enjoy every part and have bookmarked you to see the new things you post. Well done for this excellent article. Please keep this work of the same quality.
    Artificial Intelligence course in Chennai

  31. Fantastic blog with excellent information and valuable content just added your blog to my bookmarking sites thank for sharing.
    Data Science Course in Chennai

  32. I want to leave a little comment to support and wish you the best of luck. We wish you the best of luck in all your blogging endeavours.
    Python Training in Hyderabad
    Python Course in Hyderabad

  33. Really wonderful blog completely enjoyed reading and learning to gain vast knowledge. Eventually, this blog helps in developing certain skills which in turn helpful in implementing those skills. Thanking the blogger for delivering such beautiful content and keep posting the contents in the upcoming days.

    Digital Marketing Training in Bangalore

  34. It took a while to understand all the comments, but I really enjoyed the article. It turned out to be really helpful for me and I'm positive for all the reviewers here! It's always nice to be able to not only be informed, but also entertained! I'm sure you enjoyed writing this article.
    Business Analytics Course

  35. Excellent Blog! I would like to thank you for the efforts you have made in writing this post. Gained lots of knowledge.
    Data Analytics Course

  36. You totally coordinate our desire and the assortment of our data.
    artificial intelligence course in pune

  37. Incredibly conventional blog and articles. I am realy very happy to visit your blog. Directly I am found which I truly need. Thankful to you and keeping it together for your new post.
    best data science course online

  38. Thanks For your post. This is rally helpful for Data science for beginner.
    data science course in aurangabad

  39. First You have a great blog .I will be interested in more similar topics. I see you have really very useful topics, I will be always checking your blog thanks.
    data scientist course in malaysia

  40. Very good points you wrote here..Great stuff...I think you've made some truly interesting points.Keep up the good work.
    data science course

  41. I read that Post and got it fine and informative. Please share more like that...
    data scientist training in malaysia

  42. Very good message. I came across your blog and wanted to tell you that I really enjoyed reading your articles.

    Cyber Security Colleges in Bangalore

  43. It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
    data science course

  44. Very good message. I came across your blog and wanted to tell you that I really enjoyed reading your articles.
    Data Analytics Bangalore

  45. All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks data science training in noida

  46. Very good message. I came across your blog and wanted to tell you that I really enjoyed reading your articles.

    Business Analytics Course in Kolkata

  47. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for science in bhubaneswar

  48. Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers.
    data analytics courses in hyderabad

  49. Very useful message. This is my first time visiting here. I found a lot of interesting things on your blog, especially your discussion. It really is a great article. Keep on going.

    Data Analytics Course in Ernakulam

  50. I want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging enedevors
    data science course in trivandrum

  51. I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation. Thanks a lot for keeping great stuff. I am very much thankful for this site. data analytics courses malaysia

  52. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one.
    Continue posting. A debt of gratitude is in order for sharing.
    data science training in gwalior

  53. It's like you've got the point right, but forgot to include your readers. Maybe you should think about it from different angles.

    Business Analytics Course in Gorakhpur

  54. I want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging enedevors
    business analytics course in varanasi

  55. 360DigiTMG is the most recommended Data Science course institute in Chennai. Get trained by top professionals from IIT, IIM and, ISB. Enroll now!
    business analytics course in bhubaneshwar

  56. The increase in big data has led to a boom in the field of Data Science spiking ample career opportunities. Enroll in the Data Science training in Bangalore and invest in emerging skills and transform any business by wrangling, analyzing, and visualizing data. Give your career a makeover and gain in-depth knowledge on how to extract valuable insights from complex and large sets of data. Get to work on a live project which is designed to give hands-on experience to you along with career guidance and mentorship.

    Business Analytics Course in Jodhpur

  57. Register for the Data Science certification in Bangalore and gain recognition and credibility in your organization. Learn the techniques to examine large data sets and discover patterns that are valuable to predict market trends. Learn Data Exploration and Visualizations, Neural Networks and Deep Learning, Model Evaluation and Analysis. This course will ensure that you are challenged to go from a beginner with no Data Science experience to someone who can juggle data with ease.

    Data Science Course in Bangalore with Placement

  58. 360DigiTMG provides you the best Data Science Course in Bangalore, with excellent training from the best trainers in the field and real-time projects, soon you will be an expert in the domain with the highest paid job.

    Best Data Science Training institute in Bangalore

  59. Venture into the world of opportunities with Data Science in Bangalore and learn the valuable skills to demonstrate your capabilities to tackle this evolution of huge data. Avail benefits like Placement Assistance, Mock Interview, and Resume Building support from the placement team. Enroll now and learn Python, Tableau, SQL, Hadoop, and Spark to become a specialist in Data Science.

    Data Science Course in Delhi

  60. 360DigiTMG is India's number one Data Science Training Institute. Avail of the best training from professional trainers with a world-class curriculum, LMS Access, real-time projects, and assignments that will help you grab your dream job.

    Data Science Course in Bangalore with Placement

  61. K-Nearest Neighbour (KNN) algorithm is one of the uncomplicated ML algorithms based on the Supervised Learning Technique. It assumes the similarities between the new and available data and categorizes them based on pre-existing groups while storing all the available data. KNN incorporates a data point based on similarities of new and old data. It is used for both regression and classification of data, but the latter is used frequently. To learn more about KNN start your Data Science training today with 360DigiTMG

    Data Science Course in Jaipur

  62. Join Data Science classes with 360DigiTMG and get job-ready in 4 months. A world-class curriculum, LMS Access, Real-time projects, and assignments will aid you in getting a high-paying job.

    Business Analytics Course in Jodhpur

  63. Explore what the best Data Science training institute is offering you. Learn advanced technologies from the best industry experts.
    data analytics course in patna

  64. This 1xbet korea is completely different to a sport corresponding to Blackjack where the probabilities change as cards are dealt. With an inside wager, you won’t win as much, however your odds of profitable are much greater. The inside wager choices are sometimes all grouped in a grid in the direction of|in course of} the underside of the desk. When you play Roulette, there are quantity of} other ways you'll be able to|you presumably can} wager. Much of the tablespace is covered with a large grid that outlines the wheel numbers. If you are utilizing a genetic algorithm where a number of the} inhabitants have a score of zero, however proceed to} wish to embody them in the choice course of, you must to} consider using a different choice method.

  65. The blog is very informative and useful.Thanks for the blog.
    Python Course in Nagpur

  66. Thanks for sharing this here. Great Post, really it was very helpful for us. I found this blog to be very useful! python classes in satara

  67. Nice! you are sharing such helpful and easy to understandable blog. i have no words for say i just say thanks because it is helpful for me. Looking for top-notch online tuition for Class 7? Ziyyara Edutech offers the finest home tuition classes for Class 7.
    Book A Free Demo Today visit Home tuition classes for class 7