2
$\begingroup$

With Mathematica's notebook, sometimes I hit the > key at the beginning of a new line and start writing python code.

I can call and use the standard package numpy with import numpy as np without a problem. I have also installed other packages that work fine.

However, when I use import sympy it returns the following error message: "No module named sympy", as if sympy was not installed. But I can use sympy in the jupyter notebook. I have already updated it through anaconda, but without a difference. Is it possible to use sympy in Mathematica's notebook?

My mathematica version is 12.3.1.

The figure below has further details.

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ sympy is not part of core python installation. it needs to be installed separately after words. Did you install it? $\endgroup$
    – Nasser
    Oct 28, 2021 at 1:24
  • $\begingroup$ @Nasser, yes, I have sympy installed. It is working within Jupyter. My python installation comes from anaconda, which includes sympy. $\endgroup$
    – Davi
    Oct 28, 2021 at 1:27
  • 5
    $\begingroup$ Actually your comment was useful @Nasser. The problem was that I have different python versions installed, and Mathematica had not my anaconda version as the default one. In order to change the default one, I proceeded as explained in community.wolfram.com/groups/-/m/t/1948852 . After doing so, now sympy can be imported and used. $\endgroup$
    – Davi
    Oct 28, 2021 at 2:20

1 Answer 1

4
$\begingroup$

Somehow this Q&A, with Davi's comment-answer, seems useful:

Actually your comment was useful @Nasser. The problem was that I have different python versions installed, and Mathematica had not my anaconda version as the default one. In order to change the default one, I proceeded as explained in https://community.wolfram.com/groups/-/m/t/1948852 . After doing so, now sympy can be imported and used. – Davi 14 hours ago

I thought I'd post it as an answer in case the Q is closed, but will delete if Davi wants to post. If someone feels like copying the long answer from Community, this is a CW post, so go ahead.

$\endgroup$
1
  • $\begingroup$ From my side, it is great as it is @Michael E2. Good to know that you also find it helpful. $\endgroup$
    – Davi
    Oct 28, 2021 at 21:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.