35 votes

How can I use the Python library networkx from Mathematica?

Mathematica 12.0 brings two new features that make this easier to do than it was before: ExternalFunction Wolfram Client for Python Below we implement a function <...
Szabolcs's user avatar
  • 233k
20 votes
Accepted

How to use the library exported from FunctionCompileExportLibrary outside of Mathematic (e.g., in Visual Studio)?

This is a quick example of calling the exported compiled function from a standalone executable on Windows. A few things to note which are currently undocumented and that can definitely be subject to ...
ilian's user avatar
  • 25.5k
18 votes
Accepted

FindExternalEvaluators["Python"] gives me an uninstalled version of Python

Update: As of version 12, one should use FindExternalEvaluators["Python", "ResetCache" -> True] To turn my comment into an answer, ...
ilian's user avatar
  • 25.5k
18 votes
Accepted

How can I use Python's SciPy and NumPy functions in Mathematica to find the minimum of a function?

I believe you're not in the correct direction, optimizing your Mathematica code should be more practical and easier. (You've already learned the numeric capability of Mathematica under your previous ...
xzczd's user avatar
  • 63.4k
16 votes

ExternalEvaluate for Python fails with Import::nopythonevals

To get this out of the way: I believe the Import::nopythonevals message will be issued by Import[..., "PythonExpression"] if ...
Szabolcs's user avatar
  • 233k
14 votes
Accepted

"ExternalLanguage" cell with ExternalSessionObject

This has to be done at the stylesheet level and here's a way to do it. First we'll make a new CellEvaluationFunction that uses the ...
b3m2a1's user avatar
  • 46.6k
14 votes

How to display images inside Mathematica with matplotlib

Seems to be able to embed images by converting to png. ...
Aster's user avatar
  • 3,816
14 votes

How can I use Python's SciPy and NumPy functions in Mathematica to find the minimum of a function?

The first solution will use socket to connect python and Mathematica. We'll set up a server that returns the result of the function that has been defined in ...
Ben Izd's user avatar
  • 9,089
13 votes
Accepted

How to obtain the distance (in Km/Miles and in minutes) by road ?. for example using googlemaps

You can use TravelDistance and related functions to find the distance by road. Example: ...
Szabolcs's user avatar
  • 233k
12 votes

How to run a shell script from inside Mathematica

The issue here is that when Mathematica executes an external system command, at least on Linux, it does so from the current directory. You can verify this via ...
Jason B.'s user avatar
  • 67.2k
12 votes

Why does Mathematica use a different $PATH than terminal?

I think this is an OS X issue. Note that if you launch Mathematica from a terminal, you will get the value of Environment["PATH"] which you expected. For GUI ...
ilian's user avatar
  • 25.5k
12 votes
Accepted

How to open a Python interpreter input cell?

Type > at the start of a cell (or when between cells). This is documented in an example on ref/ExternalEvaluate (last Basic Example). I'm a bit suprised it's not in the details section. It probably ...
Itai Seggev's user avatar
11 votes
Accepted

Corresponding built-in types for Python

I think you can find what you're looking for here:
ktm's user avatar
  • 4,231
11 votes

How to add new python type translation to ExternalEvaluate?

A class who inherits the WLSerializable class and overrides the to_wl method can be automatically converted. ...
Aster's user avatar
  • 3,816
11 votes

Is it possible to call back to Mathematica when using Python through ExternalEvaluate?

I'm Riccardo Di Virgilio, one of the developers of ExternalEvaluate and wolframclientforpython. There is a way to do what you want, even if the function is not documented or exposed, so the code I'm ...
Riccardo Di Virgilio's user avatar
10 votes

Getting data into Julia session?

Fortunately, the Wolfram team had done the hard part for us. We don't have to build interface to call julia (in most cases). First, start a session: ...
Ben Izd's user avatar
  • 9,089
9 votes
Accepted

Why does Mathematica use a different $PATH than terminal?

It is certainly an OS X issue. Assuming the default shell is configured, when Terminal starts up it runs the script file ~/.bash_profile, which usually modifies the ...
m_goldberg's user avatar
  • 107k
9 votes

Installing R libraries for use with ExternalEvaluate?

I was able to follow Leonid Shifrin's directions here for Mathematica 12.2 and R 4.0 running on Mac OS X 10.15.7. (I verified that R packages installed by me are accessible through RLink.) See the ...
Anton Antonov's user avatar
8 votes

Interfacing Mathematica with Tableau desktop

This answer is a copy of my Mathematica and Tableau integration GitHub repository. Before you start reading I should mention that even when you are using tabpy, you can only run python code inside ...
Ben Izd's user avatar
  • 9,089
8 votes
Accepted

Within Mathematica, how to export the output of python code to the Mathematica expression?

Even if the session was still open External code cell will be open after executing, you can't use the same variable name you'd defined in the external session, ...
Ben Izd's user avatar
  • 9,089
7 votes

RunProcess seemingly does not work on my Windows system

Your RunProcess works properly in all examples and System settings are fine. As @Oleksandr R. has admitted, date is a shell ...
garej's user avatar
  • 4,815
7 votes
Accepted

RunProcess doesn't list files on Windows

It will work if you send a newline at the end of dir: RunProcess[$SystemShell, All, "dir\n"] (* note the \n *) What I do not ...
Szabolcs's user avatar
  • 233k
7 votes
Accepted

Use conda env for ExternalLanguage cell?

You can do this with SetLanguageCellSession. I've just answered a similar question here, see that answer for an explanation of how what you want can be done in version 12.1+:
M.R.'s user avatar
  • 31.2k
7 votes
Accepted

Run Does not Work

Files Let's create some test files ...
rhermans's user avatar
  • 36.2k
7 votes

Using ImageJ filters directly from Mathematica through J/Link

This is not an answer to the main question on how to do it in Mathematica but merely one possible reason why this whole thing might not be achievable. In Java, your exact example looks like this <...
halirutan's user avatar
  • 112k
7 votes

Control a Mathematica kernel from the front-end and from python

For this I'll make use of a little thing I recently wrote to answer a much deeper question: Control Front End in "mathlink" mode The heart of this will be a little package to make a kernel ...
b3m2a1's user avatar
  • 46.6k
7 votes
Accepted

How to use VBA types with UNDERLINE in it's name in NETLink?

Quoting from the Underscores in .NET Names subsection within the Calling .NET from the Wolfram Language section of the NETLink Tutorial: .NET/Link maps underscores in type, method, property, and ...
WReach's user avatar
  • 68.4k
7 votes

How to link C++ code through the new compiler in V12?

Too long for a comment, but this (undocumented) syntax works in version 12.3 with a minor modification and taking into account a renamed function, for example: ...
ilian's user avatar
  • 25.5k
7 votes

How to extend External Language Input?

It was just an attempt to add a ExternalCell, and did not successfully create an evaluator bind. First create a new package called ExternalEvaluate_*, only this ...
Aster's user avatar
  • 3,816
7 votes
Accepted

ExternalEvaluate[pySys, pyCmd] evaluates to Failure[...]

Reading this, turns out the patch is a one-line fix to enable Python 3.8 support. I haven't tested it extensively, but I've included it in my GitHub gist that also lets you use Python runtimes ...
Michael Himbeault's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible