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

Ipython and Jupyter aren't working #551

Closed
regr4 opened this issue Sep 1, 2020 · 11 comments
Closed

Ipython and Jupyter aren't working #551

regr4 opened this issue Sep 1, 2020 · 11 comments

Comments

@regr4
Copy link

regr4 commented Sep 1, 2020

Hi, I was trying to get Coconut to work with jupyter and ipython, but when I try to run anything, I get the following error message:

----------------------------------------------------------
TypeError                Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/IPython/core/async_helpers.py in _pseudo_sync_runner(coro)
 66     """
 67     try:
---> 68         coro.send(None)
 69     except StopIteration as exc:
 70         return exc.value

/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/coroutines.py in coro(*args, **kw)
122         @functools.wraps(func)
123         def coro(*args, **kw):
--> 124             res = func(*args, **kw)
125             if (base_futures.isfuture(res) or inspect.isgenerator(res) or
126                     isinstance(res, CoroWrapper)):

TypeError: run_cell_async() got an unexpected keyword argument 'transformed_cell'

This happens in Jupyter notebooks, in Jupyterlab and in the ipython repl.

What I've tried so far:

  • removing and reinstalling the coconut kernels
  • uninstalling coconut and installing coconut-develop
  • searching through the github issues for the same problem.

my OS is macOS Catalina, 10.15.6. I have python 3.8 installed via homebrew.

Is this something that has happened to more people? Is there a fix already or is this a new bug?

Thanks for coconut though, it's a really cool language (and much less scary than something like Haskell (-; )

@evhub
Copy link
Owner

evhub commented Sep 1, 2020

@regr4 This looks like an IPython error to me, not a Coconut error. I would first try updating your IPython/Jupyter via pip install --upgrade jupyter ipython ipykernel, then if that doesn't work try raising an IPython issue rather than a Coconut issue. Also, it would be useful if you could give me (and put in any IPython issue you raise) the results that you get when you run jupyter --version.

@regr4
Copy link
Author

regr4 commented Sep 1, 2020

I've upgraded some jupyter stuff, but it doesn't seem to have helped. I'll raise an issue on the ipython github page later.

jupyter --version outputs this:
jupyter core : 4.6.3
jupyter-notebook : 6.1.3
qtconsole : 4.7.6
ipython : 7.18.1
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 2.2.6
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.7
traitlets : 5.0.0

@xxdavid
Copy link

xxdavid commented Oct 7, 2020

Hey, I had the same problem as you do (and also macOS Catalina, Python 3.8 from brew). For me, the issue was resolved by downgrading coconut to 1.4.0 (with pip install --force-reinstall coconut==1.4.0). I tried all the newer versions too (1.4.1, 1.4.2 and 1.4.3) but it seems it's broken since 1.4.1.

For record:

$ jupyter --version
jupyter core     : 4.6.3
jupyter-notebook : 6.1.4
qtconsole        : 4.7.7
ipython          : 7.18.1
ipykernel        : 5.3.4
jupyter client   : 6.1.7
jupyter lab      : 2.2.8
nbconvert        : 6.0.7
ipywidgets       : 7.5.1
nbformat         : 5.0.7
traitlets        : 5.0.4

Thank you for making coconut! Tell me if there's anything I can do to fix this bug in newer versions.

@evhub evhub added this to the v1.5.0 milestone Oct 7, 2020
@evhub
Copy link
Owner

evhub commented Oct 7, 2020

@xxdavid @regr4 I can't seem to replicate this error myself. Would either of you be able to provide more detailed instructions on how exactly you produced this error? What commands did you run, what was in your notebook/cell when you ran it, etc. Also, if you could check if this error still appears when you pip uninstall coconut and pip install -U coconut-develop, that would be greatly appreciated.

@regr4
Copy link
Author

regr4 commented Oct 7, 2020

I have run pip3 install -U coconut-develop. Still, when I ran jupyter console --kernel=coconut and entered print("a"), the error is the same as above.
Also, if I run jupyter lab and open a coconut console, I also got the error.

@xxdavid
Copy link

xxdavid commented Oct 14, 2020

The same for me. I have run pip uninstall coconut && pip install -U --user coconut-develop and when I run jupyter console --kernel=coconut and enter anything (eg. just 1) I get the error message mentioned in the first post. When I run jupyter lab and open console in Jupyter Lab with coconut kernel, I get the same error, if I open a notebook in coconut and run any cell there, I get the same error again.

@ruivieira
Copy link

I can confirm that this happens with coconut 1.43 on macOS 10.15.6 and Jupyter Lab 2.2.8 (IPython.sys_info() at the bottom) and that @xxdavid work-around also works (downgrading to coconut 1.4.0).

IPython.sys_info():

"{'commit_hash': '95d2b79a2',
   'commit_source': 'installation',
   'default_encoding': 'utf-8',
   'ipython_path': '/Users/ruivieira/Library/Caches/pypoetry/virtualenvs/python-experiments-book-gQP3g2TK-py3.8/lib/python3.8/site-packages/IPython',
   'ipython_version': '7.18.1',
   'os_name': 'posix',
   'platform': 'macOS-10.15.6-x86_64-i386-64bit',
   'sys_executable': '/Users/ruivieira/Library/Caches/pypoetry/virtualenvs/python-experiments-book-gQP3g2TK-py3.8/bin/python',
   'sys_platform': 'darwin',
   'sys_version': '3.8.5 (default, Oct  8 2020, 11:52:34) [Clang 10.0.1 ]'
}"

@bj0
Copy link

bj0 commented Oct 27, 2020

I just installed a fresh jupyter and ran into this. Looking at the error message, it seems that ipython's interactive shell is trying to call coconut's run_cell_async function with the kw argument transformed_cell. You can see where it's doing this in IPython/core/interactiveshell.py:2897

The argument is mentioned/described in the docs here:
https://ipython.readthedocs.io/en/stable/whatsnew/version7.html#ipython-7-17
https://ipython.readthedocs.io/en/stable/api/generated/IPython.core.interactiveshell.html#IPython.core.interactiveshell.InteractiveShell.run_cell_async

and the API change is mentioned here: https://ipython.readthedocs.io/en/stable/whatsnew/version7.html#api-changes

The reason downgrading to 1.4.0 is a 'workaround' is because run_cell_async didn't exist in 1.4.0

evhub added a commit that referenced this issue Oct 27, 2020
@evhub
Copy link
Owner

evhub commented Oct 27, 2020

@bj0 Thank you for finding that! I believe the issue should now be fixed on coconut-develop. @regr4 @xxdavid @ruivieira Please let me know whether it works now if you pip install -U coconut-develop>=1.4.3-post_dev54.

@bj0
Copy link

bj0 commented Oct 27, 2020

Removing the old version and reinstalling with your line made it work.

@evhub
Copy link
Owner

evhub commented Oct 27, 2020

@bj0 Great! Closing this issue as resolved. The fix will go out in the next release (and coconut-develop is available with the fix in the meantime).

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

No branches or pull requests

5 participants