Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Issue with Python Package (msal) Installation for Alteryx Gallery

avanibhatnagar
8 - Asteroid

We have an Alteryx Designer workflow that includes a Python tool using the msal library. When we run this workflow in Alteryx Designer on the Alteryx Server, we do the following:

  1. Launch Alteryx Designer as Administrator.
  2. Run Package.installPackages(['msal']).
  3. Then, import the library using import msal.

This setup works fine when running the workflow directly in Designer on the Server. However, when we publish the workflow to the Alteryx Gallery and run it there, it fails with the following error:

ModuleNotFoundError: No module named 'msal' (ToolId: 1)

This raises a few questions:

  • Does Package.installPackages() install the package only for the current user session, rather than system-wide?
  • Could this be why the package is available in Designer but not in the Gallery runtime environment?
  • We haven’t encountered this issue before—how can we verify whether msal is installed in a way that the Gallery can access it?

We’re looking for guidance on how to ensure that the msal package is installed correctly and available to all users and environments, including the Gallery. Any thoughts?

2 REPLIES 2
fmvizcaino
17 - Castor
17 - Castor

Hi @avanibhatnagar ,

 

Here you can find all the information needed related to the Package.installPackages function: https://knowledge.alteryx.com/index/s/article/How-To-Use-Alteryx-installPackages-in-Python-tool-1583...

 

Per the documentation and what I read elsewhere, everything gets installed in a folder accessible by all users. You can check if the package is installed in one of these folders.

2025-06-05_12-48-16.png 

I could be mistaken, but in older versions and if you didn`t have write permissions, packages were installed to the %AppData%\Roaming\Python\Python38\site-packages, and if it is there, it will be specific to that user.

 

If the package is in one of those 3 folders, it should work for all users. If it doesn`t, try restarting the Alteryx Service and see if that helps.

 

Best,

Fernando 

apathetichell
19 - Altair

@fmvizcaino ---  %AppData%\Roaming\Python\Python38\site-packages, wouldn't be applicable for 2024+ --- maybe  %AppData%\Roaming\Python\Python10\site-packages?

 

How about these answers:

  • Does Package.installPackages() install the package only for the current user session, rather than system-wide? --- do you have two Alteryx worker nodes on a single machine? If not --- this is moot. The key is do you have elevated access to each worker node when running this workflow at least the first time? If not - can you specify that this machine runs on a worker node with elevated access?
  • Could this be why the package is available in Designer but not in the Gallery runtime environment? Kind of. It has to be installed as admin.
  • We haven’t encountered this issue before—how can we verify whether msal is installed in a way that the Gallery can access it?

chatgpt says:

import importlib.util

def is_package_installed(package_name):
spec = importlib.util.find_spec(package_name)
return spec is not None

# Example usage:
package = "numpy"
if is_package_installed(package):
print(f"'{package}' is installed.")
else:
print(f"'{package}' is NOT installed.")