Python Dependent Modules - How to Install?

Does Octopus/Calamari support installing modules that scripts will need that don’t come pre-installed with the normal Python install?

I have a script that requires the PyYaml and Requests modules, but my script fails to run on the tentacle because it doesn’t have the module installed for the user that the tentacle service is running as. Is there a way to install these modules? or will I need to run a PowerShell script beforehand to make sure they’re installed?

Hi @tommyc!

The best path forward here would be to ensure that the modules are installed before your script runs, either by having a preceding step to install them via pip or your intended installation mechanism, or depending on your infrastructure, building it into your base image so that they are there when the script runs. Both serve the same purpose, it just depends how dynamic your infrastructure is, and if you want to see the step on every deployment.

I hope this helps, please let me know if you have any further questions.

Okay, so there’s no built-in way to do it. It would be nice if there was, like say a python virtual environment that I could tap into. I did notice that Calamari checks for pycryptodome when it runs a python script, is there a way that Octopus could have a feature (from ‘Configure Features’ in the script steps) to add other dependencies? Maybe that could be a new feature for the devs to look into?

Also another feature they should work on is supporting python’s built-in ‘logging’ module rather than ‘print’. it’s much easier to use and supports different log levels out of the box. I am getting “name not defined” errors using the ‘printverbose’ command.

Also, none of my python scripts will work. they keep throwing this error:

Calamari.exe : Traceback (most recent call last): 
At E:\Deploy\Tentacle\Work\20190808173244-111275-331\Bootstrap.ps1:27 char:1 
+ &  "${env:TentacleHome}\Calamari\4.21.2\Calamari.exe" run-script -sen ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo          : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError 

Hi @tommyc!

Thanks for the feature requests - we do have a formal avenue for suggesting new features and additions, via our UserVoice site! You can submit and vote for features that you would like to see in Octopus, and others can vote on your suggestions!

In regards to your script errors - we typically see NativeCommandError when there’s an error in the script, or in the execution of. A couple of things I would check here:

Please don’t hesitate to reach out if you have any further questions!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.