We had to restart our R Server (EC2 box), and following its restart, my Jupyter notebooks are throwing errors that regularly-used, imported modules cannot be found:
(in Jupyter Notebook cell)
import MySQLdb as mysql
ImportError: No module named 'MySQLdb'
But when I used the command line to verify that the module is imported (based off of the suggestion here), I saw that it was still present in the system. Is there something I'm missing, here?
(base)$ python -c "import MySQLdb"
(base)$ echo $?
0
For context, the Jupyter file used was using the MySQLdb module prior to the restart of the server. Also, not sure if it's important to know, but I had to reconnect my hard drive from the command line post-reboot as well:
sudo mount /dev/xvdf /mnt/ebs
After doing some back-tracking, we were able to resolve the issue!
Jupyter was initiated prior to mounting the server to the hard drive. Our Python modules are within the Anaconda environment in the server, and without the hard drive's connection to the server, the imported Jupyter pointed to the computer's python environment.
Posting steps on how we resolved the issue in case it comes up for others:
We rebooted the server again. This was to give the reconnection channels a re-start.
After a reboot:
➜ ~ ssh # onto the EC2 box
(base):~$ sudo mount /dev/xvdf /mnt/ebs # reattach external drive
(base):~$ screen -S somenameforscreensession # start a screen session (persistent session)
(base):~$ jupyter notebook --port=#### # start jupyter within that persistent session
Related
It seems that DataSpell is trying to execute this command: C:\Windows\system32\wsl.exe --distribution Debian --exec /bin/sh -c "export LANGUAGE='' && export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8 && /usr/bin/python3 -m jupyter notebook --no-browser '--notebook-dir=/mnt/c/Users/Andy Zhou/Desktop/Year 2 stuff/GPT-2/code/SERI MATS IOI' --ip=172.22.246.59"
However, when I directly execute the part after --exec on WSL it works.
Adding some additional information regarding your problem, such as the error code that DataSpell likely returned to you, or whether or not htop shows a running Jupyter server, would make providing an accurate answer much easier.
As such, I believe your question could be read two ways, and I've provided an answer for each.
Server starts but will not connect
When DataSpell launches a local WSL-based Jupyter server it makes certain assumptions about how the connection should work, it also uses the LAN address for your WSL instance to attempt to connect. The default Jupyter config assumes a local connection, so DataSpell's connection via an external IP address is rejected immediately.
Steps to resolve this issue:
In WSL run jupyter notebook --generate-config, it will print out the path of your new config file
Vim into the new file and set the following values:
# Please note that the below values can be unsafe, consider changing these values to only allow your IP address to connect; alternatively you could require authentication to access the server.
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '0.0.0.0'
## Set the Access-Control-Allow-Origin header
c.NotebookApp.allow_origin = '*'
## Allow requests where the Host header doesn't point to a local server
c.NotebookApp.allow_remote_access = True
Configure a WSL Python interpreter, detailed here: https://www.jetbrains.com/help/dataspell/using-wsl-as-a-remote-interpreter.html
Change the Jupyter connection for your project to use the interpreter you just set up, detailed here: https://www.jetbrains.com/help/dataspell/using-wsl-as-a-remote-interpreter.html
Run a cell in your notebook, a server should start up automatically and connect just fine.
A good resource on this is the following question: Why I can't access remote Jupyter Notebook server?
Sever does not start when using WSL
Unfortunately this is far more broad, and will almost certainly require more information to solve, but the following issues are highly likely causes:
Your WSL installation didn't include rsync: https://www.jetbrains.com/help/dataspell/using-wsl-as-a-remote-interpreter.html#prereq
WSl does not have Jupyter installed:
Install Jupyter via pip, or conda: {pip|conda} install jupyter
WSL isn't running when DataSpell attempts to run a notebook
Unfortunately without more information, or at least an error code, it isn't possible to give you a definitive answer; but hopefully this helped you in the right direction!
I want to use a remote Jupyter server via SSH with VSCode but I get an error whenever I try to specify the URI of any server. This also happens with local instances of Jupyter. Any server that is not started by VS Code seems to be unusable.
I am just starting a server like this
$ jupyter notebook --no-browser --port 8080
Then I enter the address in VSCode with the correct port and token
Nothing happens and I get this error, as you can see in the log below.
Command 'Python: Specify local or remote Jupyter server for connections' resulted in an error (Running the contributed command: 'python.datascience.selectjupyteruri' failed.)
Has anyone else been experiencing anything similar? I honestly have no idea how to troubleshoot this. It is worth noting that selecting the Default: VS Code will automatically start a server for you on localhost option raises the same error.
It looks like you're running a fairly old version of the Python extension, as the python.datascience.selectjupyteruri command no longer exists in the Python extension—it is now provided in a standalone Jupyter extension. Please consider upgrading to the latest version of the Python and Jupyter extensions. If that doesn't resolve the problem, please file an issue at https://github.com/microsoft/vscode-jupyter/issues and we'll be happy to help.
I just installed Anaconda on y windows 10, but when I try to run the jupyter notebook or jupyter lab by the icon, nothing happend.
Tried to run the jupyter by anaconda prompt and got the error: The port 8888 is already in use, trying another port.
Tried to run in several different ports and the error is the same.
Tried to kill the task by PID and when I run the jupyter again by promp and it lasts forever and nothing happens
Tried to change the browser by manual config and everything is the same
Tried to uninstall anaconda and install again several times and boom: Same errors
I checked also proxy stuff but everything related to this is unable on my pc
Checked firewall and antivirus and also everything seems to be normal
Any other recommendation is welcome :)
As mentioned here you may just change port to other, for example:
jupyter notebook --port 8889
I am leading a team of analysts and want to introduce them to Jupyter Notebook as a window into Python programming.
We have Anaconda downloaded and installed on our Linux server. I've asked our IT to help set it up to run on Google Chrome and they have been able to only provide the following steps:
source /R_Data/anaconda3/etc/profile.d/conda.sh
this kicks off Anaconda on the server, must run in PUTTY. We stored the installation in the same location as RStudio hence the R_Data in the filepath.
/R_Data/anaconda3/bin/jupyter-notebook --ip 0.0.0.0 --port 8889
This sets up the port 8889 with a token generated each time from scratch. We then need to grab the token id and paste into Chrome with the full URL per step 3
http://localhost:8889/?token=ea97e502a7f45d....
When I paste this in Chrome it loads Jupyter.
While this gets the job done it seems less than ideal for an entire team of analysts to have to do this each time. We also have RStudio installed on the same server but that simply opens from Chrome using a URL since I assume it is always running in the background. Jupyter and Anaconda seem to only run once they are kicked off first in PUTTY and I would like a way to bypass those steps.
I am familiar with the Jupyter config file however my limited understanding as a non-developer tells me it applies only to each user and cannot be applied to all users simultaneously (i.e. as a root user on the server or something to that effect).
I am hoping someone here might point me in the right direction. I should also point out that as a Redhat user I can't follow instructions based in Ubuntu since that syntax seems different.
Many thanks for the help.
Yoni
A convenient way is to run jupyter notebook --no-browser --port=12345 on your server while connecting through the ssh tunel as ssh -N -f -L 12345:localhost:12345 myserveralias. Now jupyter is on your 12345 localhost. Things like AutoSSH or Keep Alive will help with an erratic network, however, take security into account.
I have a problem trying to run a python project, I already installed Python 2.7 and Google Cloud SDK (I followed up the instructions in https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python), but I get the following error:
ImportError: No module named appengine.api
Also I set up the enviroment variables:
Enviromental variables
Windows Location
My OS is Windows 10
If you execute the project in local, you would get that error(google.appengine.api error). Basically it has to be executed on a server.
The server can be started using your terminal.
1) Go to the project path(root folder of all files in the project,eg: appengine)
2) start the server using $ dev_appserver.py app.yaml. It starts server at localhost port 8000 as the default one.
3) In the server start depends on the handler and its path specified (like '/' or '/testjob') try localhost:8000/ or localhost:8000/testjob
4) All the logs written in the program will be shown in the terminal. For logs try using 'logging' module , make sure to mention the logging level else basic level logs are not shown