3
$\begingroup$

How to run the Wolfram language using Wolfram Client Library for Python in Google colab?

$\endgroup$

1 Answer 1

6
$\begingroup$

Herein lies the answer.

Since a short answer is not accepted:

sign in to wolframcloud.com and get the key from there. The process is detailed in the link.

Then on colab:

from wolframclient.evaluation import WolframCloudSession, SecuredAuthenticationKey
from wolframclient.language import wlexpr, wl
key = SecuredAuthenticationKey(
'3274928379750=',
'987345h87598375=')
session = WolframCloudSession(credentials=key)
session.start()
session.authorized()
session.evaluate('1+1')

## this was fun
a = session.evaluate(wlexpr("RandomVariate[NormalDistribution[1,2], 100]"))
import matplotlib.pyplot as plt
plt.hist(a)

Have fun :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.