I know this is an old post, but a lot has changed with ExternalEvaluate and its support of Python. In the current releases ExternalEvaluate will create virtual environments on the fly.
For example, this now creates a Python virtual environment that includes pandas
:
session = StartExternalSession[<|
"System" -> "Python",
"Evaluator" -> <|"Dependencies" -> {"pandas"}|>,
"SessionProlog" -> "import pandas as pd"|>]
And then this is some sample code that shows how you can use it. The following will return a Dataset
:
ExternalEvaluate[session, "
data = {'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']}
pd.DataFrame(data)"]
The attached notebook shows the code with the output included.
Attachments: