This question seems to be unrelated to PyTorch, so I would recommend to cross-post it into an XGBoost-specific discussion board or their GitHub repository in case you think it’s a bug in their library.
Actually, I tried also with other classifiers such as SVM and RF and the same error happens. In an other pc the code works so it is my pc problem. Do you have any idea of what is the cause?
I don’t know what might be causing the issue and cannot find a lot of references.
My first idea would be to create a new and clean virtual environment and reinstall the used packages there so check if somehow the environment is broken.