Skip to content

Jupyter doesn't work with anaconda #5539

Description

@zohaad

Environment data

  • VS Code version: 1.33.1
  • Extension version (available under the Extensions sidebar): 2019.4.2
  • OS and version: macOS Mojave 10.14.3
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.1 Anaconda 64-bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: N/A

Expected behaviour

Jupyter loads correctly

Actual behaviour

it fails to load with anaconda

Steps to reproduce:

  1. select code
  2. shift + enter

Logs

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

Executing code failed : Error: Activating Python 3.7.1 64-bit ('py37': conda) to run Jupyter failed with Error: Command failed: . /anaconda3/envs/py37/bin/activate && conda activate py37 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /Users/zohaad/.vscode/extensions/ms-python.python-2019.4.12954/pythonFiles/printEnvVariables.py CommandNotFoundError: 'activate is not a conda command. Did you mean 'source activate'? .

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

XXX

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on May 2, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on May 3, 2019
  3. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on May 6, 2019
  4. rchiodo commented on May 6, 2019

    @rchiodo

    This is not datascience specific. I think the error is we're using '. ' instead of source, although from this
    https://github.com/Microsoft/vscode-python/blob/b741e1af6d53cdf94765a6708964d489bd558ff8/src/client/interpreter/activation/service.ts#L105

    It looks like it was on purpose.

  5. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on May 16, 2019
  6. aldanor commented on May 18, 2019

    @aldanor

    Don Jayamanne (@DonJayamanne) Rich Chiodo (@rchiodo) Uwe L. Korn (@xhochy)

    Building the latest extension version from github master, activation errors still persist with conda.

    Basically, before a recent PR (#5516, #4402), I think it was trying to do something like this, which is wrong:

    $ <ENV>/activate
    
    Error: activate must be sourced. Run 'source activate envname'
    instead of 'activate envname'.

    Now it's trying to do something like this (but it's also still wrong!):

    $ source <ENV>/bin/activate
    
    Error: no environment provided.

    It should be either this:

    $ source <ENV>/bin/activate <ENV>

    Or, as a matter of fact, conda guys officially suggest using conda activate and conda deactivate instead of sourcing things manually: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment

  7. aldanor commented on May 18, 2019

    @aldanor

    The only way I can make it work (and this is on conda/macOS) is replacing the <ENV>/activate script in the environment with this one-liner (where <ENV> is the full absolute path to the environment):

    export $PATH=<ENV>/bin:$PATH

    Then the Jupyter stuff launches fine (just to verify).

  8. xhochy commented on May 18, 2019

    @xhochy

    This is weird. The latest nightly is working for me with conda 4.6. What conda version do you have installed?

  9. aldanor commented on May 18, 2019

    @aldanor

    Uwe L. Korn (@xhochy) conda is 4.6.14, the extension I've just built from the latest master, with a clean install.

    Again, seeing what the extension is trying to do - e.g., even jupyter aside, if you select some code and shift-enter, it tries to fire a python console, and prior to that attempts to activate the environment like this: source <ENV>/bin/activate, which doesn't seem right.

  10. 4 remaining items

  11. nameoverflow commented on Jun 22, 2019

    @nameoverflow

    The plugin tries to find a conda executable from the same or upper directory of current interpreter (https://github.com/DonJayamanne/pythonVSCode/blob/f590f9c89ae5ee31f33bc66626e9f8279ea17763/src/client/interpreter/locators/services/condaService.ts#L249)
    but the conda executable is located in <conda_path>/condabin in current version.
    So what the problem with just running conda command from PATH ?

  12. atakanokan commented on Sep 1, 2019

    @atakanokan

    What have helped me is to install VS Code from the Anaconda Navigator and starting the application from there. Not sure if it will help you though. (macOS)

  13. DonJayamanne commented on Dec 5, 2019

    @DonJayamanne
  14. Arpiiitaaa commented on Oct 1, 2021

    @Arpiiitaaa

    Luciana Abud (@luabud) may I take this up?

  15. karrtikr commented on Oct 20, 2021

    @karrtikr

    Should be addressed with #15818

  16. locked as resolved and limited conversation to collaborators on Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions