why does scipy clustering not work? - python

ImportError: cannot import name _hierarchy
I have updated all the related packages using pip. There were no errors with updating pandas, numpy, scipy and scikit-learn. Still I keep getting this wierd error on executing this command
from scipy.cluster.vq import kmeans,vq
I am using 0.15 version. Really stuck here :(

Related

ImportError: cannot import name 'int' from 'numpy'

I am trying to import sklearn library by writing code like from sklearn.preprocessing import MinMaxScaler but it kept showing same error.
I tried uninstalling and reinstalling but no change. Command prompt is also giving same error. Recently I installed some python libraries but that never affected my enviroment.
I also tried running the code in jupyter notebook. When I tried to import numpy like import numpy as np, it ran successfully. So the problem is only with sklearn.
Also, I have worked with sklearn before but have never seen such an error.
You have to read into the error message. For me sklearn was importing something from scipy which uses the outdated np.int, so updating scipy solved the issue for me.

Statsmodels doesn't work even though I installed it

I'm having this issue the past couple of days that is preventing me from getting into my project. So, I have installed statmodels and whenever I type "pip list" in the VS Code Terminal I can clearly see that statsmodels 0.12.2 is installed.
My issue is that on the line that I try to import the library.
from statsmodels.tsa.seasonal import seasonal_decompose
This error pops up:
Unable to import 'statsmodels.tsa.seasonal'pylint(import-error)
Any ideas on how to fix this are highly appreciated!

ImportError: cannot import name 'LatentDirichletAllocation' from 'sklearn.decomposition._online_lda'

I'm facing error whenever I import any Tree module from sklearn. Sample code below
from sklearn.ensemble import ExtraTreesRegressor
model = ExtraTreesRegressor()
model.fit(X,y)
The first time I run the code I get this error -
ImportError: cannot import name 'LatentDirichletAllocation' from 'sklearn.decomposition._online_lda' (C:\Users\lenovo\Anaconda3\lib\site-packages\sklearn\decomposition_online_lda.cp37-win_amd64.pyd)
After that, whenever I run the same code, I get the following error -
AttributeError: type object 'sklearn.tree.criterion.array' has no attribute 'reducecython'
The same code worked well before but suddenly it has stopped working for me
I've tried uninstalling and re-installing scikit-learn as well. Any help would be appreciated. Thanks :)
I think this might be a problem with conda install sklearn version 0.22 as questioned in this issues.
Try pip install -U scikit-learn
Update the scikit-learn, most precisely version 0.22.1

ImportError for NumPy/SciPy

I am trying to run some code that requires importing NumPy and SciPy (I'm using Python 3.4), but I keep getting the following message (my OS is Windows):
import numpy as np # used for linear algebra
ImportError: No module named 'numpy'
I have already downloaded NumPy but I don't know how to set it up correctly. Is there any way to fix this? I've been having this error for a while already.
Update: I found the solution. Apparently I had already downloaded both Anaconda (a distribution of Python) and Python, so I deleted both of them and installed back Anaconda, rebooted the computer and now everything works perfectly (can use NumPy and SciPy).

Import error when using scipy.io module

I'm involved in a raspberry pi project and I use python language. I installed scipy, numpy, matplotlib and other libraries correctly. But when I type
from scipy.io import wavfile
it gives error as "ImportError: No module named scipy.io"
I tried to re-install them, but when i type the sudo cord, it says already the new version of scipy is installed. I'm stucked in this point and please help me... Thank you
I would take a guess and say your Python doesnt know where you isntalled scipy.io. add the scipy path to PYTHONPATH.

Categories

Resources