Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliSense fails to detect editable installs after setuptools update #3265

Closed
stur86 opened this issue Aug 31, 2022 · 6 comments
Closed

IntelliSense fails to detect editable installs after setuptools update #3265

stur86 opened this issue Aug 31, 2022 · 6 comments
Assignees
Labels
by design pep 660 Issues related to PEP 660 import hooks

Comments

@stur86
Copy link

stur86 commented Aug 31, 2022

Type: Bug

Behaviour

Expected vs. Actual

IntelliSense should detect pip-installed packages even if the -e option was used to install them in editable mode. However, a few weeks ago, in order to comply with PEP 660 (see also pypa/setuptools#3548 ), setuptools changed the way editable installs work, by introducing __editable__<pkg>_finder.py files in place of symlinks. This has made IntelliSense unable to detect them.

Steps to reproduce:

  1. Create a new clean environment
  2. Install a local package with pip install -e <path-to-pkg>
  3. Launch VSCode, pick the environment, and try to import the installed package

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.10
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): PipEnv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User Settings


languageServer: "Pylance"

Extension version: 2022.12.1
VS Code version: Code 1.70.2 (e4503b30fc78200f846c62cf8091b76ff5547662, 2022-08-16T05:35:13.448Z)
OS version: Windows_NT x64 10.0.22000
Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.85GB (6.53GB free)
Process Argv --crash-reporter-id 76063c4e-ccc2-4582-a085-59632bf67ccf
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30557514
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
pylanb8912:30545647
vsclangdc:30486549
c4g48928:30535728
hb751961:30553087
dsvsc012:30540252
azure-dev_surveyone:30548225
i497e931:30553904

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Aug 31, 2022
@judej judej added the needs decision Do we want this enhancement? label Aug 31, 2022
@judej judej added the needs investigation Could be an issue - needs investigation label Aug 31, 2022
@stur86
Copy link
Author

stur86 commented Sep 7, 2022

Any updates on this?

@erictraut
Copy link
Contributor

See this issue for additional details: microsoft/pyright#3880.

@huntzhan
Copy link

huntzhan commented Sep 8, 2022

Yeah, there's a quick and dirty solution:

pip uninstall your_package
export SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
pip install -e your_package

@stur86
Copy link
Author

stur86 commented Sep 8, 2022

Thanks, that should do as a fix for the meantime! Any future plans/routes to actually solve this for good?

EDIT: it actually doesn't do as a fix for me; it still doesn't work.

@debonte
Copy link
Contributor

debonte commented Sep 8, 2022

@stur86, we're thinking about it. This is not going to be a quick fix.

@debonte debonte added the pep 660 Issues related to PEP 660 import hooks label Oct 13, 2022
@debonte
Copy link
Contributor

debonte commented Oct 13, 2022

There has been discussion about ways to solve this problem. See this typing-sig thread. If a solution is found, agreed upon by typing-sig, and standardized, Pylance will consider supporting it.

However, for the time being this is by design since your editable install is using an import hook. There are more details including workarounds here.

@debonte debonte closed this as completed Oct 13, 2022
@debonte debonte added by design and removed needs decision Do we want this enhancement? needs investigation Could be an issue - needs investigation labels Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
by design pep 660 Issues related to PEP 660 import hooks
Projects
None yet
Development

No branches or pull requests

6 participants