35 votes
Accepted

How to programmatically extract mathematical formulas from Word with Mathematica 9?

Get all the files here. .NET Mathematica Word Library You will need to use a Microsoft library to open word documents. In a language such as .Net it is very easy; just open Visual Studio, reference ...
user avatar
  • 1,382
34 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 <...
user avatar
  • 225k
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 ...
user avatar
  • 25.1k
17 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 ...
user avatar
  • 52.6k
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 ...
user avatar
  • 225k
14 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, ...
user avatar
  • 25.1k
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 ...
user avatar
  • 5,444
13 votes
Accepted

Can't run Bash scripts from within Mathematica 10.1

(Reposting my comment as an answer) The reason this is happening is that the Mathematica launcher script sets LD_LIBRARY_PATH so that libraries included in the ...
user avatar
  • 25.1k
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: ...
user avatar
  • 225k
13 votes

How to display images inside Mathematica with matplotlib

Seems to be able to embed images by converting to png. ...
user avatar
  • 3,666
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 ...
user avatar
  • 63.2k
12 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 ...
user avatar
  • 45.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 ...
user avatar
  • 13.4k
11 votes
Accepted

Corresponding built-in types for Python

I think you can find what you're looking for here:
user avatar
  • 4,171
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. ...
user avatar
  • 3,666
10 votes

Error when implementing StartProcess[] in loops (Do, While, Table)

The problem is that the stdin stream for each process is being left open and needs to be closed. To demonstrate the issue, we create a single process: ...
user avatar
  • 67k
10 votes
Accepted

How to get output from standard error in command line?

Under most operating systems you can use the 2>&1 handle redirection operator(1),(2): Import["!foo 2>&1", "Text"] ...
user avatar
  • 264k
9 votes

Error when implementing StartProcess[] in loops (Do, While, Table)

We had a bug like this on v. 10: it specifically stopped running new processes after you created 100 of them. This was fixed in version 10.0.1. I recommend testing it there, as version 10.0.1 has a ...
user avatar
9 votes

Get both output and return code of external program

For those who will encounter the same problem as mine (and OP's), I added this answer. Mathematica now(since 10.0.0) has a new built-in function called RunProcess ...
user avatar
  • 2,195
8 votes

How to close external app from Mathematica?

On Windows this works: Run["taskkill /im chrome.exe /f"] Run["taskkill /im WolframPlayerPro.exe /f"]
user avatar
  • 16.8k
8 votes

How to close external app from Mathematica?

There are many ways to do this on a Mac. For example to open Safari: << "!open -a Safari" To open Safari to a particular file or page: ...
user avatar
8 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 ...
user avatar
  • 25.1k
8 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 ...
user avatar
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, ...
user avatar
  • 5,444
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 ...
user avatar
  • 4,735
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 ...
user avatar
  • 225k
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+:
user avatar
  • 30.5k
7 votes
Accepted

Run Does not Work

Files Let's create some test files ...
user avatar
  • 29.4k
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 <...
user avatar
  • 111k
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 ...
user avatar
  • 45.5k

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