0

I have a working Jupyter server running on an EMR master node where I can run python and pyspark code with no issue. When trying to get the VS Code Python extension to connect to the very same Jupyter server, I get the following error:

Failed to connect to remote Jupyter notebook. 
Check that the Jupyter Server URI setting has a valid running server specified. 
http://***.***.***.***:8888/lab 
Error: Invalid response: 405 Method Not Allowed

I created my own self-signed certificate on the EMR cluster by following these instructions from IBM. Then added the certificate to Chrome following these stack overflow instructions another user linked to on GitHub.

From the bash terminal of the EMR master node:

# create key and cert
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
# combine key and cert
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12

Downloaded certificate.p12 to my local computer, and then adding to Chrome: chrome://settings/privacy > Manage certificates > Import > Select and import certificate.p12 > Restarting VS Code.

I still get the same error.

  • Should I create either the key.pem and certificate.pem on my local then combine into a certificate?
  • Do I need to use the original .pem key issued when creating the EMR cluster?
Clay
  • 2,584
  • 1
  • 28
  • 63

1 Answers1

0

The newer versions of Jupyter start what appears to be something like the Terminal based lynx browser.

No matter which Terminal shell I choose, the output is extremely chaotic after I launch Jupyter, in that the 'document' that the terminal "browser" is viewing is intermixed with the output of the Jupyter server.

Through all of that noise, I can use some combination of the arrow keys and enter to somehow 'navigate' to a point where the following is displayed somewhere in the terminal intermixed with the Jupyter output (usually highlighted, but depends on which Terminal program):

cookie: username-***-***-***-***-****=2|1:0|10:***********|27:username-***-***-***-***-****|44:***********************************k1ZmE=|****************************1bef31e Allow? (Y/N/Always/neVer)

I type A and press enter.

Sometimes, and sometimes not, I will see the following in the Terminal for a short time:

Data transfer complete  

Then I can press q and get out of whatever terminal browser thing Jupyter launched and just see the normal Jupyter server output. Copy the full url to the Jupyter server, paste it into VS Code Python extension python.dataScience.jupyterServerURI.

Everything works as expected after that.
No certificates or keys needed.

Clay
  • 2,584
  • 1
  • 28
  • 63