Skip to content

Environment variables are cached when using conda env #9762

@DonJayamanne

Description

@DonJayamanne

Discussed in #9725

Originally posted by valpesendorfer April 20, 2022
Hi all,

I'm using jupyter inside a conda environment in vscode on Ubuntu and all works great. However, recently I've experienced issues with AWS access tokens expiring inside my jupyter notebook.

It seems that these access tokens get cached at some level, either in the code environment or somewhere in the jupter layer, but I couldn't figure out where and how to clean it up.

Example:

I'm using aws-vault to generate SSO credentails, that can be accessed in the environment.

After starting a session, I can access the AWS_SESSION_EXPIRATION from my terminal:

echo $AWS_SESSION_EXPIRATION
>2022-04-20T17:40:36Z

when I start vscode, open a terminal, I get the same.

When I activate my environment, and run python -c "import os;print(os.environ['AWS_SESSION_EXPIRATION'])", I get the same.

However, when I open a new jupyter notebook and select the same environment, and run

import os
print(os.environ['AWS_SESSION_EXPIRATION'])

I get 2022-04-06T11:09:03Z

Can anyone help me clean this up?

Thanks!!

Edit:

I've tried restarting vscode and the machine itself, but the issue remains.

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions