Kernel fails to start
I am trying to use the stata kernel under linux after using it under windows for some time and loved it! Unfortunately, the kernal fails to start. When opening a notebook or console, jupyter tries to start the kernel but fails to do so with the stack trace below. Afterwards, jupyter tries to restart the kernel but fails and is stuck in the loop forever (it's always restart attempt 1/5). I did the following checks to eliminate error sources:
- other notebooks (such as python itself) work
- the cache dir is accessible. In fact, during every try, the .stata_kernel_cache/console_debug.log file is written with the start STATA opening lines (see below)
- the stata path is set correctly in the .stata_kernel.conf file
- I can run stata in batch mode correctly, e.g. "/path/to/stata -b test.do"
I am running the following system:
- Operating System: Ubuntu 18.04.4 LTS under WSL (fully inside WSL/Linux, nothing to do with Windows)
- Stata version 13.1
- Package version 1.11.2
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/fheidemann/.local/lib/python3.6/site-packages/stata_kernel/__main__.py", line 4, in <module>
IPKernelApp.launch_instance(kernel_class=StataKernel)
File "/home/fheidemann/.local/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance
app.initialize(argv)
File "<decorator-gen-124>", line 2, in initialize
File "/home/fheidemann/.local/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/fheidemann/.local/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 562, in initialize
self.init_kernel()
File "/home/fheidemann/.local/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 447, in init_kernel
user_ns=self.user_ns,
File "/home/fheidemann/.local/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/home/fheidemann/.local/lib/python3.6/site-packages/stata_kernel/kernel.py", line 71, in __init__
self.stata = StataSession(self)
File "/home/fheidemann/.local/lib/python3.6/site-packages/stata_kernel/stata_session.py", line 94, in __init__
self.init_console()
File "/home/fheidemann/.local/lib/python3.6/site-packages/stata_kernel/stata_session.py", line 199, in init_console
self.child.expect(self.prompt)
File "/home/fheidemann/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 344, in expect
timeout, searchwindowsize, async_)
File "/home/fheidemann/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 372, in expect_list
return exp.expect_loop(timeout)
File "/home/fheidemann/.local/lib/python3.6/site-packages/pexpect/expect.py", line 181, in expect_loop
return self.timeout(e)
File "/home/fheidemann/.local/lib/python3.6/site-packages/pexpect/expect.py", line 144, in timeout
raise exc
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7fe5c81a84a8>
command: /usr/local/stata13/stata
args: [b'/usr/local/stata13/stata']
buffer (last 100 chars): '--\x08\x08\x08\x08\x08\x08\x08\x08 \x08\x08\x08\x08\x08\x08\x08\x08. '
before (last 100 chars): '--\x08\x08\x08\x08\x08\x08\x08\x08 \x08\x08\x08\x08\x08\x08\x08\x08. '
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 870
child_fd: 49
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: <_io.TextIOWrapper name='/home/fheidemann/.stata_kernel_cache/console_debug.log' mode='w' encoding='utf-8'>
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: None
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile('\\r\\n\\. ')
___ ____ ____ ____ ____ (R)
/__ / ____/ / ____/
___/ / /___/ / /___/ 13.1 Copyright 1985-2013 StataCorp LP
Statistics/Data Analysis StataCorp
4905 Lakeway Drive
College Station, Texas 77845 USA
800-STATA-PC http://www.stata.com
979-696-4600 [email protected]
979-696-4601 (fax)
Single-user Stata perpetual license:
Serial number: XXXXX
Licensed to: XXXXX
XXXXX
Notes:
1. Command line editing enabled
Note: Your site can add messages to the introduction by editing the file
stata.msg in the directory where Stata is installed.
Can you try
pip uninstall stata_kernel
pip install stata_kernel==1.10.5
python -m stata_kernel.install
I might have had a breaking change in 1.11.0
Indeed, it works like a charm on 1.10.5. So I guess there is a breaking change in 1.11.0. If interested, I am willing to help debugging. In this case, just reach out.
@mcaceresb I think I might just publish a new release with the same code as 1.10.5. I don't really have the ability to debug things when I don't have Stata. Thoughts?
Sure. I don't have this issue, but they's using OSX and Windows. Was anything other than #328 added in 1.11.0?
Oh right, it would be pretty stupid/mean to revert to 1.10.5 after accepting that PR.
I added quite a few commits after 1.10.5, and even apparently made a Git tag for 1.10.6 but I think I never pushed that to PyPI. Here's the 1.10.5 commit; I'm not sure the easiest way to see all commits since then https://github.com/kylebarron/stata_kernel/commit/55adab0ea22708288bee97ab6ea0f19d23cb0b3e
It would be mean if we didn't tell that person! But with notice I don't think it'd be mean bc apparently people are having install issues bc of it.
Also, a new release wouldn't delete the old version, right?