Ask Your Question

SageMath Version 9.5: codegen function does not exist in Jupyter notebooks

asked 2022-12-21 22:16:12 +0200

St1255 gravatar image


I get the following error when I try the example given by benjaminfjones at ask.sagemath.org_question_7922_export-to-c-code. (Replace _ with / to get the link)

NameError: name 'codegen' is not defined.

I am using the jupyter notebooks version of SageMath. The version of SageMath is 9.5.

Here's what the command window shows: SageMath version 9.5, Release Date: 2022-01-30 Using Python 3.10.6. Type "Help()" for help.

The OS is Linux Mint 21 Cinnamon Version 5.4.12. Linux Kernel Version 5.19.0-051900-generic.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-12-21 22:58:12 +0200

St1255 gravatar image

The post named "sympy codegen with indices" in this forum pointed me to the solution.

I just need to include the following: from sympy.utilities.codegen import codegen

edit flag offensive delete link more


You should accept your own answer to mark it as solved for the benefit of future (per-)users...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-12-23 12:40:59 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-12-21 22:16:12 +0200

Seen: 110 times

Last updated: Dec 21 '22

Related questions