Unable to start jupyter - ipython

When i try to run jupyter it shows me this error :-
ERROR: the notebook server could not be started because no available port could be found.
Terminal Logs are as follows:-
[I 20:52:08.747 NotebookApp] The port 8888 is already in use, trying another random port.
[I 20:52:08.748 NotebookApp] The port 8889 is already in use, trying another random port.
[I 20:52:08.748 NotebookApp] The port 8890 is already in use, trying another random port.
[I 20:52:08.749 NotebookApp] The port 8891 is already in use, trying another random port.
[I 20:52:08.750 NotebookApp] The port 8892 is already in use, trying another random port.
[I 20:52:08.750 NotebookApp] The port 8988 is already in use, trying another random port.
[C 20:52:08.779 NotebookApp] ERROR: the notebook server could not be started because no available port could be found.
And, I also checked my system to check which process is running on that port and I found that no process is running and none of these ports are used by any process. But, I still get that error.
I also changed a default port of jupyter to various other port, but still get the same error.

I faced the same problem then run with
jupyter notebook --port 9999

This work for me jupyter notebook stop 8888 or
jupyter notebook --ip=0.0.0.0 --port=8888
I found solution here

I know it sounds silly, but I've just run into this problem and restarted my OS, and the error was gone!

The error may not be cause by jupyter, but your system.
To clear this, you can try open a simple http server on port 8888 and see whether the failed message is the same.
You can try one of the following commands to start a http server:
python -m SimpleHTTPServer 8888 (Python2)
python -m http.server 8888 (Python3)

I once have met this. It is because your interpreter. The version interpreter of your current project is not suitable for your anaconda. You can change your interpreter and then connect jupyter. That may be helpful. (:D

The solution is simple in Ubuntu and WSL:
jupyter notebook --allow-root --port 9999

Related

How to list currently running servers that are listening to localhost ports in vscode

I am using VS Code for development. After running the server as usually using npm start command (which was set up to run nodemon and the main 'app' file) I closed the terminal.
I thought that when terminal is shut down nodemon get shut down along with the terminal. Evidently this is not so as when I attempt to run npm start in the new terminal it throws an error that the port I set up my server to listen to is already in use.
Is it possible to see what servers are running currently and which ports they are listening to?
If there is no such command to list the currently running servers is there any way to shut down the running servers on the local machine without shutting down the laptop I am working on?
By the way everything mentioned above is being done on local machine and no remote server is used. Thank you in advance.
If you are on a Linux box you can run this to get the PID of any process running on that port:
Linux:
netstat -tnlp | grep {{PORT}}
This will likely find multiple lines since the number of the {{PORT}} value might show up in a PID, IP address, etc., so look through the list to find what you're looking for. The PID and process name will show up on the far right column of the result.
Example for Linux:
# netstat -tnlp | grep 443
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 14384/nginx: master
The column on the right (14384/nginx: master) is the PID of that process, and the process name. Once you have the PID you could do a kill {{PID}} to kill that process.
The Mac version of netstat is different, and doesn't display the PID (at least not that I can tell), and I'm not sure if there's a way to do the same thing on a Windows box.

jupyter notebook not launching from the anaconda command prompt

(base) C:\Users\kpl16587.KPLC>d:
(base) D:>jupyter notebook
[I 13:47:49.286 NotebookApp] The port 8888 is already in use, trying another port.
[I 13:47:49.289 NotebookApp] The port 8889 is already in use, trying another port.
[I 13:47:49.291 NotebookApp] The port 8890 is already in use, trying another port.
I reinstalled Jupyter since i could not launch and now i get the above error.
Please assist.
Figured it out, by modifying C:\Users\username.jupyter\jupyter_notebook_config.py
line---#c.NotebookApp.browser = ''
to
---#c.NotebookApp.browser =u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
Now Jupyter notebook launching perfectly.

How do I stop Apache/Tomcat server on localhost://8080?

I keep getting errors when trying to serve files locally. I am using Tomcat on port 8080.
When using Eclipse, I get the following error message:
Several ports (8080, 8009) required by Tomcat v8.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
Question
How do I stop the server on port 8080 if I don't know which process started it?
Try to go with a web browser to:
localhost:8080 or 127.0.0.1:8080
and
localhost:8009 or 127.0.0.1:8009
There you could see which service is running on those ports.
Then it will be more simple to understand what you have to stop.
EDIT:
You could use a prompt and the command:
netstat -b
-b it will show the name of the executable running on a port.
For understanding how it works here a good explanation.

How can I change django server's port number in Eclipse?

I have developed a simple application in Eclipse & Django & Pydev. The application fails while starting and I am given the following error:
*Error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions*
I have tried changing the port number to 8080 in Eclipse by changing the Run Configurations, but this has failed.
How can solve this problem and host my Django application on other port?
If you are willing to do this outside of Eclipse, you can run the Django development server on a different port with
python manage.py runserver PORT_HERE
For example, to use port 8005, you can do
python manage.py runserver 8005

How to set nodejs debug mode don't listen 127.0.0.1

I want to remote debug the nodejs program in Eclipse. I start the node script with the debug option.
$node debug script.js
But I can't connect to the node in Eclispe. When I netstat the node's TCP port. I found that node only listen 127.0.0.1 in debug mode. So I can't connect it from different computer.
But I can't find any startup options that can change to listen to any address.
Anyone know to make it listen to any address to remote debug in other computer?
if anyone else stumble upon this: you can set the node debug to any address as you set the port
node --debug=169.168.1.2:5858 app.js
if that would be the ip of your remote machine or even better to every machine
node --debug=0.0.0.0:5858 app.js
but please be aware that the 2nd option should only be used if you are debugging in your own private network as you open it up for everyone
This is what I do in linux Debian:
install balancer
sudo apt-get install balance -y
then create a route in balancer to reroute your 5858 port to 5859
balance 5859 127.0.0.1:5858
start your app
node --debug app.js
now you can access it from everywhere on port 5859
I'm looking into V8 code that goes through deps/v8/src/debug-agent.* down to deps/v8/src/platform-posix.cpp (for linux) to POSIXSocket::Bind method and it can't seem to have any option about this (unless I'm missing something).
I bet you either hack it and recompile node or you'll need to build a small proxy beside your node process.
Here's a great tut on debugging nodejs from eclipse. Note at the bottom there is a script the author uses to forward localhost:5858 to the remote server's 127.0.0.1. You could also just use an SSH tunnel.
So, to summarize:
start your script with node --debug app.js
configure eclipse as if you were debugging locally
use the node_g script or configure an SSH tunnel
go on vacation now that your code is bug-free
to debug nodejs remotely over SSH session do:
1. install balance on Linux: https://balance.inlab.net/overview/
2. run the command: balance -df 8585 127.0.0.1:5858 > /tmp/balance.out 2>&1 &
3. ssh to your remote Linux box (tunnel will be created 8585 > 5858 > nodejs)
4. run your node script on server: node --debug-brk --nolazy ./myNodeApp.js
5. kick off debug session in WebStorm alt-d to port 8585
now you are remote debugging securely over SSH session