I'm trying to connect to a remote jupyter notebook.
Server-side actions:
I simply use jupyter notebook command that produces the following output:
http://localhost:8888/?token=c7a760ee5387de7d6a1cb797a0685a116621f8b3b5a1a5ba
I know that there's password authentication procedure as well. I set up the jupyter_notebook_config.py file. I changed the c.NotebookApp.password and c.NotebookApp.open_browser variables.
Client-side actions:
Since I'm using Putty I can copy/paste the HTTP address (with token) to a local browser. I get the following page:
Even though I'm using the token from the link (step 1) and password (step 2) I get the Invalid Credentials error.
There's a proxy server between the local machine and the server but I don't know how to account for that fact.
Update 11.10.2019
I decided to tweak some parameters in .jupyter/jupyter_notebook_config.py file. By sacrificing security I did away with token authentication by setting c.NotebookApp.token=''. I still get the Invalid credentials message.
jupyter_notebook_config.py which resides in .jupyter directory (in the home directory of the user) is created with jupyter notebook --generate-config. All of the options are commented out. You need to find c.NotebookApp.ip variable that must not be commented out and set its value to the IP of the server the Jupyter is running on. If you want to connect to that instance of Jupyter from another machine you need to find localhost:port webpage with a browser of your choosing. My answer assumes that you've forwarded the port you are using.
Related
We have recently moved to a JupyterLab Server from another IDE. We are trying to get VS Code hooked up so that we can code in it rather. After much struggle, we got VS Code to connect to our remote JupyterLab server. On the status bar in the bottom, it shows
However, as soon as we connect to the JupyerLab server, all the 'run' buttons on screen disappears.
We are getting no support from our IT and have to figure it out ourselves.
A colleague suspects that it (VS Code) is not picking up the python kernel from the server. How do we go about selecting it? or pointing to it?
An additional question, how do we see and browse the folders on the JupyterLab server in VS Code?
Appreciate any assistance
I think the problem is that you didn't really connect to the remote server.
Install Remote-SSH extension. Then you can see the button on the bottom left. Click and you can connect to your service and view your folder.
You can read document about Remote-SSH for more details/
Connect to a remote Jupyter server.
According to the document about jupyter, you have to do the following steps:
Open the Kernel Picker button on the top right-hand side of the notebook (or run the Notebook: Select Notebook Kernel command from the Command Palette).
Select the Existing Jupyter Server option to connect to an existing Jupyter server.
To connect to an existing server for the first time, select Enter the URL of the running Jupyter server.
When prompted to Enter the URL of the running Jupyter server, provide the server's URI (hostname) with the authentication token included with a ?token= URL parameter. (If you start the server in the VS Code terminal with an authentication token enabled, the URL with the token typically appears in the terminal output from where you can copy it.) Alternatively, you can specify a username and password after providing the URI.
Hello I coded this website that generates math problems (Here is the code: Here)
It is coded on flask and it is locally being hosted on this link that is not accessible to other people http://127.0.0.1:5000/ .I have a google domain and I want to have a website. What things / services do I need to use. I have been wait to see if I need to use AWS but I think I might need to. I have tried things like transferring it off of flask but I can't. If this is a repost sorry please post there answer thanks -Ben
I am assuming what you're asking is to host your flask web site so others can view it. The address you mention in your post is the local host address for your computer and is only accessible from your own computer. If you only want someone on your same network (WiFi) to access it, you would need to replace "127.0.0.1" with the IP address of your computer. You would also likely have to open up a firewall on your computer to allow the port 5000.
However, if you want anyone on the internet to access your site, there are a ton of ways to do this but since you mentioned AWS, you can do this easily by running a small EC2 instance (virtual server). If you have a new AWS account and have not already run any EC2 in that account, you can actually run a small EC2 instance for free for a whole year. Great for small projects. If you're just getting started with EC2, you may want to go here https://aws.amazon.com/ec2/getting-started/
Basic steps:
Spin up an EC2 instance. Choose the default Amazon Linxu 2 OS type, make sure to create/assign a key pair so you can later ssh into it, make sure the Allow SSH from anywhere setting is checked/selected and the Allow HTTP checkbox is checked (not HTTPS).
Wait for the instance to launch.
Log into your instance by clicking on your ec2 instance in the list of ec2 instnaces and click the Connect button, click the Connect button again (Instance connect tab). If that doesn't work, follow the steps on the SSH client tab.
Install flask
pip3 install flask
Clone your git repo
git clone https://github.com/some0ne14/Math-Ibex.git
Change to your repos' folder
cd Math-Ibex/Math-Practice-Website-master
Edit your main.py so that the app.run line looks like the following (you can do this on GitHub before you run git clone actually or use the nano command to edit the file easily). This allows the system to run on the standard web port 80.
app.run(host='0.0.0.0', port=80, debug=True)
Run the following to start the application. If you want to run it as a service so you can walk away or close the terminal and it will still stay running, just search on here how to run flask as a service.
python3 main.py
You can now connect to your server with any web browser using your EC2 instance's public IP address or generated AWS DNS name (available on the EC2 instnace property page).
Make sure to stop your instance when not using it to save those free runtime minutes.
I'm writing a server extension for jupyter lab and i can use ServerConnection.makeRequest() from #jupyterlab/services to send POST or GET to my custom URL in typescript.
Now i want to make some request from notebook to this URL by using library requests of python but i always get 403 error.
Is there any equivalent of ServerConnection.makeRequest() in jupyter lab python library to send request to server ?
Your request from within a notebook is most likely forbidden due to the xsrf check by the jupyter server. When you start jupyter server pass the parameter --NotebookApp.disable_check_xsrf=True in the command line to disable it. Or you need to handle passing the xsrf token. Note that disabling this check in an external-facing (production) system is not recommended.
You may also have to pass or suppress token. The token can be suppressed by passing --NotebookApp.token='' when you start the server.
Working with Professional edition of PyCharm, I'm trying to configure a server for remote deployment of my project over SFTP with OpenSSH + authentication agent as auth type. I have tried to configure PyCharm in Settings > Build, Execution and Deployment > Add server. However, even though I setup and verify successful configuration by Test SFTP connection button, as soon as I click Apply or OK, the User name becomes blank for some reason. Thereafter, when I try to sync with the remote server, the connection fails.
I've found a possible workaround by changing Host name to user#host form instead, which works, but then I can't use the same server configuration when I try to setup a remote interpreter under Project > Project Interpreter > Add SSH interpreter. (there it shows my host url as ssh://null#host). I'm guessing the null is there because PyCharm is somehow not saving the username. I've tried to edit the .idea/webServers.xml file, but couldn't find appropriate key-value pair to change there for user name to be preserved.
I solved it by changing the standard way to change credentials in Pycharm.
To do this go to Settings/Preferences | Appearance & Behavior | System Settings | Passwords and choose the KeePass option.
That solved the problem for me.
Apparently there are problems storing on native keychain. (I'm on Mint 18.3)
What worked for me was first going to the following tab:
Preferences -> Build, Execution, Deployment -> Deployment [Connection Tab]
and then inserting my in the "User name" blank.
Note: your user name appears in the ip address of you ec2. e.g. username##xxx.amazonaws.com
I've been following this guide:
https://developers.google.com/drive/v3/web/quickstart/python
and did everything up to the
python quickstart.py
part. When I do that it opens up a new browser (oddly not my default browser but whatever) and I get the OAuth screen, but once I click "Allow" it gives me a "localhost didn't send any data" error. The shell has:
/Library/Python/2.7/site-packages/oauth2client/_helpers.py:255:
UserWarning: Cannot access /Users/timothy.tran/.credentials/drive-
python-quickstart.json: No such file or directory
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
0:297: execution error:
What does this mean and how can I fix it?
It means it cannot access this file:
Cannot access /Users/timothy.tran/.credentials/drive-
python-quickstart.json
because:
No such file or directory
I just got this quickstart running a while ago. When you click the oauth link generated by python commandline and it opens a random browser, copy that link and paste it in the browser where your gmail account (which you're also using in your google dev console) is currently logged-in. Let me know if you're still stuck after this.
Also I don't think you need a localhost to run this. If anything, I'd used a python virtual environment.