Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to use external modules on Saagie platform it is possible to use pip requirements.txt file.

For example to use statistic tensorflow module:

...

With requirements.txt

  • The following file will be used as an entry point script:
Code Block
languagepy
themeRDark
titleFile __main__.py
linenumberstrue
# Module import
import statisticstensorflow as tf


# Use of module
def compute_mean(data):
    statistics.func = tf.reduce_mean(data)
    print(tf.Session().run(func))


# Script
if __name__ == '__main__':
    compute_mean(tf.constant([1, 5, 9, 6, 7]))

  • A requirements.txt file has also to be created:
Code Block
themeRDark
titleFile requirements.txt
linenumberstrue
statisticstensorflow
  • Then you'll have to package both file into a zip archive with the following structure:

Image RemovedImage Added

Please note that whenever there is more than one python file into the zip archive, there have to be a __main__.py file which will be used as an entry point.

...

Code Block
languagebash
themeRDark
titlePython execution command
python {file}

With pip install

It is also possible to install modules manually using pip.

...

Code Block
languagebash
themeRDark
titleManual pip installation
pip install statisticstensorflow
python {file}