Search code examples
pythonneovimpylintnvim-lspconfig

pylint: unable to import 'requests' using nvim with pylsp and pylint enabled


I'm having a weird problem with pylint complaining about an import problem:

pylint: [import-error] Unable to import 'requests' [E0401]

This makes no sense since requests is a standard library. Also, I have no issues with importing other standard libraries.

I've tried to with pylint and pynvim installed but changes.

I use:

  • neovim 0.9.1
  • pylsp with pylint enabled

When I run pylint from the command-line, this error doesn't appear.

Below I attach a screenshot showing exactly what I'm referring to:

enter image description here


Solution

  • requests is not installed in the env pylint's is run, localize where pylint is installed / run and install requests in it, for example with pip install requests.