14

Recently, code analysis tools like PyCharm and Pylance in VSCode are not picking up packages installed in editable mode (pip install -e <package_name>).

This made it so I could not navigate to imported modules by Ctrl-clicking (in VSCode), and it is not providing me docstrings for imported functions.

I noticed that where in my site_packages directory there used to be a file with the package's name, now there is only a file called __editable_package_name_finder.py instead.

1 Answer 1

34

setuptools has changed the way it carries out editable installs which seems to have broken compatibility with various tools. For an in-depth explanation of the behavior refer to this page.

Setuptools provides a config option to stick to the old installation method. Either by setting the following flag on install: pip install -e . --config-settings editable_mode=compat

Or by setting the environment variable SETUPTOOLS_ENABLE_FEATURES="legacy-editable" before installing, though this last method has the limtation explained in the note here:

Newer versions of pip no longer run the fallback command python setup.py develop when the pyproject.toml file is present. This means that setting the environment variable SETUPTOOLS_ENABLE_FEATURES="legacy-editable" will have no effect when installing a package with pip.

After reinstalling the desired package using legacy mode, you will probably need to either restart the editor, or in the case of VSCode run the command "Python: Restart language server" in Ctrl+Shift+P

Sign up to request clarification or add additional context in comments.

2 Comments

Wish I could give this more than one up vote.
youtrack.jetbrains.com/issue/PY-57566/… is the PyCharm issue for proper support, but apparently nothing was done since 2022.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.