Skip to content

Access to Python 3 modules (Workaround)

Chuong Ho edited this page Jan 14, 2022 · 2 revisions

While we are still working on an Officially Supported Way, here is how you can access these libraries today in Dynamo 2.7/2.8 as a workaround:

Note: Please make sure you are comfortable doing the following steps and make sure you read all of the Terms and Conditions.

Steps:


  1. Download Anaconda - https://www.anaconda.com/products/individual

  2. After install, select the CMD.exe Prompt from the Home tab in the Anaconda Navigator (Install if you need to).

  3. This will open up the Command prompt in your (base) directory as Anaconda creates localized environments.

  4. Open up Dynamo 2.7 (or newer) and query the CPython version - as shown below (Note: Make sure you are in the CPython3 engine)

import sys

OUT = sys.version

  1. Go back to the Anaconda Command Prompt and create a new environment that uses the correct version of Python - In my case version 3.7.3. I’ve called this environment Dynamo373 and you use the following code to create it:

conda create --name Dynamo373 python=3.7.3

  1. You then want to activate this environment, and do so by typing the following code directly into your Anaconda Command Prompt:

conda activate Dynamo373

  1. You can then use Pip to install to this particular environment with:

pip install numpy

Note you can install other packages here, like Pandas or Keras etc.

  1. Inside this Anacondas Command Prompt you will select the location path where they are being installed to your environment: In my case c:\users\amours\anaconda3\envs\dynamo373\lib\site-packages

  2. Back in Dynamo you will open up a new Python node, set it’s engine to CPython3 and then append this path to your sys.path location.

  3. Then you can simply import all of your desired libraries!

# Load the Python Standard and DesignScript Libraries
import sys
import clr
sys.path.append(r'C:\Users\amours\anaconda3\envs\Dynamo373\Lib\site-packages')
import numpy
zeros = numpy.zeros(5)
output = zeros.tolist()
OUT = output

Releases

Roadmap

How To

Dynamo Internals

Contributing

Python3 Upgrade Work

Libraries

FAQs

API and Dynamo Nodes

Clone this wiki locally