Importing Python packages
Some Python libraries are installed with the Extender install. You can then import them in an Extender script.
If you want to use a Python library that is not installed with the Extender install, you can add the following line #@ pip(libraryname) to the script that requires the library.
How does it work?
Behind the scenes, the first time a user runs a script, if the library isn't installed on the machine, Extender downloads the scripts from the database as they are cached for performance reasons.
If a script includes @pip, Extender also downloads the required Python packages in the user's temp directory, %LOCALAPPDATA%\COMPANY\{orgid}\scripts\pythonxxx\site-packages folder. (the Python folder depends on the version of Python you are running).
To do this, Extender runs @pip and python.exe, which displays the cmd prompt pop-up the first time a user runs the screen. This should only happen once for each network user.
If you delete the files in that folder, they will be downloaded again next time the script runs.
If a user doesn't have rights to run pip, you will get an error message.
Tip: This feature applies to all scripts, including screen scripts.
If you need to use the requests library, add a comment line #@ pip(libraryname)
Some packages are not compatible with Extender, for example numpy and pandas won't work in Extender scripts.
The issue is that numpy does not work with sub-interpreters correctly (see https://lists.archive.carbon60.com/python/dev/1406603). There is nothing Extender can do about that .
Extender (PU14.04 and above) displays an explicit error message when pip install commands fail. This is generally due to restrictions on the path.
See Configuring the Python Path for Script Execution
In some cases, the environment is locked and prevents installing python packages.
Running pip at the command line must work and Extender is then able to call pip too.
cd\sage\vi73a\python388
python -m pip install python-gnupg
Administrators need to update the firewall and network settings to allow pip.
