1

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

0x4ndy
  • 1,216
  • 1
  • 12
  • 25
  • ``requests`` is not builtin it comes from an external package. You can verify that with ``python3 -m venv venv``, ``source venv/bin/activate``, ``python3`` then ``` >>> import requests Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'requests' ``` – Pierre.Sassoulas Aug 13 '23 at 15:31

1 Answers1

2

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.

Pierre.Sassoulas
  • 3,733
  • 3
  • 33
  • 48