添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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:

  1. Open Command Prompt as administrator (not necessary for Alteryx Designer non-admin)
  2. Enter the following:

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:

  1. Install python package in a separate lib directory, other than the default Alteryx Designer's python virtual environment (

    from ayx import Alteryx
    import sys
    print(sys.executable )

  2. load the installed packages from the new Lib directory
  3. insert the below code snippet with your required package name in a new cell and run it

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

@psoma

Thanks for providing another workaround! I really like the following articles as well:

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Use-Alteryx-installPackages-...

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Manage-packages-for-Python-Tool-with-C...

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Python-Tool-How-to-install-additional-...

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.