Skip to content
New issue

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

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

Already on GitHub? # to your account

could not register token: [Errno 111] Connection refused #6

Open
rceballos98 opened this issue Jul 14, 2017 · 5 comments
Open

could not register token: [Errno 111] Connection refused #6

rceballos98 opened this issue Jul 14, 2017 · 5 comments

Comments

@rceballos98
Copy link

Running the example on a local anaconda version of jupyter I get this error:
could not register token: [Errno 111] Connection refused

Running this from a jupyter notebook with sudo:
sudo jupyter notebook --allow-root

Fixes the issue, but this only works if you have jupyter installed on root (which is not a reasonable solution for servers, etc).

*Crossposted on neuroglancer repo

@funkey
Copy link
Owner

funkey commented Jul 17, 2017

Can you provide some more information? Do you have steps to reproduce? Where is jupyter running, and what did you set_hostname to?

@rceballos98
Copy link
Author

rceballos98 commented Jul 18, 2017

Sorry for the slow response, here it is:

So the jupyter path is this:

which jupyter
jupyter is /home/rodrigo/anaconda2/envs/NT/bin/jupyter

The code I'm running is this:

import nyroglancer
import h5py
dir_path = '/home/rodrigo/workspace/repos/test/test_output/3/'
batch_name = 'batch_00000001.hdf'
inputfilename = dir_path + batch_name

raw = h5py.File(inputfilename,'r')['volumes/raw']
seg = h5py.File(inputfilename,'r')['volumes/labels/neuron_ids']

viewer = nyroglancer.Viewer()
viewer.add(raw, name="raw")
viewer.add(seg, name="neuron IDs")
viewer.show()

and the error traceback is this:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-6-4dc8c180cc74> in <module>()
      9 viewer.add(raw, name="raw")
     10 viewer.add(seg, name="neuron IDs")
---> 11 viewer.show()

/home/rodrigo/anaconda2/envs/NT/lib/python2.7/site-packages/nyroglancer-1.0.2-py2.7.egg/nyroglancer/viewer.pyc in show(self)
     39         """
     40 
---> 41         viewer_url = self.get_server_url() + '/neuroglancer' + '#!' + self.get_encoded_state()
     42         large_html = "<style>.container { width:100% !important; }</style>" if self.large else ""
     43 

/home/rodrigo/anaconda2/envs/NT/lib/python2.7/site-packages/neuroglancer/base_viewer.pyc in get_encoded_state(self)
    103     def get_encoded_state(self):
    104         return urlquote(
--> 105             json.dumps(self.get_json_state(), separators=(',', ':')),
    106             '~@#$&()*!+=:;,.?/\'')

/home/rodrigo/anaconda2/envs/NT/lib/python2.7/site-packages/neuroglancer/base_viewer.pyc in get_json_state(self)
     74         specified_names = set(layer.name for layer in self.layers)
     75         for layer in self.layers:
---> 76             self.register_volume(layer.volume)
     77             name = layer.name
     78             if name is None:

/home/rodrigo/anaconda2/envs/NT/lib/python2.7/site-packages/nyroglancer-1.0.2-py2.7.egg/nyroglancer/viewer.pyc in register_volume(self, volume)
     56             response = http_client.fetch(self.get_server_url() + '/register_token/' + volume.token.decode('utf8') + '/' + cf)
     57         except Exception as e:
---> 58             raise RuntimeError("could not register token: " + str(e))
     59         http_client.close()
     60 

RuntimeError: could not register token: [Errno 111] Connection refused

I can only replicate this error when working on a remote server over ssh.
I am running this code to pipe the output of the jupyter notebook to my local machine for rendering:

server => jupyter notebook --no-browser --port:8889
mylocalmachine => ssh -N -f -L localhost:8888:localhost:8889 username@servername

As mentioned here.

Finally, I am not using set_hostname anywhere. Is there a link to documentation on what I should be setting it to that I just can't find?

@abailoni
Copy link

abailoni commented Aug 2, 2017

I had the same problem and exactly the same setting. Jupyter is installed on a conda environment (not on root). Everything works if I use the default port (8888), but if I change it and run jupyter notebook --port:8889 then I get the same error when I execute the example code.

I also needed to access the iPython notebook from a local machine and the only settings that worked is to pipe the output on the port 8888:

mylocalmachine => ssh -N -f -L localhost:8888:localhost:8888 username@servername

If I choose a different port on the local machine, when I run the code the Neuroglancer viewer is not displayed.

@nilsec
Copy link

nilsec commented Nov 7, 2017

I was able to solve that issue by specifying e.g.
viewer.set_hostname('localhost:8880')

together with:
mylocalmachine => ssh -N -f -L localhost:8880:localhost:8880 username@servername

@thoth291
Copy link

This is Fantastic package! Thank you for your work!!

I'm trying to start it from my JupyterHub instance and getting similar issues. My effective Jupyter Notebook is spawn at another host (different from JupyterHub) and then I connect to it from one another host (different from JupyterHub or Jupyter Notebook server) and can't get the viewer.show() work for me.

set_hostname returns with timeout, while not using it returns with

/lib/python2.7/site-packages/nyroglancer/viewer.pyc in register_volume(self, volume)
     56             response = http_client.fetch(self.get_server_url() + '/register_token/' + volume.token.decode('utf8') + '/' + cf)
     57         except Exception as e:
---> 58             raise RuntimeError("could not register token: " + str(e))
     59         http_client.close()
     60 
RuntimeError: could not register token: [Errno 111] Connection refused

Please suggest what to do.

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

No branches or pull requests

5 participants