ReviewNB / treon

Easy to use test framework for Jupyter Notebooks
https://reviewnb.com
MIT License
305 stars 29 forks source link

treon RuntimeError: Can only launch a kernel on a local interface #21

Closed GenevieveBuckley closed 4 years ago

GenevieveBuckley commented 4 years ago

When I run treon I get a RuntimeError telling me that it can only launch a kernel on a local interface.

The error message suggests to me that something is wrong with my configuration settings, but I had expected since I don't see this error when I run ipython or jupyter notebook then I also shouldn't see it when I run treon.

Details

I made a new (conda) virtual environment to install the treon master branch into, with pip install -r requirements-dev.txt and pip install -e .

Here's the output when I run treon on the example notebooks included with the repository:

(treon-dev) C:\Users\Genevieve\Documents\GitHub\treon>treon
Executing treon version 0.1.3
Recursively scanning C:\Users\Genevieve\Documents\GitHub\treon for notebooks...
Triggered test for C:\Users\Genevieve\Documents\GitHub\treon\tests\resources\basic.ipynb
Triggered test for C:\Users\Genevieve\Documents\GitHub\treon\tests\resources\doctest_failed.ipynb
Triggered test for C:\Users\Genevieve\Documents\GitHub\treon\tests\resources\runtime_error.ipynb
Triggered test for C:\Users\Genevieve\Documents\GitHub\treon\tests\resources\unittest_failed.ipynb
ERROR in testing C:\Users\Genevieve\Documents\GitHub\treon\tests\resources\runtime_error.ipynb

An error occurred while executing the following cell:
------------------
1 / 0
------------------

---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-1-bc757c3fda29> in <module>
----> 1 1 / 0

ZeroDivisionError: division by zero
ZeroDivisionError: division by zero

Traceback (most recent call last):
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\Scripts\treon-script.py", line 33, in <module>
    sys.exit(load_entry_point('treon', 'console_scripts', 'treon')())
  File "c:\users\genevieve\documents\github\treon\treon\treon.py", line 52, in main
    trigger_tasks(tasks, thread_count)
  File "c:\users\genevieve\documents\github\treon\treon\treon.py", line 71, in trigger_tasks
    pool.map(Task.run_tests, tasks)
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\multiprocessing\pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\multiprocessing\pool.py", line 657, in get
    raise self._value
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\multiprocessing\pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\multiprocessing\pool.py", line 44, in mapstar
    return list(map(*args))
  File "c:\users\genevieve\documents\github\treon\treon\task.py", line 25, in run_tests
    self.is_successful, console_output = execute_notebook(self.file_path)
  File "c:\users\genevieve\documents\github\treon\treon\test_execution.py", line 13, in execute_notebook
    processor.preprocess(notebook, metadata(path))
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbconvert\preprocessors\execute.py", line 79, in preprocess
    self.execute()
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbclient\util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbclient\util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\asyncio\base_events.py", line 587, in run_until_complete
    return future.result()
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbclient\client.py", line 519, in async_execute
    async with self.async_setup_kernel(**kwargs):
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\async_generator\_util.py", line 34, in __aenter__
    return await self._agen.asend(None)
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbclient\client.py", line 477, in async_setup_kernel
    await self.async_start_new_kernel(**kwargs)
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbclient\client.py", line 389, in async_start_new_kernel
    await ensure_async(self.km.start_kernel(extra_arguments=self.extra_arguments, **kwargs))
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\nbclient\util.py", line 85, in ensure_async
    result = await obj
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\jupyter_client\manager.py", line 571, in start_kernel
    kernel_cmd, kw = self.pre_start_kernel(**kw)
  File "C:\Users\Genevieve\anaconda3\envs\treon-dev\lib\site-packages\jupyter_client\manager.py", line 252, in pre_start_kernel
    "Currently valid addresses are: %s" % (self.ip, local_ips())
RuntimeError: Can only launch a kernel on a local interface. This one is not: 127.0.0.1.Make sure that the '*_address' attributes are configured properly. Currently valid addresses are: ['49.127.90.25', '172.28.70.145', '192.168.56.1', '192.168.1.103', '192.168.137.1', '172.22.0.1', '0.0.0.0', '']

(treon-dev) C:\Users\Genevieve\Documents\GitHub\treon>

Things I've tried:

GenevieveBuckley commented 4 years ago

Here's what's in the new virtual environment:


# Name                    Version                   Build  Channel
argon2-cffi               20.1.0                   pypi_0    pypi
astroid                   2.4.2                    pypi_0    pypi
async-generator           1.10                     pypi_0    pypi
atomicwrites              1.4.0                    pypi_0    pypi
attrs                     20.2.0                   pypi_0    pypi
backcall                  0.2.0                    pypi_0    pypi
bleach                    3.2.1                    pypi_0    pypi
ca-certificates           2020.7.22                     0
certifi                   2020.6.20                py37_0
cffi                      1.14.3                   pypi_0    pypi
colorama                  0.4.3                    pypi_0    pypi
decorator                 4.4.2                    pypi_0    pypi
defusedxml                0.6.0                    pypi_0    pypi
docopt                    0.6.2                    pypi_0    pypi
entrypoints               0.3                      pypi_0    pypi
importlib-metadata        2.0.0                    pypi_0    pypi
iniconfig                 1.0.1                    pypi_0    pypi
ipykernel                 5.3.4                    pypi_0    pypi
ipython                   7.18.1                   pypi_0    pypi
ipython-genutils          0.2.0                    pypi_0    pypi
ipywidgets                7.5.1                    pypi_0    pypi
isort                     5.5.4                    pypi_0    pypi
jedi                      0.17.2                   pypi_0    pypi
jinja2                    2.11.2                   pypi_0    pypi
jsonschema                3.2.0                    pypi_0    pypi
jupyter                   1.0.0                    pypi_0    pypi
jupyter-client            6.1.7                    pypi_0    pypi
jupyter-console           6.2.0                    pypi_0    pypi
jupyter-core              4.6.3                    pypi_0    pypi
jupyterlab-pygments       0.1.2                    pypi_0    pypi
lazy-object-proxy         1.4.3                    pypi_0    pypi
markupsafe                1.1.1                    pypi_0    pypi
mccabe                    0.6.1                    pypi_0    pypi
mistune                   0.8.4                    pypi_0    pypi
nbclient                  0.5.0                    pypi_0    pypi
nbconvert                 6.0.7                    pypi_0    pypi
nbformat                  5.0.7                    pypi_0    pypi
nest-asyncio              1.4.1                    pypi_0    pypi
notebook                  6.1.4                    pypi_0    pypi
openssl                   1.1.1h               he774522_0
packaging                 20.4                     pypi_0    pypi
pandocfilters             1.4.2                    pypi_0    pypi
parso                     0.7.1                    pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pip                       20.2.3                   py37_0
pluggy                    0.13.1                   pypi_0    pypi
prometheus-client         0.8.0                    pypi_0    pypi
prompt-toolkit            3.0.7                    pypi_0    pypi
py                        1.9.0                    pypi_0    pypi
pycparser                 2.20                     pypi_0    pypi
pygments                  2.7.1                    pypi_0    pypi
pylint                    2.6.0                    pypi_0    pypi
pyparsing                 2.4.7                    pypi_0    pypi
pyrsistent                0.17.3                   pypi_0    pypi
pytest                    6.1.1                    pypi_0    pypi
python                    3.7.9                h60c2a47_0
python-dateutil           2.8.1                    pypi_0    pypi
pywin32                   228                      pypi_0    pypi
pywinpty                  0.5.7                    pypi_0    pypi
pyzmq                     19.0.2                   pypi_0    pypi
qtconsole                 4.7.7                    pypi_0    pypi
qtpy                      1.9.0                    pypi_0    pypi
send2trash                1.5.0                    pypi_0    pypi
setuptools                49.6.0                   py37_1
six                       1.15.0                   pypi_0    pypi
sqlite                    3.33.0               h2a8f88b_0
terminado                 0.9.1                    pypi_0    pypi
testpath                  0.4.4                    pypi_0    pypi
toml                      0.10.1                   pypi_0    pypi
tornado                   6.0.4                    pypi_0    pypi
traitlets                 5.0.4                    pypi_0    pypi
treon                     0.1.3                     dev_0    <develop>
typed-ast                 1.4.1                    pypi_0    pypi
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_3
wcwidth                   0.2.5                    pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
wheel                     0.35.1                     py_0
widgetsnbextension        3.5.1                    pypi_0    pypi
wincertstore              0.2                      py37_0
wrapt                     1.12.1                   pypi_0    pypi
zipp                      3.3.0                    pypi_0    pypi
zlib                      1.2.11               h62dcd97_4
amit1rrr commented 4 years ago

@GenevieveBuckley This is an open issue while using jupyter_client in multithreaded fashion on Windows machine. You can track updates here: https://github.com/jupyter/jupyter_client/issues/466

You have two workaround for now,

GenevieveBuckley commented 4 years ago

Thank you @amit1rrr that's really helpful to know.

amit1rrr commented 4 years ago

@GenevieveBuckley Just wondering if you could help us resolve the issue? Folks in jupyter_client have suggested a possible fix but I don't have a windows machine to reproduce this issue. I've listed down the steps here, you basically need to change one line of code in jupyter_client and see if that fixes this.

GenevieveBuckley commented 4 years ago

Thanks @amit1rrr , I've taken your suggestions and https://github.com/jupyter/jupyter_client/pull/584 should do the trick. Thank you for your help with this!