Questions tagged [python]

Questions about interfacing with, or features inspired or demonstrated by Python--a programming language featuring a dynamic type system, automatic memory management, and a comprehensive standard library.

Filter by
Sorted by
Tagged with
3
votes
1answer
34 views

How to run a Mathematica package (.m) from Python using the “Wolfram Client Library for Python”?

This question is about calling a Mathematica Package (.m file) from Python employing the "Wolfram Client Library for Python" (https://github.com/WolframResearch/WolframClientForPython). For ...
6
votes
1answer
63 views

RegisterExternalEvaluator claims MissingDependencies even though ZMQ is installed

I have an Anaconda Python installation in a non-standard location. So I ran RegisterExternalEvaluator["Python", "path-to-python.exe"] But I got the following ...
4
votes
1answer
372 views

Convert python Code To Mathematica?

Is there a way to convert simple python code to Mathematica code
3
votes
1answer
39 views

How to access WolframWebEngine running on a remote server?

Thanks to WolframWebEngine it's extremely easy to build and run a webapp backed by the Wolfram Engine on a local machine. Assuming one has all dependencies installed on a remote server, what is the ...
-1
votes
2answers
96 views

How to convert this Python code which uses genetic algorithm to calculate the best path into MMA

Question: From a logistics center, multiple distribution vehicles are used to deliver goods to multiple customers. Each customer's location and demand for goods are certain, each distribution ...
2
votes
0answers
35 views

How add channel for wolframclient using conda?

I want to use the wolframclient Python package in Mathematica. The docs suggest using pip install wolframclient. However, my main Python installation is within ...
4
votes
1answer
155 views

apply python's sympy function in mathematica

I recently try this $$\int\frac{\mathop{\rm Si}(x)}x\,dx$$ Mathematica failed to calculate it. Integrate[SinIntegral[x]/x, x] Mma 11.3 failed,but 12.0 can do it....
0
votes
1answer
78 views

Convert Mathematica expression to Python expression [closed]

I really need to convert this expression to python language, however I am having trouble converting Bessel function (Actually I have several similar expression and to know how to convert really would ...
6
votes
1answer
104 views

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

ExternalEvaluate[pySys, pyCmd] evaluates to Failure[...] every time pyCmd contains some ...
3
votes
0answers
61 views

Failed to start python external session

I use Wolfram Mathematica 12 on Windows 10. Whey I try to register external evaluator RegisterExternalEvaluator["Python", "C:\\Python27\\python.exe"] it fails ...
11
votes
1answer
237 views

How to display images inside Mathematica with matplotlib

How to display images inside Mathematica with matplotlib. A new window is generated by default, but is it possible to display the picture directly in the notebook? Like this: related: How to ...
0
votes
0answers
51 views

A MeijerG function does not accep arguments wrapped in “*Form” for numeric evaluation [duplicate]

I get the following Meijer function as a result of a symbolic integration: expr = MeijerG[{{1, 3/2}, {}}, {{1, 1}, {1/2}}, x]. I try to calculate numerical ...
7
votes
0answers
118 views

Pass Numpy array to Compiled Code (Wolfram Engine, Wolfram Client, Python)

What List-like structures in Python can Wolfram Client handle and how can support for new structures be added? In this answer I describe how to execute from Python, code in a Mathematica package that ...
1
vote
0answers
48 views

Wolfram Engine - how to list and terminate sessions?

Using WolframClient from Python (Jupyterlab notebook) I have at least one session - possibly more: there are three instances of WolframKernel running, possibly due to previously starting a new session ...
5
votes
1answer
153 views

How to execute an existing notebook with Wolfram Engine?

[My related question: mwe-for-compiling-functions-into-standalone-dll-and-calling-them-in-python - here I am exploring an alternative] I have downloaded, installed and activated the wolfram engine (...
5
votes
0answers
60 views

MWE for compiling functions into standalone DLL and calling them in Python?

I have read calling-a-compiledfunction-dll-from-outside-mathematica and the CodeGeneration tutorial and scanned other related questions too numerous to mention, but I am still unclear about how to ...
0
votes
0answers
120 views

Convert Mathematica Code To Python

Is there a way to convert Mathematica code to run in Python without running a Mathematica kernel in 2019? I have a long complicated code in Mathematica I would like to run in Python. However due to ...
0
votes
0answers
68 views

Convert Mathematica output to Python code

I have this Mathematica (output) vector that I'd like to convert to Python: ...
6
votes
1answer
234 views

How to open a Python interpreter input cell?

Something weird just happened to me: I mis-typed a keyboard shortcut, hitting the wrong keys, and a new notebook opened up with a Python prompt! Just for grins, I tried entering some simple Python ...
1
vote
0answers
148 views

ExternalEvaluate of Python do not work (Anaconda)

I cannot get the ExternalEvaluate work for my Python. It says "missing dependencies" for the registration status. I have attached screenshots from Mathematica and Terminal. From the terminal ...
2
votes
1answer
152 views

Is NumberForm double rounding numbers?

A number like 0.644696875 is represented internally as 0.6446968749999...: N[FromDigits[RealDigits[0.644696875, 2], 2], $MachinePrecision] (* 0.6446968749999999 *) ...
0
votes
0answers
119 views

Use FacialFeatures in Python Web API?

Under the hood, FacialFeatures uses the net-model ResNet-101 Trained on Augmented Casia WebFace Data. I would like to see a tutorial-style answer on how one would ...
0
votes
0answers
41 views

External evaluation failed

Can someone help me with the ExternalEvaluation with Python. I think the problem is that for some reason my Python is not registered due to the error "MissingDependencies". A screen shot of the error ...
2
votes
0answers
47 views

Auto-completion for Python commands in console of Mathematica notebooks [closed]

A great feature introduced in Mathematica v11.3 is the embedded external language console: https://www.wolfram.com/language/12/external-system-integration/evaluate-python-in-a-notebook.html?product=...
0
votes
0answers
126 views

Export list of matrix from mathematica to python

I want to have a simple method to export a list of matrix from mathematica to python. Consider the following code: Mathematica : ...
0
votes
0answers
62 views

Using Python in Mathematica : RegisterExternalEvaluator doesn't work

I followed this tutorial https://reference.wolfram.com/language/tutorial/ConfigurePythonForExternalEvaluate.html, installed zmq, restarted mathematica and put this code: ...
4
votes
5answers
724 views

List comprehensions in Mathematica?

I'm looking for an implementation of list comprehensions in Python (nested for-in statement with destructuring and conditionals). Here's an example: ...
0
votes
1answer
107 views

What is the analog of Query in python? [closed]

Is there an analog of Query[] in Python 3.8+?
17
votes
2answers
412 views

How to export a notebook to Jupyter?

I would like a tool to convert any Mathematica notebook into a Jupyter labs notebook, preserving as much content as possible (.ipynb files are just special json). Obviously, this would need to ...
6
votes
0answers
147 views

Export ImageCases to Python?

I’d like a tutorial on how to export a bounding box detector network to mxnet, (for bonus points: convert to Tensorflow), and then get it running correctly in python! Some related questions exist for ...
0
votes
0answers
121 views

Why does ListSurfacePlot3D yield a different surface fit than using Python code for best-fit quadratic curve (2nd-order)?

Using the same data, I obtain different surface fits on Mathematica (using ListSurfacePlot3D) and Python (using a code for best-fit quadratic curve (2nd-order)). Here's my code on Mathematica: ...
0
votes
0answers
57 views

Plotting correlation between two metrics that contain hundreds of thousands of data points

I wanted some feedback on what is thought of as best practice in terms of showing correlation between two metrics in terms of minutes vs minutes when both metrics contain a large amount of data points ...
1
vote
1answer
265 views

How to get Python WolframClient library to connect with WolframKernel on Linux?

My question is similar to the one posted here: WolframEngine install + wolframclient for Python on Ubuntu. However, this solution is not fixing my problem. I cannot get the wolframclient library to ...
4
votes
0answers
68 views

Built-in function (or terse method) to convert from DateObject to Python datetime in Python?

When using the Wolfram Client Library for Python in a Python program there appears to be no built-in function to convert a DateObject in to a Python ...
0
votes
0answers
47 views

Unable to import local Python module to ExternalEvaluate session

Ever since upgrading to Mathematica 12, I have been unable to import a local module in Python that I need for an ExternalEvaluate session. Here is what I have that worked perfectly in Mathematica 11 ...
1
vote
0answers
46 views

Listing variable attributes and methods (python dir() function translation)

Is it possible to list the attributes/methods available to variables in mathematica in a similar way that python does? For instance in python I can run ...
3
votes
2answers
185 views

How to turn a Python array into Mathematica List?

I am running a = RunProcess[$SystemShell, "StandardOutput", "python2 fit.py"] which returns "[ 0.04044647 0.75243326 -0.42992283]\n[ 0.04163976 0.15076435 ...
8
votes
2answers
611 views

How to read .npy file in Mathematica?

I have a .npy file which is created by numpy of Python as below:- ...
21
votes
1answer
1k views

How can I use the Python library networkx from Mathematica?

Is there an easy way to access the Python library networkx from Mathematica? The improvements to ExternalEvaluate in Mathematica 12.0 should make this feasible.
1
vote
0answers
75 views

Difficulty with ExternalEvaluate

I am trying to import a Python function or execute a Python script from inside Mathematica, but the ExternalEvaluate command drives me nuts. I proceed cautiously ...
1
vote
0answers
29 views

Connect to running external session?

Is there some way to connect to an already running process in the same way that StartExternalSession starts a process?
1
vote
0answers
154 views

How can I efficiently call an external Python script that needs to run continuously?

I am writing a Mathematica program that tries to run 100+ Python programs, via StartProcess[], continuously. It seems to work when I run < 100 programs, but, at ...
1
vote
0answers
331 views

Can't register python in ExternalEvaluate

I had Anaconda 3 installed on my system and python registered with the following link: RegisterExternalEvaluator["Python","C:\\Users\\atfai\\Anaconda3\\python.exe"]...
1
vote
0answers
219 views

Mathematica Reduce function in Sympy [closed]

I am now using Mathematica to compare two big expressions with Reduce function. However, since these two expressions are very complicated, I can not get an answer ...
1
vote
0answers
103 views

How to install only Wolfram Kernel and register to a MathLM Server?

I have access to a MathLM server and the Mathematica 11.3 install files. Is there a command line option for the install that will only install the Wolfram Kernel and not the Mathematica front-end? ...
3
votes
1answer
227 views

Is there any way that convert entire mathematica code to java or python?

I am novice to Mathematica. I want to convert Mathematica code from my textbook to Java or Python to trace coding.
0
votes
1answer
96 views

Convert string representation of matrix to matrix

I have a Python script which generates and outputs Mathematica matrices. I use RunProcess to run my Python script and I extract the StandardOutput which is the Mathematica matrix as a string. What I ...
1
vote
0answers
148 views

How can I ExternalEvaluate Python with tesseract?

...
1
vote
0answers
45 views

ExternalEvaluate Python print is printing an extra empty cell with newline

When using print command in ExternalEvaluate["Python","print(1+1)"] or ExternalLanguage cell using >, there is always an extra ...
1
vote
1answer
48 views

Using ExternalEvaluate within ParallelDo

I have had great success using Python in Mathematica (for some computations for which there are very well optimised Python packages but not for Mathematica). I have some Mathematica functions that are ...