Skip to content

Activating Conda environment fails #2315

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

Closed
d3r3kk opened this issue Aug 2, 2018 · 6 comments
Closed

Activating Conda environment fails #2315

d3r3kk opened this issue Aug 2, 2018 · 6 comments
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@d3r3kk
Copy link

d3r3kk commented Aug 2, 2018

Python: Create Terminal command activates the (root) conda enviornment in VSCode instead of the configured environment.

Environment data

  • VS Code version: 1.26.0-insiders
  • Extension version (available under the Extensions sidebar): 2018.7.1
  • OS and version: Ubuntu 18.04
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda3-4.4.0 (installed via pyenv)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: n/a

Workspace Settings

{
    "python.pythonPath": "/opt/python/pyenv/versions/anaconda3-4.4.0/envs/issue1882/bin/python"
}

Actual behavior

The (root) environment is activated for a folder instead of the configured/specified one.

issue1882_wrong-conda-env

Expected behavior

The specified/configured environment is activated.

Steps to reproduce:

  1. Install Anaconda3-4.4.0 using pyenv
    > pyenv install anaconda3-4.4.0
  2. Create a folder in your home directory, say /home/user/conda_issue.
  3. Open a bash shell and navigate to your new directory.
  4. Create the conda environment for this folder, use the same name as the folder:
    > conda create -n conda_issue python=3.6.1
    (note Python version is same as what is associated with anaconda3-4.4.0)
  5. Create a simple python script in the folder.
    > echo "print('hello world')" > hello_world.py
  6. Run vscode-insiders from the command line, or open it using the desktop shortcut.
  7. In VSCode, open the 'hello_world.py' python file to activate the extension.
  8. Select the interpreter for the workspace, set it to the Python 3.6.1 :: Anaconda 4.4.0 (64-bit) (anaconda3-4.4.0) one.
  9. Reload the window, and note that the workspace settings contains the python.pythonPath for the anaconda python executable within the chosen environment.
  10. Run command Python: Create Terminal.

Logs

Output sent to the interactive terminal:

source /opt/python/pyenv/versions/anaconda3-4.4.0/envs/issue1882/bin/activate
dekeeler@dek-laptop-lnx:~/dev/github/d3r3kk/test/issue1882$ source /opt/python/pyenv/versions/anaconda3-4.4.0/envs/issue1882/bin/activate
(root) dekeeler@dek-laptop-lnx:~/dev/github/d3r3kk/test/issue1882$

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

N/A (nothing output)

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

N/A (nothing output)

@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug needs PR labels Aug 2, 2018
@DonJayamanne DonJayamanne self-assigned this Aug 2, 2018
@DonJayamanne
Copy link

I'm unable to replicate this at my end, must be cuz I have conda installed.

@DonJayamanne
Copy link

I think #1882 might have the solution. I.e. using conda activate.

@DonJayamanne
Copy link

Time to use the linux environment.

@DonJayamanne DonJayamanne removed their assignment Aug 2, 2018
@DonJayamanne
Copy link

This issue might have a dependency on #2266 (see #2266 (comment))

@brettcannon brettcannon changed the title Activating Conda environment fails under pyenv. Activating Conda environment fails under pyenv Aug 2, 2018
@brettcannon brettcannon added the important Issue identified as high-priority label Aug 2, 2018
@brettcannon brettcannon changed the title Activating Conda environment fails under pyenv Activating Conda environment fails Aug 2, 2018
@brettcannon brettcannon added P0 and removed important Issue identified as high-priority labels Aug 2, 2018
@DonJayamanne
Copy link

Lets leave this open, this issue is similar to #1882, but we need to ensure this is also resolved (i.e. ensure we install Anaconda via pipenv)

@brettcannon brettcannon added this to the Aug 2018 milestone Aug 2, 2018
@brettcannon brettcannon modified the milestone: Aug 2018 Aug 13, 2018
@d3r3kk
Copy link
Author

d3r3kk commented Aug 14, 2018

Closing in favour of #1882

@d3r3kk d3r3kk closed this as completed Aug 14, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants