question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Julia kernel not respecting environment selection

See original GitHub issue

Environment data

  • VS Code version: 1.56.0-insider
  • Jupyter Extension version (available under the Extensions sidebar): 2021.6.790799743
  • Python Extension version (available under the Extensions sidebar): XXX
  • OS (Windows | Mac | Linux distro) and version: Win10 21H1 (19043.962)
  • Python and/or Anaconda version: (Conda pkg from Julia)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A?
  • Jupyter server running: Local

Expected behaviour

When using a Julia notebook, having selected a Julia environment, available packages should reflect that environment, and adding/removing packages should affect only that environment.

Actual behaviour

Only the default (eg, “v1.6”) environment is used. The selected environment is indexed, but commands are not run against it.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Install Julia
  2. In Julia: import Pkg
  3. Pkg.add("IJulia")
  4. Pkg.add("Conda")
  5. import Conda; Conda.add("ipython")
  6. ] to get to Pkg mode, prompt should reflect v1.6 environment
  7. build
  8. (At this point, I believe Jupyter kernel should now be available for connection)
  9. still in Pkg mode: activate cas
  10. (At this point a new environment folder has been created)
  11. add SymPy
  12. (At this point, cas environment, not the v1.6 environment, should have SymPy installed. Verify with st command.)
  13. In VSCode, add new notebook, set for Julia.
  14. 1+1 (should return 2)
  15. using SymPy (returns LoadError – this is expected)
  16. select cas environment via UI in status bar … probably located under user folder
  17. using SymPy (returns LoadError – this is the problem)
  18. Open new Julia shell. Type ] for Pkg mode. Prompt should show v1.6 environment.
  19. st to confirm SymPy not present
  20. add SymPy; verify with st
  21. Repeat starting at (11). Lines 13 and 15 should both succeed. @vars x y should return (x, y)
  22. while in the cas environment in VSCode, import Pkg; Pkg.remove("SymPy")
  23. In Julia shell’s Pkg mode, st should now show SymPy removed from v1.6 environment, yet remains in cas environement. This is the problem, again.

Logs

> ~\AppData\Local\Programs\Julia-1.6.1\bin\julia.exe -i --color=yes --project=@. ~\.julia\packages\IJulia\e8kqU\src\kernel.jl ~\AppData\Local\Temp\tmp-26076Hwwked5aynhv.json
cwd: ~\AppData\Local\Programs\Microsoft VS Code Insiders

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
deoradhcommented, Apr 28, 2021

I’ll open an issue on their end and xref.

0reactions
rchiodocommented, Aug 31, 2021

I believe @davidanthoff addressed this in the julia extension.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how do I configure IJulia kernel to use specific environment?
In the notebooks I would like to import library , and install its dependencies within its own evironment. Following the sugestions here, I...
Read more >
Can't restart kernel in VSCode jupyter notebook - VS Code
6, I created a new environment, but the notebook does not seem to respect the chosen environment from VSCode, according to Julia kernel...
Read more >
1. Setting up Your Julia Environment
Overview¶. In this lecture we will cover how to get up and running with Julia. While there are alternative ways to access Julia...
Read more >
Working with Jupyter code cells in the Python Interactive window
To select an environment, use the Python: Select Interpreter command from the Command ... Run Above applies to all the code cells up...
Read more >
Installation · Documentation - Interpretable AI
Install Julia and the IAI system image manually, which is a more involved process but ... make sure you select the version that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found