Hi
While using the Python Tool, sometimes designer throws an error when we try to install or import a specific Python package in Alteryx Designer
error message - " ModuleNotFoundError: No module named 'XXXXX'.
Often this occurs on a local machine where Alteryx Designer is installed in the Windows programs folder like "C:\Program Files" due to Admin rights privilege.
@Jonathan_ in one of his posts mentioned below 2 options as an alternative:
Option 1:
Run Alteryx Designer in elevated mode / as an admin
then from Python tool:
from ayx import Alteryx
Package.installPackages(['PyPDF2'])
Option 2:
For Designer admin:
cd "%PROGRAMFILES%\Alteryx\bin\Miniconda3\PythonTool_venv\Scripts"
pip install PyPDF2
Below is another option that worked for me, with non-admin privilege.
Option 3:
from ayx import Alteryx
import sys
print(sys.executable )
from ayx import Package
from ayx import Alteryx
Alteryx.installPackages(package="logger",
install_type="install --target=C:\\workspace\\Alteryx\\python\\myPythonLibs")
import sys
sys.path.insert(1,'C:\\workspace\\Alteryx\\python\\myPythonLibs')
import logger
logger.logging.info("Logger imported successfully")
Note: install all the required dependencies
Hope this is useful
Solved! Go to Solution.
Thanks for providing another workaround! I really like the following articles as well:
As always we have the best community.
Thanks
James,
Do I have to restart the laptop after use command prompt? I have successfully installed PyPDF2-3.0.1 following this article: https://knowledge.alteryx.com/index/s/article/Install-Python-packages-via-command-prompt
But when I import PyPDF2 in alteryx, it still said that module not found. So I try : Package.installPackages(['PyPDF2']), and it return:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'c:\\program files\\alteryx\\bin\\miniconda3\\envs\\designerbasetools_venv\\Lib\\site-packages\\typing_extensions.py' Consider using the `--user` option or check the permissions.