So I ran
Package.installPackages(package="xgboost", install_type='install --user')
in the python shell within alteryx. and I got the message "
Successfully installed xgboost-1.5.0
but then when I run
import xgboost as xgb
I get
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-17-a0772e8a04c5> in <module> 2 print(sys.version) 3 Package.installPackages(package="xgboost", install_type='install --user') ----> 4 import xgboost as xgb ModuleNotFoundError: No module named 'xgboost'
What am I doing wrong?
I am running Python 3.8.5
Have you tried just installing it like this?
Package.installPackages('xgboost')
If you must install as user, You'll need to import as shown in my other reply.
Procedure: Installation of a Module in the User Folder
This method uses parameter --userto specify that package must be installed in user folder (%APPDATA%/Python/Python36 as perhttps://www.python.org/dev/peps/pep-0370/#windows-notes).
Example:
Alteryx.installPackages(package="logger", install_type="install --user")
Now, in order to use it, package location must be added to default path: %APPDATA%\Python\Python36\site-packages
Example:
import os,sys sys.path.insert(1,os.path.join(os.environ['APPDATA'],"Python",f"Python{sys.version_info.major}{sys.version_info.minor}","site-packages")) import logger
I do not fully understand. I am not having this problem with any other packages I have installed.
Try just changing from:
Package.installPackages(package="xgboost", install_type='install --user')
To
Alteryx.installPackages(package="xgboost", install_type='install --user')
Change the initial Package to Alteryx and let me know if that works.
That did not work
Unfortunately, I haven't been able to replicate the issue on my end.
I'd recommend manually uninstalling the packages by going to to file paths:
C:\Users\YOURUSERNAME\AppData\Roaming\Python\Python38\site-packages:
Delete both the:
xgboost & xgboost-1.5.0.dist-info folders
C:\Users\YOURUSERNAME\AppData\Roaming\Python
Delete the:
xgboost folder
Then double check that the following folder doesn't have anything related to xgboost:
C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Lib\site-packages
Once you've done this: Try opening Alteryx as Admin and repeating the install process.
As Admin: (More likely to work)
from ayx import Package
Package.installPackages('xgboost')
Or as a user: (Less Likely to work: Your version of Alteryx may have issues connecting to the User Folders) But you did say all other package installs work just fine. So I'm not sure this is the issue.
from ayx import Package
Package.installPackages(package="xgboost", install_type='install --user')