Statsmodels import problems - python

I'm having trouble importing statsmodels into my Jupyter Notebook where I'm running Python 3.8.3
My error: ModuleNotFoundError: No module named 'statsmodels'
Things I've tried:
pip install statsmodels
conda install statsmodels
pip install git+https://github.com/statsmodels/statsmodels
This is all done in my virtual environment, which is activated in the jupyter notebook I'm attempting the import in.
I've also attempted importing using import statsmodels.api as sm, import statsmodels.robust as rb as I saw some SO posts suggesting it, but I still get the same error.
When I type !conda list on my terminal, I see statsmodels in the available packages, yet I still can't import it.
Running out of ideas here, any help is appreciated

Related

How do I fix the error "The specified module could not be found" when loading import statsmodels?

Statsmodels is installed in my computer and I am trying to run some files from the terminal through python3
When I try to run a .py file with import statsmodels.api as sm I get an error
Any ideas on what the issue is?
did you do pip install statsmodels
or pip3 install statsmodels
it may have installed it to the wrong python version if you did not specify pip3

ModuleNotFoundError: No module named 'seaborn' in jupyter notebook

I keep getting the error: ModuleNotFoundError: No module named 'seaborn'
when trying to import seaborn.
I have installed seaborn using both pip install seaborn and conda install seaborn.
I saw on seaborn that I am not the only one who has had this issue, but I have not been able to resolve this problem, how can I check and updated that my pip/conda points to the same installation as my interpreter?
EDIT:
I have tried running !pip install seaborn in the notebook, but this still does not work. I have also created my own conda env and installed seaborn (it shows base in the photos) but this also did not work.
you might have an old version of Jupyter notebook, so need to try this command to install it in the current kernel.
import sys
!{sys.executable} -m pip install seaborn
In the New Jupyter version (2019) can be installed simply as:
%pip install seaborn
Note: Answer from different question!

ModuleNotFoundError: No module named 'mlxtend' despite mlxtend being in pip list

I am using Python 3.8.6, with mlxtend version 0.17.3, doing this on jupyter notebook
I have installed mlxtend in my virtual environment on command prompt with
pip install mlxtend
and it also shows up on my pip list.
However when I am trying to import the module within VS Code, and selecting my venv as my python interpreter:
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
I am facing the error:
ModuleNotFoundError: No module named 'mlxtend'
Appreciate any help.
Try pip list or import mlxtend in the console displaying error message. If it wasn't present there, it was an environment configuration problem. Then you can just install the module there using pip.
I remember one of my friends having same problem with some other module. He was also using some kind virtual environment, which I guess caused the problem.
The error is because of environment, and I had a similar problem, but I solved it by adding the isntalled library, in the Interpreter settings, but I did this in PyCharm, look for similar options in VS Code.
P.S. I will update if I found the option in VS.

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

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.

how to import sklearn.impute on jupyter NoteBook?

have problem importing impute module from sklearn in jupyter :
from sklearn.impute import SimpleImpute
I've tried every solution till now,
installing the latest version of both sklearn(0.23.1) and jupyter(6.0.3) notebook
but still have the same error
ModuleNotFoundError: No module named 'sklearn.impute'
I've already tried the same codes on IDLE and there's no problem
the problem is on jupyter
How can I fix this problem?
Run below command in jupyter-notebook and verify if scikit-learn of version 0.23 is in the list. If it is not in the list, then it means your IDLE and jupyter-notebook are using different python installations. (since it is working in IDLE)
!pip list
If it is missing in the list, then install it directly from jupyter-notebook using
!pip install --upgrade scikit-learn

Categories

Resources