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:
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:
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?
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.
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
@fmvizcaino --- %AppData%\Roaming\Python\Python38\site-packages, wouldn't be applicable for 2024+ --- maybe %AppData%\Roaming\Python\Python10\site-packages?
How about these answers:
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.")