Aligning CoCalc and SageCell kernels

13 views
Skip to first unread message

Ingo Dahn

unread,
Jan 19, 2022, 10:46:37 AM1/19/22
to sage-cell
The notebook https://cocalc.com/share/public_paths/05ebc375f37dbad26864086873499c62d8090af2 runs fine in CoCalc using the kernel Python 3 (systemwide). When I use it with SageCell with Python kernel, the cell

import matplotlib.pyplot as plt
%matplotlib inline

gives a syntax error. However this cell runs fine when I use the SageMath kernel in SageCell, but then the line

chareq = chareq.cancel().collect(s)

gives an error

AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'cancel'

as can be seen at https://dahn-research.eu/Experimental/CheatSheet.html

I couldn't check the notebook with a Sage kernel in CoCalc as that doesn't find the tbcontrol library even if I try to install it in the project using pip install or pip3 install.

Would it be possible to use the CoCalc Python 3 systemwide with SageCell?

NB: I didn't observe any whitespace problem so far.

Andrey Novoseltsev

unread,
Jan 19, 2022, 1:05:45 PM1/19/22
to sage-cell
No.

There are no kernels of different types in SageMathCell. Rather it is always SageMath, but you can feed different languages into it using interfaces from it to other programs. As far as Python language goes, it is executed through SageMath as well, but without preparser and imports. CoCalc, on the other hand, uses different kernels for different languages. I completely understand that it is annoying when you work in one system, then try to copy your code to another, and find that it breaks there. Fortunately, it seems that not that many users are affected ;-)

If somebody were to address your issue "the right way", it would probably be done via re-implementing SageMathCell on top of CoCalc, rather than doing something inside of the current SageMathCell code.

Hopefully it is not a show stopper for you!
Andrey

William Stein

unread,
Jan 19, 2022, 2:11:32 PM1/19/22
to Andrey Novoseltsev, sage-cell
On Wed, Jan 19, 2022 at 10:05 AM Andrey Novoseltsev <novo...@gmail.com> wrote:
>
> No.
>
> There are no kernels of different types in SageMathCell. Rather it is always SageMath, but you can feed different languages into it using interfaces from it to other programs. As far as Python language goes, it is executed through SageMath as well, but without preparser and imports. CoCalc, on the other hand, uses different kernels for different languages. I completely understand that it is annoying when you work in one system, then try to copy your code to another, and find that it breaks there. Fortunately, it seems that not that many users are affected ;-)
>
> If somebody were to address your issue "the right way", it would probably be done via re-implementing SageMathCell on top of CoCalc, rather than doing something inside of the current SageMathCell code.
>

Just to support this suggestion, I'm personally interested in
(someday?) doing the work to address your issue "the right way" by
reimplementing what you need from SageMathCell on top of CoCalc. I
haven't quite figured out how to do this yet though, obviously...

> Hopefully it is not a show stopper for you!
> Andrey
> On Wednesday, 19 January 2022 at 08:46:37 UTC-7 ingo...@gmail.com wrote:
>>
>> The notebook https://cocalc.com/share/public_paths/05ebc375f37dbad26864086873499c62d8090af2 runs fine in CoCalc using the kernel Python 3 (systemwide). When I use it with SageCell with Python kernel, the cell
>>
>> import matplotlib.pyplot as plt
>> %matplotlib inline
>>
>> gives a syntax error. However this cell runs fine when I use the SageMath kernel in SageCell, but then the line
>>
>> chareq = chareq.cancel().collect(s)
>>
>> gives an error
>>
>> AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'cancel'
>>
>> as can be seen at https://dahn-research.eu/Experimental/CheatSheet.html
>>
>> I couldn't check the notebook with a Sage kernel in CoCalc as that doesn't find the tbcontrol library even if I try to install it in the project using pip install or pip3 install.
>>
>> Would it be possible to use the CoCalc Python 3 systemwide with SageCell?
>>
>> NB: I didn't observe any whitespace problem so far.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-cell" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cell+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cell/f5fa6af1-7716-440b-bc89-1bc55015e3e4n%40googlegroups.com.



--
William (http://wstein.org)

Ingo Dahn

unread,
Jan 20, 2022, 8:46:54 AM1/20/22
to sage-cell
Thanks for the explanation - it is good to be aware of the limitations of interoperability, but its not a show-stopper.
Reply all
Reply to author
Forward
0 new messages