Skip to content

Support egg/zip files for IntelliSense #2532

@malmaud

Description

@malmaud

Environment data

  • VS Code version: 1.27.1
  • Extension version (available under the Extensions sidebar): 2018.8.0
  • OS and version: OS X 10.13.6
  • Python version (& distribution if applicable, e.g. Anaconda): conda Python 3.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: torchvision (installed via conda install pytorch torchvision -c pytorch)

Expected behavior

Expect autocompletion in a buffer after

import torchvision
torchvision.

Actual behavior

Only generic suggestions with the 'abc' icon are listed.

It seems intellisense isn't finding the torchvision package. It looks like torchvision configures itself via a .pth file:

~/anaconda3/lib/python3.6/site-packages $ cat torchvision.pth
./torchvision-0.2.1-py3.6.egg

which results in the following sys.path from a Python session (note the special entry for 'torchvision-0.2.1-py3.6.egg'

In [1]: import sys

In [2]: sys.path
Out[2]:
['',
 '/Users/malmaud/anaconda3/bin',
 '/Users/malmaud/anaconda3/lib/python36.zip',
 '/Users/malmaud/anaconda3/lib/python3.6',
 '/Users/malmaud/anaconda3/lib/python3.6/lib-dynload',
 '/Users/malmaud/.local/lib/python3.6/site-packages',
 '/Users/malmaud/anaconda3/lib/python3.6/site-packages',
 '/Users/malmaud/anaconda3/lib/python3.6/site-packages/aeosa',
 '/Users/malmaud/anaconda3/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg',
 '/Users/malmaud/anaconda3/lib/python3.6/site-packages/IPython/extensions',
 '/Users/malmaud/.ipython']

Perhaps VSCode isn't accounting for the pth file modifying sys.path when it searches for torchvision?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions