Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in xgboost file #32

Open
sheth17nirali opened this issue Nov 23, 2020 · 1 comment
Open

error in xgboost file #32

sheth17nirali opened this issue Nov 23, 2020 · 1 comment

Comments

@sheth17nirali
Copy link

hello sir,
sir xgboost file is showing error

File "C:\Users\win10\Desktop\twitter-sentiment-analysis-master\code\xgboost.py", line 4, in
from xgboost import XGBClassifier

File "C:\Users\win10\Desktop\twitter-sentiment-analysis-master\code\xgboost.py", line 4, in
from xgboost import XGBClassifier

ImportError: cannot import name 'XGBClassifier' from partially initialized module 'xgboost' (most likely due to a circular import) (C:\Users\win10\Desktop\twitter-sentiment-analysis-master\code\xgboost.py)

and when i change the file name its showing error

File "C:\Users\win10\Desktop\twitter-sentiment-analysis-master\code\xgbost.py", line 4, in
from xgboost import XGBClassifier

File "C:\Users\win10\anaconda3\lib\site-packages\xgboost_init_.py", line 11, in
from .core import DMatrix, Booster

File "C:\Users\win10\anaconda3\lib\site-packages\xgboost\core.py", line 115, in
_LIB = _load_lib()

File "C:\Users\win10\anaconda3\lib\site-packages\xgboost\core.py", line 109, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])

File "C:\Users\win10\anaconda3\lib\ctypes_init_.py", line 451, in LoadLibrary
return self._dlltype(name)

File "C:\Users\win10\anaconda3\lib\ctypes_init.py", line 373, in _init
self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 is not a valid Win32 application

Aavishkar04 added a commit to Aavishkar04/twitter-sentiment-analysis that referenced this issue Oct 13, 2024
Resolved the issue where importing XGBClassifier from xgboost was causing an ImportError due to a circular import in the project. This occurred because the script was named xgboost.py, conflicting with the external xgboost library.

Solution:
Renamed the script to avoid naming conflicts with the xgboost library.
Updated the code to align with Python 3 standards, addressing deprecated methods and outdated syntax.
Changes:
Renamed the script to avoid the ImportError caused by a naming conflict with xgboost.
Replaced the use of xrange() with range() to ensure Python 3 compatibility.
Updated print statements to Python 3 format for cleaner output.
Modified the XGBClassifier initialization from silent to verbosity in line with the current version of XGBoost.
Applied minor adjustments for TF-IDF feature extraction to improve performance and code clarity.
This resolves the issue and ensures the code runs smoothly across Python 3.x environments.
@Aavishkar04
Copy link

Resolved #32 the issue where importing XGBClassifier from xgboost was causing an ImportError due to a circular import in the project. This occurred because the script was named xgboost.py, conflicting with the external xgboost library.

Solution:
Renamed the script to avoid naming conflicts with the xgboost library.
Updated the code to align with Python 3 standards, addressing deprecated methods and outdated syntax.
Changes:
Renamed the script to avoid the ImportError caused by a naming conflict with xgboost.
Replaced the use of xrange() with range() to ensure Python 3 compatibility.
Updated print statements to Python 3 format for cleaner output.
Modified the XGBClassifier initialization from silent to verbosity in line with the current version of XGBoost.
Applied minor adjustments for TF-IDF feature extraction to improve performance and code clarity.
This resolves the issue and ensures the code runs smoothly across Python 3.x environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants