Skip to content

Unable to select virtual environment not located at root #1019

Closed

Description

Environment data

  • VS Code version: 1.21.0
  • Extension version (available under the Extensions sidebar): 2018.2.1
  • OS and version: Windows 10 64 Bit
  • Python version: 2.7 and 3.6
  • Type of virtual environment used (if applicable): venv
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

Selecting python executable to run in the lower left hand corner only displays options for the default installed python libraries and virtual environments found at workspace root.

image

image

Expected behavior

Extension should either be able to search within the directory tree for virtual environments contained within folders (for example, I have a venv folder located at .\partner-api\venv), or users should be able to type in a full path to a python executable and have this added to the list.

Steps to reproduce:

  1. Add folder to workspace
  2. Add virtual environment root folder to created folder
  3. Reload VSCode (ref issue New workspace virtual environments are not discovered until VS Code reloads #656)
  4. See that new virtual environment has not been added to the list

Logs

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

none

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

none

Activity

  1. DonJayamanne commented on Mar 10, 2018

    @DonJayamanne

    We look for environments in a specific set of directories.
    For instance we do look for environments in the workspace, but only directly in the current workspace, i.e. not 2-3 levels deep. Doing so, is not practical as we'd end up crawling the entire directory structure (imaging a user opening the root directory in VS Code).

    The solution in such an instance is for you to use the setting venvPath as follows:

    "python.venvPath": "folder path you'd like the extension to look for environments in"
  2. DonJayamanne commented on Mar 10, 2018

    @DonJayamanne

    Oops, please confirm this works for you.

  3. jtdavis777 commented on Mar 10, 2018

    @jtdavis777
    Author

    This works if I put a specific directory in, but not with wild characters.

    What worked: ${workspaceFolder}\\partner-api
    What I would like to work: ${workspaceFolder}\\*

    Thank you for the quick reply and solution :) the above method will work, but if I move to having more than one of these setups, I would like to not have to edit this each time (first world problems, I know)

  4. brettcannon commented on Apr 18, 2018

    @brettcannon
    Member

    microsoft/vscode-docs#1568 is about documenting python.venvPath better. But as of right now the wildcard directory traversal hasn't seen enough demand to warrant trying to support it (if others come and vote for this then do leave a comment and we will consider re-opening).

  5. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions