Skip to content
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

Jupyter doesn't update env values on restart when .env file gets updated #9893

Closed
1 of 2 tasks
vladpy8 opened this issue May 4, 2022 · 1 comment
Closed
1 of 2 tasks
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue needs to be triaged

Comments

@vladpy8
Copy link

vladpy8 commented May 4, 2022

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Hello

It seems that VSCode and Juputer extension don't update environment variable values, when value is changed in .env file.

.env file is located in VSCode/Juyter/project root directory

Action, which, I believe, will reproduce issue:

  1. Set some variable value in .env:

MY_CUSTOM_VAR=value_1

  1. (Re)Start .ipynb and check value has been set:

os.getenv('MY_CUSTOM_VAR')

'value_1'

  1. Change value of the very same variable in .env:

MY_CUSTOM_VAR=value_2

  1. Reload and restart VSCode and kernels as many times as you believe necessary, but at least once
  2. Observe that variable's value doesn't change:

os.getenv('MY_CUSTOM_VAR')

'value_1'

Is that intended behaviour?

I use conda environment packaged with python, ipykernel and jupyter:


name: test
channels:
  - conda-forge
  - defaults
  - microsoft
dependencies:
  - tqdm
  - jupyter
  - lxml
  - python=3.9
  - matplotlib
  - pandas[version='>=1.4']
  - ipykernel
  - openpyxl
  - gspread
  - aiohttp[version='>=3.8']
  - pylint
  - dataframe_image

(some packages have been removed for security reasons, but should work)

VS Code Version

1.66.2

Jupyter Extension Version

v2022.3.1000901801

Jupyter logs

No response

Coding Language and Runtime Version

3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:59) [GCC 10.3.0]

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

4.12.0

Running Jupyter locally or remotely?

Local

@vladpy8 vladpy8 added bug Issue identified by VS Code Team member as probable bug needs-triage labels May 4, 2022
@rchiodo
Copy link
Contributor

rchiodo commented May 4, 2022

Thanks for the issue. This is a known issue: #9774.

@rchiodo rchiodo closed this as completed May 4, 2022
@greazer greazer added triage-needed Issue needs to be triaged and removed needs-triage labels May 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2023
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 triage-needed Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants