Message Boards Message Boards

Run python code from a mathematica notebook? (Mac OS)

Posted 5 years ago

Hi,

I am trying to run python code in Mathematica. Ideally, I would like to use Mathematica's algebraic facilities to rearrange values in my python functions. However I am having problems starting an external session. I already have python installed. I have been following the documentation

https://reference.wolfram.com/language/workflow/ConfigurePythonForExternalEvaluate.html enter image description here

If someone could let me know where I am going wrong, see screenshot, that would be great!

Thanks in advance

5 Replies
Posted 5 years ago

Looks like you are trying to run pip from a Mathematica notebook. It needs to be run from a shell. On a Mac start the terminal app, Command-space, then type Terminal and return. In the terminal window type python to make sure Python is installed. Then pip install pyzmq. Then in a notebook try FindExternalEvaluators["Python"].

POSTED BY: Rohit Namjoshi

I should add, this is on a MAC

This does not seem to be a Mathematica issue per se: Mathematica is not finding any Python installation (as shown by the output when you evaluate FindExternalEvaluators["Python"]), and hence not a problem with ExternalEvaluate.

Can you run Python from the command line in Terminal?

POSTED BY: Murray Eisenberg

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

enter image description here

POSTED BY: Moderation Team
Anonymous User
Anonymous User
Posted 5 years ago

you could run Awk, bash or if you want "a front end" or use apple's awesome applescript or cocoa (script you can do things like touch-screen with not just boxes)

unsure why you'd pick python on apple. but your choice!

POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract