Message Boards Message Boards

GROUPS:

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

Posted 5 months ago
1027 Views
|
5 Replies
|
2 Total Likes
|

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

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 5 months 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"].

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

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!

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