Linking External Python with TreeAge

I understand that TreeAge Pro 2018 added the ability to use external Python within a TreeAge model. I have followed the directions in the user guide:

  • downloaded Python 3.6 (64 bit version, running on Win 7 Pro 64 bit)
  • installed the py4j library and the numpy package
  • Selected the option to use external Python.

I tried to recreate the example on page 406 of the user guide in "Python Example.trex" (I don't have "Python Example – ExternalNumPy.trex" as an available example project). I get the following error when I try the PythonImportNumpy function in the evaluator:

Error while evaluating expression. 
Error - Expression parsed but cannot be calculated.

Error while evaluating function pythonimportnumpy:
Error while evaluating function user:
Error while obtaining a new communication channel

Calculating: PythonImportNumpy(1, 2, 3, 4)

Unable to evaluate given text at node "Test Python" (Node1).

Any idea what might be causing my problem?

Thanks, 

Bill

 

1

Comments

7 comments
  • Official comment

    Python 2.7 environment seems to be more compatible with TreeAge Pro Java environment.  If you are using Python 3.x you can install Python 2.7 and you will have access to both.

    Feel free to reach out to support@treeage.com if you need further assistance with running Python examples.

    Best Regards,

    Al

    Comment actions Permalink
  • Bill

    Thanks for your question in the community. I will arrange to have the example models linked to your question here. I have sent you an email for now with those missing models.

    0
    Comment actions Permalink
  • We added the models in for the next TreeAge Pro release - TreeAge Pro 2018, R1.1.

    If anyone else needs these files before that version is released, please click on the following link.

    http://files.treeage.com/documents/examples/Python+Examples.zip

    0
    Comment actions Permalink
  • I am also getting this same error when I try to run "Python Example - ExternalNumPy.trex". What is the solution?

    Thanks,

    Paul.

     

    Parser Error

    Error - Expression parsed but cannot be calculated.

    Error while evaluating function pythonimportnumpy:

    Error while evaluating function user: Error while obtaining a new communication channel

    Calculating: PythonImportNumpy(1; 2; 3; 4) 

    Unable to evaluate payoff.

     

    1
    Comment actions Permalink
  • From what I can tell TreeAge can't find the external python executable.  The only success I've had using python with TreeAge is by using the non-external call which I believe is referencing plugins/org.python2-5.1.jar.  I asked a follow up question about specifying which external python and hope to have an answer to both of these questions.

    0
    Comment actions Permalink
  • My sincere apologies, but I was just able to recreate the issue with TreeAge Pro not able to communicate with External Python.  The production builds of TreeAge are missing a component for establishing connection with External Python.  Development builds are working with External Python.

    We will fix this issue shortly and if anyone is interested in receiving an early release of the fix, please send a request to support@treeage.com

    We will also post a message when the fix is available in production release (estimating a few weeks). 

    Thank you for raising this issue to our attention.

    1
    Comment actions Permalink
  • The link to External Python is now working with the new production release of TreeAge Pro 2018 R2.0.

    If you have TreeAge Pro 2018 R1.2 you can simply perform Help -> Update to upgrade to the R2.0 version.

    If you are running TreeAge Pro 2018 R1.1 or any earlier version, you will need to re-install TreeAge Pro 2.0 from

    www.treeage.com/install

    TreeAge Pro 2018 R1.2 introduces a new Eclipse platform which requires new installation.  It is safe to overwrite the previous version of TreeAge Pro with the new one. The license information is preserved when you overwrite the older version of software.  Please back up your work before updating.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post