jupyter notebook on AWS - python

I have set up a Jupyter notebook on an AWS box, or so I thought. When I try jupyter notebook, however, I get this:
[C 16:22:30.841 NotebookApp] The 'kernel_spec_manager_class' trait of instance must be a type, but 'environment_kernels.EnvironmentKernelSpecManager' could not be imported
Any suggestions on how to fix?
EDIT actually, when I run jupyter notebook in the base environment, it works (I can't connect to it, but that's obviously a separate problem). However, in a "nonstandard" environment, it does not start. To answer the questions, this is an ubuntu 18.04 deep learning image, and in the environment I had installed jupyter and jupyterlab (via anaconda)

The issue seems to be same as the one described here:
environment_kernels.EnvironmentKernelSpecManager could not be imported
Since in your question you have not indicated that you've tried that, I think that the solution proposed in the link could be tried:
pip install environment_kernels

Related

Jupyter notebook renders text instead of ipywidgets

My Jupyter notebook is displaying text rather than ipywidgets. Here is a screenshot:
I read several posts about similar problems, like this one:
Jupyter Notebook not rendering ipywidgets.
Most of them indicate that the solution is to enable an extension, e.g: https://stackoverflow.com/a/38001920/11692496
But it seems to apply to older version of jupyter notebooks. I tried it anyway (with the --sys-prefix argument, which is required for virtualenv), but it didn't fix it.
I'm working with a jupyter notebook and a virtualenv. Just to be sure, I created a fresh venv and installed the minimal packages. No luck.
I'm using Python 3.10.6 and here is my versions list:
Thanks for your help!
For the record, I didn't manage to solve this issue on my virtualenv.
As #Wayne suggested above, I went for a workaround, namely a docker container based on jupyter/tensorflow-notebook

Using Matlab.engine and installing tensorflow at the same time

Currently I am working on a project with Jupyter Notebook in which I need to run a matlab script (.m) which includes a function that provides me with data which i try to solve with a tensorflow model afterwards. I can set up an environment that runs the matlab code an gives me the data and I can set up an environment that does the tensorflow thing but my problem is I can`t do it in the same environment.
Here is the setup and the problems. I am using matlab.engine which I installed like described here: https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
To run my Jupyter Notebook I first navigate to the location where my python.exe and the matlab files are lying ("C:\Users\Philipp\AppData\Local\Programs\Python\Python37-32\Scripts"). If I try to run pip install tensorflow (in Anaconda Prompt) I got a lot of different errors like the following. Conda install works but even when it is installed i can`t import it.
ImportError: No module named 'tensorflow.core' or
ERROR: Could not find a version that satisfies the requirement tensorflow or just No module named 'tensorflow'
I searched for all those problems but nothing helped me. I think this has something to do with the directory I am working in and I know it is bad but I have no idea how to change that. The error also occurs in different environments.
Have you tried running !pip install tensorflow directly in Jupyter Notebook? It's a temporary workaround, but I am having the same problems and this one helped. Remember to comment it out after installation, so you wont re-run it by accident.
I found a solution to my problem. For this I needed a Jupyter Notebook and an external .py script that I design as a Flask. I can luckily run those in different environments. I past and request the data from the server by using "get" and "post".
If someone still has another idea to do all this in one JN, I would still be happy about answers.

vscode jupyter notebook: Session cannot genreate requests

I've been using vscode with Jupyter notebook extension (now maintain by Microsoft) for two years but It's weird to encouter the problem never met before as the error said:
Error: Session cannot generate requests
at S.executeCodeCell (c:\Users\alex0\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:301742)
at S.execute (c:\Users\alex0\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:300732)
at S.start (c:\Users\alex0\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:296408)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at t.CellExecutionQueue.executeQueuedCells (c:\Users\alex0\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:312326)
at t.CellExecutionQueue.start (c:\Users\alex0\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:311862)
The problem shows when I train the CNN model. The model I've built previously bumped into this problem, but it works fine when preparing other deep learning models. What I've tried:
Install anaconda, use its kernel.
re-install Jupyter notebook extension and re-open vscode.
run vscode as administrator.
All of them get no luck. The script has been tested and run sucessfully on Google Colab, and it's the alternative I am using now. Is there any way I can fix it?
Other information:
windows 11
vscode version: 1.62.3
jupyter notebook extention: v2021.10.1101450599
anaconda with its Python 3.9.6 version package
Python(self-installed): 3.9.7
I'll provide extra information if necessary. Thanks.
It's likely your kernel is crashing for some reason. Can you log an issue here?
https://github.com/microsoft/vscode-jupyter/issues.

jupyter notebook not showing python option under new

I am having a problem with creating a new ipython notebook.
Previously I used to do that going to new -> python
but now I am unable to see any python option.
Also, I am unable to open any ipython notebooks, I have one uploading for hours now.
I recently erased my %temp% folder to free some space in the C drive. Does that have something to do with this? How do I fix this?
I solved the problem!
For some reason, jupyter labs was not installed
So running the command
jupyter -- version
and then checking what all was installed, I found out that jupyter labs was not installed?
pip3 install jupyter labs
so I went ahead and installed it and everything works as it did before.
Still don't know the reason why this all happened in particular. If anyone could help me with that'd be awesome!
I'm not sure 100% but this is most commonly related to an ipython jupyter notebook file error. I do recommend to do a clean install of the notebook and try again. As I don't have any specifications on your system is difficult to guide you on the process. But that is the best option you have now.
Also this could have happened because of an update on python, jupyter, your system or any base component required by jupyter or python.

Sync Jupyter notebook with Python session

I'm starting to use Python and Jupyter notebook for data analysis. I like Jupyter notebook but I sometimes prefers to use Spyder to have a quick look at the objets saved in memory (variables, dataframes, ...)
That's why I'd like to know if it's possible to have a shared
workspace between a Python session open in an IDE (like Spyder or Rodeo) and a notebook, so I can share object and avoid executing the same code twice to have the best of both world.
At least in theory, Spyder supports connecting to an external IPython kernel (e.g. one managed by Jupyter Notebook) via the "Connect to existing kernel" option: https://pythonhosted.org/spyder/ipythonconsole.html
The connection info for that can be obtained as described in http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Connecting%20with%20the%20Qt%20Console.html#Manual-connection
Unfortunately, that isn't actually working for me with Fedora 24's Spyder (2.3.9) and IPython (3.2.1), so I'm marking this answer as Community Wiki.

Categories

Resources