We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

How to install python module MONTHDELTA

Comments

4 comments

  • Avatar
    Adrian Williams

    You can use the attached data flow to install the MonthDelta package into the /<site>/lib/jython2 directory. This location is on the system default search paths for Jython-based nodes (e.g. Transform, Generate Data). Note that only 'pure' python modules can be used with these nodes.

    After importing the prerequisite packages, the node constructs the path to the jython2 directory and uses this to define an argument for the pip install command. 

    A function is defined to perform the required package installation.This uses the subprocess function to execute the installation in a new system process. 

    Next, we specify the name of the package to be in installed (this is case sensitive). Note only 'pure' Python packages can be used with Jython-based nodes. Packages written in other languages (e.g. C++) cannot be used.

    The install() function is then invoked to perform the installation using pip. Note that internet access is required for pip to download the required package, and any prerequisite packages. The output metadata is then defined.

    The results of the install process are output by the ProcessRecords script. 

    Note that, in the case where the installation fails, only limited (or no) information may be output by the sub-process that attempted the installation. 

     

    Attached files

    Install_MonthDelta_Package_in_Default_Repo_Using_pip_in_Transform_Node - 26 Jan 2021.lna

     

    0
    Comment actions Permalink
  • Avatar
    Mark Bergsma

    Hi Adrian,

    Thank you very much for your quick response and solution. I works like a charm!

    This same flow can be used for importing other modules as well I understand?

    Mark

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

    The data flow can be used to import other packages. However, it may not work for all packages - for instance if the package defined by the 'package' variable in the script is pure python but it requires dependent packages which are written in C++ ; or if the package installs files to locations outside of the jython2 directory (e.g. the parent directory).

    0
    Comment actions Permalink
  • Avatar
    Oliver Steadman

    Can confirm we've been using a similar process successfully with boto3 for a while, thanks again Adrian for your help getting us that solution (https://support.infogix.com/hc/en-us/community/posts/360050775114).

    0
    Comment actions Permalink

Please sign in to leave a comment.