Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to work with remote IPython Notebook server? #10

Open
aldanor opened this issue Sep 26, 2013 · 27 comments
Open

Doesn't seem to work with remote IPython Notebook server? #10

aldanor opened this issue Sep 26, 2013 · 27 comments

Comments

@aldanor
Copy link

aldanor commented Sep 26, 2013

I wonder why doesn't it wanna work with a remote ipython notebook server? I have ipython notebook running on a remote unix machine and I'm forwarding port 7777 (and X11 stuff) through SSH. Works flawlessly in the browser -- just by connecting to 127.0.0.1:7777 from my local machine. However SublimeIPythonNotebook can't seem to be able to connect, any ideas why?

Cannot get a list of notebooks

@maximsch2
Copy link
Owner

I am using SSH port forwarding to connect to remote ipython server on port
8888 and it opens just fine in Sublime...
Do you see anything strange in the log when you are trying to connect?

Maxim Grechkin

On Thu, Sep 26, 2013 at 8:57 AM, Aldanor [email protected] wrote:

I wonder why doesn't it wanna work with a remote ipython notebook server?
I have ipython notebook running on a remote unix machine and I'm forwarding
port 7777 (and X11 stuff) through SSH. Works flawlessly in the browser --
just by connecting to 127.0.0.1:7777. However SublimeIPythonNotebook
can't seem to be able to connect, any ideas why?

Cannot get a list of notebooks


Reply to this email directly or view it on GitHubhttps://github.com//issues/10
.

@aldanor
Copy link
Author

aldanor commented Sep 26, 2013

I seem to be able to get JSON back in browser via http://127.0.0.1:7777/notebooks. However, I checked it out and apparently it's getting BadStatusLine('',) on this line:

req = urlopen("http://" + baseurl + "/notebooks")

@aldanor
Copy link
Author

aldanor commented Sep 26, 2013

Looks like it's fixable, the problem is that your implementation doesn't handle proxies.

So, in get_notebooks() function, you can do something like

proxy = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy)
req = opener.open('http://%s/notebooks/' % baseurl)

... which kinda seems to work :)

@aldanor
Copy link
Author

aldanor commented Sep 26, 2013

On a side note, may I suggest saving the previous entered value of host/port instead of offering 127.0.0.1:888 as default every time? -- if someone uses a custom host/port (like I do), they would have to type it in manually every single time...

@maximsch2
Copy link
Owner

I've added the code to save previous host/port value and proxy handling code. But I am still not sure if using proxy will work now, because it looks like websocket-client doesn't support proxy...
Please try version 0.1.3 (should appear in Package Control shortly)

@caoimhinp
Copy link

Can't connect to a server using the following:

https://myurl.me:11111

https://192.168.0.7:11111

192.168.0.7:11111

I do have it password protected.
I am not getting any errors. It just silently fails.

@maximsch2
Copy link
Owner

Are you using proxy server? I don't think that would be expected to work
now, websocket library doesn't support proxy as far as I can tell

Maxim Grechkin

On Wed, Feb 12, 2014 at 6:31 PM, caoimhinp [email protected] wrote:

Can't connect to a server using the following:

https://myurl.me:11111

https://192.168.0.7:11111

192.168.0.7:11111

I do have it password protected.
I am not getting any errors. It just silently fails.


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-34942600
.

@caoimhinp
Copy link

No. No proxy.
The myurl.me connection is port forwarded but the LAN ip is direct.

@maximsch2
Copy link
Owner

Can you try connecting to it without https?

Maxim Grechkin

On Wed, Feb 12, 2014 at 6:53 PM, caoimhinp [email protected] wrote:

No. No proxy.
The myurl.me connection is port forwarded but the LAN ip is direct.


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-34943678
.

@caoimhinp
Copy link

No joy.
Tried:

myurl.me:11111
192.168.0.7:11111

@maximsch2
Copy link
Owner

What about those:
http://myurl.me:11111
http://192.168.0.7:11111

Will you server accept http connections or you have set it up to work over
https?

Maxim Grechkin

On Wed, Feb 12, 2014 at 6:58 PM, caoimhinp [email protected] wrote:

No joy.
Tried:

myurl.me:11111
192.168.0.7:11111


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-34943854
.

@caoimhinp
Copy link

No, it won't accept http. I have it password protected and configured for https.
However, I tried them just for completeness. No change.

@maximsch2
Copy link
Owner

OK, then of course there was no reason to try them. You can try to see if
it will work with just http.

I am not sure if the plugin is even expected to work with HTTPS. I've never
tested it with HTTPS and do not use it myself. As a workaround, to provide
secure access to remote ipython notebooks, I run them bound to localhost on
the server and then do port forwarding through SSH tunnel.

Patches to support HTTPS (if it is indeed HTTPS issue) will be of course
welcome.

Maxim Grechkin

On Wed, Feb 12, 2014 at 7:02 PM, caoimhinp [email protected] wrote:

No, it won't accept http. I have it password protected and configured for
https.
However, I tried them just for completeness. No change.


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-34944066
.

@caoimhinp
Copy link

No worries. I just thought I'd post my issue to keep this issue alive.

I thought I'd try those strings simply because I don't know how you're handling them on the other side.

I noted that it supported passwords after seeing the z-m-k contrib acknowledgement. I assumed it supported https since using passwords in the clear is not such a useful function. ;)

... I just checked and it looks like you're forcing http in the url parsing. I'll see what I can do ...

@maximsch2
Copy link
Owner

Sounds great!

I think the main question will be the support for HTTPS in websocket-client
library (https://github.com/liris/websocket-client). It looks like they do
support SSL, so it might be relatively easy to add support for it in
SublimeIPythonNotebook

Maxim Grechkin

On Wed, Feb 12, 2014 at 7:17 PM, caoimhinp [email protected] wrote:

No worries. I just thought I'd post my issue to keep this issue alive.

I thought I'd try those strings simply because I don't know how you're
handling them on the other side.

I noted that it supported passwords after seeing the z-m-k contrib
acknowledgement. I assumed it supported https since using passwords in the
clear is not such a useful function. ;)

... I just checked and it looks like you're forcing http in the url
parsing. I'll see what I can do ...


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-34944724
.

@caoimhinp
Copy link

Thought I'd give it a quick look. Can't spend too much time on it tonight.

I thought I'd first try just changing the hard coded "http" to "https." I also checked for the "ws" used internal to websocket and that was also hard coded to "ws." So I changed that as well.

I added some debug prints and I get the following output in the console:

Trying url: https://192..168.0.7:11111/notebooks
response headers: Date: Thu, 13 Feb 2014 04:20:26 GMT
Content-Length: 2885
Etag: "e98dfb044d4e8f8f4e4387d8ae4d0dd24b6881ee"
Content-Type: text/html; charset=UTF-8
Server: TornadoServer/3.2
Set-Cookie: username-192.168.0.7-19420=; expires=Wed, 13 Feb 2013 04:20:26 GMT; Path=/
Error during loading notebook list from  https://192.168.0.7:11111/notebooks
No JSON object could be decoded
base url: 192.168.0.7:11111
Cannot get a list of notebooks

I'm pretty sure that's because it's not handling the password. I'll work on it more later.
If I can get it handling the password I'll also have to go back and options for "http" / "ws" and "https" / "wss."

@z-m-k
Copy link
Contributor

z-m-k commented Feb 13, 2014

It should work. That was resolved in #14. I tested it right now and it works fine. Maybe the port is blocked? If it makes a connection and sees a password prompt it will ask for the password. It silently fails only if it cannot establish a connection.

@z-m-k
Copy link
Contributor

z-m-k commented Feb 13, 2014

If you see hardcoded ws then you are not on the current branch. The line is:

        url = self.baseurl.replace('http', 'ws') + "/kernels/" + self.kernel_id + "/"

So if baseurl is https then it will end up being wss.

Are you on ST2? In this case you will have to take the relevant parts of #14 and implement it for Python 2. Support for ST2 was dropped shortly before that pull.

@caoimhinp
Copy link

Ports definitely not blocked. I get a response trying to set a cookie as shown above and it works in my browser.

I think it's because I'm on ST2. I just installed what was in Package Control.
I'll port over the relevant parts.

@caoimhinp
Copy link

z-m-k,

since you were just switching to python3 4 months ago why didn't you keep
the compatibility with python2 at least in your own fork?

2014-02-13 6:16 GMT-05:00 z-m-k [email protected]:

If you see hardcoded ws then you are not on the current branch. The line
is:

    url = self.baseurl.replace('http', 'ws') + "/kernels/" + self.kernel_id + "/"

Are you on ST2? In this case you will have to take the relevant parts of
#14 #14 and
implement it for Python 2. Support for ST2 was dropped shortly before that
pull.

Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-34969246
.

@caoimhinp
Copy link

I'd consider this closed based upon dropping support for python 2.

@z-m-k
Copy link
Contributor

z-m-k commented Feb 15, 2014

I just needed it to work and the support was dropped on the day I started implementing this, it is very much a hack even now. I do not think there is a lot you have to change to make it work in Python 2. The big difference is in imports (where you are getting HTTPCookieProcessor, CookieJar, etc.) and how things like urlencode/urlparse work AFAIR. So once you edit the imports so that it works with 2.7.x the code should be good as it is with only a few things needed to be debugged.

@caoimhinp
Copy link

Cool. Just trying to decide if I want to make the changes available or not.
I noticed that support didn't just stop but the code was refactored to drop
compatibility.

2014-02-15 3:27 GMT-05:00 z-m-k [email protected]:

I just needed it to work and the support was dropped on the day I started
implementing this, it is very much a hack even now. I do not think there is
a lot you have to change to make it work in Python 2. The big difference is
in imports (where you are getting HTTPCookieProcessor, CookieJar, etc.) and
how things like urlencode/urlparse work AFAIR. So once you edit the imports
so that it works with 2.7.x the code should be good as it is with only a
few things needed to be debugged.

Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-35150263
.

@maximsch2
Copy link
Owner

There is a ST2 branch, so if you would like, I would be happy to pull the changes there. That would make it easier for you to reinstall it later on straight from Package Control.

@caoimhinp
Copy link

But there's no further development or support, right? Is there a separate
repo for that?

2014-02-15 15:40 GMT-05:00 Maxim Grechkin [email protected]:

There is a ST2 branch, so if you would like, I would be happy to pull the
changes there. That would make it easier for you to reinstall it later on
straight from Package Control.

Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-35167118
.

@maximsch2
Copy link
Owner

There is a separate branch: https://github.com/maximsch2/SublimeIPythonNotebook/tree/st2 that is used by Package Control for installation of ST2 versions (it picks up latest commit from there). It should be relatively easy to backport some of the changes from master branch to ST2 branch, but I am not planning to do that myself, I am not using ST2.

@caoimhinp
Copy link

cool. Thanks. Understood.

2014-02-15 18:08 GMT-05:00 Maxim Grechkin [email protected]:

There is a separate branch:
https://github.com/maximsch2/SublimeIPythonNotebook/tree/st2 that is used
by Package Control for installation of ST2 versions (it picks up latest
commit from there). It should be relatively easy to backport some of the
changes from master branch to ST2 branch, but I am not planning to do that
myself, I am not using ST2.

Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-35170940
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants