Pylance cannot find editable local import

Posted on Sat 27 May 2023 in Pylance, Python • Tagged with Pylance, Python

I had a problem with Pylance not finding a local import. I had installed the package in editable mode with pip install -e . and it was working fine in the terminal, but Pylance was not able to find it.

The solution was installing the package in strict mode with:

pip install -e . --config-settings editable_mode=strict

I got there from this troubleshooting page and this explanation in the Setuptools documentation.