Is sandbox necessary for vscode to run jupyter notebooks? - visual-studio-code

I am fairly new to vscode. On my Mac, I am able to get the jupyter notebook running and working as expected within vscode, but on my linux machine (CentOs 7), it fails with the error:
Error loading webview: Error: Could not register service workers: InvalidStateError:
Failed to register a ServiceWorker: The document is in an invalid state.
There are several posts stating that a simple restart or killall code will fix this problem, but that hasn't worked for me. I believe there are some potential differences here.
I don't have sudo permissions for installing vscode. I have the tarball extracted and run it via /path/to/code --no-sandbox.
Given this constraint, does that mean anything that needs webview, like opening an image in vscode or jupyter notebook, requires sandbox and therefore, I will not be able use any of those features?

Related

Why has Jupyter notebook kernel stopped working after RStudio package installation

To date I have been using Jupyter Notebook to run R and sometimes Python code. I have also been using RStudio at times. Recently, while using RStudio, I was prompted to install some package (cannot exactly remember). At any rate, I installed this package. Dont know if only coincidence, but trying to run R in the notebook resulted in kernel not connecting. I found the same issue with Python, the Python kernel is also not connecting anymore.
Executing the below, I get;
(base) C:\WINDOWS\system32>jupyter kernelspec list
Available kernels:
ir C:\Users\Admin\AppData\Roaming\jupyter\kernels\ir
python3 C:\Users\Admin\anaconda3\share\jupyter\kernels\python3
How do I get Jupyter Notebook's kernels to work again.
Executing IRkernel::installspec() in R via Anaconda CMD prompt have resolved the issue. Note for others with this issue, you may be prompted to run install.packages(“rlang”) before.

unable to create process in anaconda

Image showing result of anaconda prompt
I have been trying to launch anaconda after due installation but windows cannot start up. I also tried using the anaconda prompt but it keeps telling me "Unable to create process as shown in the image above". Please I need a solution to be able to launch the software. I have tried so many possible solutions online. Install and uninstall the software several times but the issues keeps on coming.
I tried uninstalling the software and re-install. Also edit the environment variables by copying and pasting the anaconda directory and it's script.

Stale environment variables in Jupyter Notebooks running in vscode using a conda environment kernel

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 jupyter 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
I've tried locating any files that could cache the env variables either in the conda env or jupyter extension. I've also tried restarting vscode and the machine itself - all without success.
Can anyone help me clean this up?
Thanks!!
Edit:
Another example:
If I set in my terminal
export FOO=BAR
then I can access $FOO as expected through the terminal and jupy notebook within vscode.
Then I close vscode, run
unset FOO
reboot the machine, start vscode new and open a new notebook with the same conda environment.
Within, running
import os
print(os.environ['FOO'])
STILL returns BAR
There seems to be an issue in the vscode-jupyter extension, that somehow stores the environment variables in the kernel.json file.
At the moment of writing this, the issue is still open. Working in ubuntu, this workaround from the issue's thread works for me:
Close code completely
find ~/.vscode/extensions/ms-toolsai.jupyter*
code .
Run a notebook and it will pick up the changes.
With closed vscode, issue the following command to delete cache:
find ~/.vscode/extensions/ms-toolsai.jupyter* -name kernel.json -delete
Source: https://github.com/microsoft/vscode-jupyter/issues/9774#issuecomment-1110328329

VS-Code won't starte because of missing /dev/fd/3

I'm using vs-code installed via snap on openSUSE Leap 15.2
Until rebooting my machine today everything was fine.
Now, when I try to start it, I get the following error:
No protocol specified
[7065:1118/173715.565235:ERROR:browser_main_loop.cc(1473)] Unable to open X display.
The futex facility returned an unexpected error code.
/dev/fd/3: No such file or directory
Server response:
I tried rebooting, reinstalling it, and deleting the ~/.config/Code folder, with no success.
Currently I have version 1.51.1 installed.
Edit:
I'm not root and I'm locally on a machine with GUI (KDE). Trying to start code as root gives the same error. Other graphical applications are working fine (like the browser I'm writing this from)
Try to set the environment variable called DISPLAY:
export DISPLAY=:0.0
or
export DISPLAY=:1.0
This worked for me

Enthought Canopy ipython configuration: bad interpreter No such file or directory

I'm trying to launch Enthought Canopy's ipython from a Terminal in Mac OS 10.8.3 using the following command:
/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/bin/ipython
but I'm receiving the following error:
/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/bin/ipython: /Library/Frameworks/Python.framework/Versions/7.1/Resources/Python.app/Content: bad interpreter: No such file or directory
This (7.1) framework was previously installed but was removed long ago, so I can't quite figure out where Canopy's IPython is getting this link from. I've checked my ./ipython/profile_default directory as well but this didn't help.
Any idea how I might be able to launch ipython from a Terminal?
Thanks!
Canopy uses virtual environments to setup a user environment which is isolated from the environment in which the app itself is running. This prevents any changes made to the environment, by the user, from crashing the application itself.
To run an IPython terminal, with access to any packages that you may have installed via the package manager, you should run IPython from the User environment -- ~/Library/Enthought/Canopy_64bit/User/bin/ipython