在Paperspace启动Jupyter Notebook遇故障:令牌无效+localhost无法访问
Hey there, let's work through this annoying issue step by step—you've got this! Here's how to tackle the invalid token error and the unreachable localhost:8888 page:
1. Confirm Your Paperspace VM is Running & Port Forwarding is Active
- Head over to your Paperspace web dashboard first. Make sure your virtual machine is marked as "Running"—sometimes unexpected logouts can cause instances to stop silently. If it's stopped, start it up and give it 2-3 minutes to fully boot all services.
- Check the port forwarding settings for your VM. Paperspace needs to forward port 8888 from the VM to your local machine. In the VM's web console, verify that the port 8888 forwarding rule is enabled and hasn't dropped.
2. Regenerate a Fresh Jupyter Token (Fix the Invalid Credentials Error)
The token you're using is probably expired or mismatched. Let's grab a new one:
- Open your Paperspace VM's terminal (either via the web console or SSH if you have that set up).
- Run this command to list running Jupyter instances and their tokens:
jupyter notebook list - If no instances show up, start Jupyter manually with:
jupyter notebook --no-browser - Copy the long alphanumeric token from the output. This is your valid, fresh token.
- Go back to
localhost:8888and paste this new token when prompted—this should fix the "invalid credentials" error you saw in the screenshot.
3. Fix the "Page Not Found" for localhost:8888
If the page still won't load after getting a valid token:
- Check for local port conflicts: Another app might be using port 8888. Run these commands to check:
- On macOS/Linux:
lsof -i :8888 - On Windows:
netstat -ano | findstr :8888
If you see a process using the port, kill it or start Jupyter on a different port withjupyter notebook --port 8889, then accesslocalhost:8889instead.
- On macOS/Linux:
- Disable your local firewall or VPN temporarily—sometimes these block the port forwarding connection. Try accessing the URL again after disabling them.
- Do a full reboot of your Paperspace VM from the web dashboard. Stuck services or port forwarding rules often get fixed with a complete restart.
4. Clear Residual Local Jupyter Processes
Even if you closed your local Jupyter, leftover processes might be causing conflicts. Run this command to stop any lingering Jupyter instances on port 8888:
jupyter notebook stop 8888
Quick note: The screenshot you shared shows an "Invalid credentials" prompt when entering the token, which lines up perfectly with the expired/mismatched token issue. Fixing that first should get you past the login screen, and then we can iron out the port access if needed.
内容的提问来源于stack exchange,提问作者UWGOOSE

