BERTopic icon indicating copy to clipboard operation
BERTopic copied to clipboard

Not being able to import bertopic in a Kaggle notebook

Open akshaydevml opened this issue 5 years ago • 4 comments

Error while trying to import Bertopic in a notebook. Throws 'numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject' error. Trying with different numpy versions also didn't help

akshaydevml avatar Oct 12 '21 08:10 akshaydevml

This error typically happens when you use an incompatible version of numpy. This means that the active numpy version in the notebook is < 1.20.0. If you update numpy to > 1.20.0 the issue should disappear. However, if you are still getting that error, I would advise simply restarting the notebook. When a package is in use in the current environment and you update it in the same active environment, the old one will be used until you restart the notebook.

I haven't tried that in a Kaggle notebook but the same issue can be found in Jupyter notebooks and Google Colab. So, simply update numpy and restart the notebook should solve the issue.

MaartenGr avatar Oct 12 '21 08:10 MaartenGr

This error typically happens when you use an incompatible version of numpy. This means that the active numpy version in the notebook is < 1.20.0. If you update numpy to > 1.20.0 the issue should disappear. However, if you are still getting that error, I would advise simply restarting the notebook. When a package is in use in the current environment and you update it in the same active environment, the old one will be used until you restart the notebook.

I haven't tried that in a Kaggle notebook but the same issue can be found in Jupyter notebooks and Google Colab. So, simply update numpy and restart the notebook should solve the issue.

I have run the example notebook on kaggle and it reports the same error. I have also tried to upgrade numpy > 1.20.0 version, but failed in kaggle.

bitmman avatar Oct 30 '21 04:10 bitmman

@bitmman Did you make sure to restart the notebook as follows after installing BERTopic?

image

I just tried it out and after running pip install bertopic, I restart the notebook, and then can correctly import and run BERTopic without any issues.

MaartenGr avatar Oct 30 '21 06:10 MaartenGr

@bitmman Did you make sure to restart the notebook as follows after installing BERTopic?

image

I just tried it out and after running pip install bertopic, I restart the notebook, and then can correctly import and run BERTopic without any issues.

Hi MaaartenGr,

Thanks. it works fine after restart the notebook.

bitmman avatar Oct 30 '21 19:10 bitmman