ImportError: cannot import name 'CUDF_INSTALLED' from 'xgboost.compat' - python

Good evening.
I just helped someone with an xgboost install via anaconda, by using the line:
conda install -c conda-forge xgboost
And the line in the title is what I was given:
ImportError: cannot import name 'CUDF_INSTALLED' from 'xgboost.compat' (/opt/anaconda3/lib/python3.8/site-packages/xgboost/compat.py)
Google does not provide a lot of insight with respect to how to handle this particular error message.
What would be causing this problem?

I installed xgboost with using:
brew install xgboost
Then I got the same error. Close all running jupyter notebooks and restart anaconda. It works for me.

Related

Transformer: Error importing packages. "ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler'"

I am working on a machine learning project on Google Colab, it seems recently there is an issue when trying to import packages from transformers. The error message says:
ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' (/usr/local/lib/python3.7/dist-packages/torch/optim/lr_scheduler.py)
The code is simple as follow:
!pip install transformers==3.5.1
from transformers import BertTokenizer
So far I've tried to install different versions of the transformers, and import some other packages, but it seems importing any package with:
from transformers import *Package
is not working, and will result in the same error. I wonder if anyone is running into the same issue as well?
Change the torch version in colab by running this command
!pip install torch==1.4.0. Then, It worked for me.
Just change the version of tranformers to the latest one (4.5.1 at this time). That worked in colab.
!pip install transformers
The same issue occurred to me with the PyTorch version after being upgraded.
As for the solution downgrade Pytorch version to 1.4.0.
Use the below command to install
!pip install -q torch==1.4.0 -f https://download.pytorch.org/whl/cu101/torch_stable.html
It's solved a lot of problems with transformers also.
The above from udara vimukthi worked for me after trying a lot of different things, trying to get the code for "Getting started with Google BERT" to work after cloning the gitHub repository locally, so now ALL of the chapter code works while I'm showing my daughter the models.
Operating system - Windows. Running locally with GPU support, using Anaconda environment.
pip install -q --user torch==1.4.0 -f https://download.pytorch.org/whl/cu101/torch_stable.html
then I ran into some more issues and had to install the ipwidgets
pip install ipywidgets
Now it all works, as far as I've gotten. Thanks for the help with the above suggestion it saved me a lot of headaches. :)

ModuleNotFoundError: No module named '_pywrap_tensorflow' erro windows 10

I am trying to install Keras with Tensorflow. I have followed all steps from
here
I have installed CUDA 9 . cuDNN 7.i had problems intalling it with command provided on the site so i used
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
which i have found here on SO. Installation went fine, however when i tried test script ( provided on the tensorflow site ) i recieved error:
No module named '_pywrap_tensorflow
I have tried to check SO for answer but found nothing usefull, how can fix this?
thanks for help.
Regarding your issues you are installing cpu only and old MAC version of tensorflow which shouldn't work on windows.
You could try using the following command
python3 -m pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0-cp35-cp35m-win_amd64.whl
But I suggest you use Anaconda for the windows to install tensorflow and keras it has much less errors on windows, you can find a guide for it here https://github.com/antoniosehk/keras-tensorflow-windows-installation.

Why ImportError: No module named lightgbm

My OS is Ubuntu, and I've followed the official installation guide to install lightgbm. However, when I import it, this error is raised:
ImportError: No module named lightgbm
How can I solve this?
Do I also need to go to /python-package folder to run setup.py after running those linux commandlines?
I had the same problem, and solved running the installation directly on the notebook
!pip install lightgbm
Besides running those linux command lines. I also need to go to /python-package then run 'python setup.py install'.
conda install -c conda-forge lightgbm solved the problem for me
you need just run in a notebook cell before importing
For Windows users, VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572> is needed if Visual Studio (2015 or 2017) is not installed.
Install wheel <http://pythonwheels.com> via pip install wheel first. After that download the wheel file and install from it:
pip install lightgbm
The following should do the trick:
export PATH=/usr/local/bin/anaconda3/bin${PATH:+:${PATH}}
PYTHONPATH=$PYTHONPATH:/usr/local/bin/anaconda3/lib/python3.6/site-packages
Note that you might need to change the paths if you are using a different Python version.
Thank you for above question and answers, had a similar issue.
Problem:
After successfull install of lightgbm, I was getting the error ImportError: No module named 'lightgbm' (in Jupyter Notebook on Google Cloud's Notebook Instance in AI Platform project).
Issue:
Realized that the install of lightgbm was in Python 2.7 even when the notebook was running in Python 3 (path: './.local/lib/python2.7/site-packages').
Solution:
The error was gone after the Jupyter Notebook was set to run on Python 2 instead of Python 3.
within Jupyter Notebook cell is: try running
import sys
!{sys.executable} -m pip install lightgbm
With python try, from pypi.org, this line
pip install lightgbm
or
pip3 install lightgbm
Also, you can try this one if you use anaconda
conda install lightgbm

Xgboost package on mac

I am trying to use Xgboost but facing problems in installation.
i am using mac and I use python notebook jupyter for the same. I opened the command line and used pip install xgboost and it got installed successfully but when I try to use it in my code by writing import xgboost as xg then I get ImportError: No module named xgboost
Can anyone help me?
It may come from the fact that you have two (or more) python environments. A hacky solution is to install it within Jupyter Notebook (note the '!'):
!pip install xgboost

TensorFlow installation results in ImportError: No module named tensorflow

I'm trying to get TensorFlow to work on my Mac (OSX El Capitan 10.11.2). I tried the pip install from the setup guide and also followed the instructions in the accepted answer here.
In both cases I am able to successfully activate the virtualenv and my prompt changes to tensorflow. Python works fine, I'm able to do simple computations on the command line. But when I try to import tensorflow:
import tensorflow as tf
I repeatedly get this error:
ImportError: No module named tensorflow
Any help would be appreciated.
I had the issue reported in the original question. Python worked fine, I followed the installation steps on the Tensforflow website, and got "No module named tensorflow."
Re-installing python via brew, and re-installing pip as a result, fixed it. I didn't need to uninstall anything, just the line below along with the normal pip install from the tensorflow installation document afterwards:
brew install python

Categories

Resources