ModuleNotFoundError installing yellowbrick in Python - python

I am having trouble installing yellowbrick.
I am using Anaconda, hence I took advantage of using the "conda install".
# set number of clusters
kclusters = 5
pittsburgh_grouped_clustering = pittsburgh_grouped.drop('Neighborhood', 1)
X = pittsburgh_grouped.drop('Neighborhood', 1)
from sklearn.cluster import KMeans
!conda install -c districtdatalabs yellowbrick
from yellowbrick.cluster import KElbowVisualizer
# instantiate the model and visualizer
model = KMeans()
visualizer = KElbowVisualizer(model, k=(1,10))
visualizer.fit(X) # fit data to visualizer
visualizer.poof() # draw/show/poof the data
I expect the package to be installed. The error message I am receiving is:
ModuleNotFoundError: No module named 'yellowbrick'.
What am I missing?

First install yellowbrick outside of your code and verify that it actually installed. You can do this through the terminal doing exactly what you say. You may need to upgrade/downgrade your libraries which may not be happening when you install in your script.
Then try and run your script without the !conda install -c districtdatalabs yellowbrick because once its installed you don't have to install it again.

Steps to follow:
Open Anaconda Navigator
Environments
Open Terminal
Copy-paste "pip install yellowbrick"

My experienced the same thing but I tried and it worked by using the following steps :
Open search on your windows
Look for anaconda prompt, and click
conda install -c districtdatalabs yellowbrick (use the following script to install the yellowbrick module)
enter image description here
Where do I get the script from? Here I attach the link: https://anaconda.org/DistrictDataLabs/yellowbrick

Related

Cannot import installed python library yellowbrick to jupyter notebook

I installed the yellowbrick python library using pip "install yellowbrick". It was installed, but jupyter notebook cannot import the library. When it imports, results show "No module named 'yellowbrick'". But library had perfectly installed.
My experienced the same thing but I tried and it worked by using the following steps :
Open search on your windows
Look for anaconda prompt, and click
conda install -c districtdatalabs yellowbrick (use the following script to install the yellowbrick module)
enter image description here
Where do I get the script from? Here I attach the link: https://anaconda.org/DistrictDataLabs/yellowbrick
Use the following on your anaconda prompt or command prompt:
conda install yellowbrick

Cannot import torch module

I cannot seem to properly install pytorch on my computer, so here is the background of what I have done:
I had already installed python on my computer and it worked. I used it in Eclipse, using pyDev, so I don't know if that could be the problem. Now I want to install pytorch, so I installed anaconda and entered the command for installing pytorch. To get the right command, I use https://pytorch.org/get-started/locally/, where I tried the options both with and without cuda. In both cases I get an error when I type "import torch".
I have also installed miniconda and tried the same with that without succes. I also tried to work in IDLE in stead of Eclipse, but I keep getting the "no module named 'torch'" error. Each time I run a command in anaconda it appears that the installation is succesfull, but I still can't import 'torch'.
Any idea what the problem could be or what I could try?
Open command prompt or terminal and type:
pip3 install pytorch
If it says pip isn't installed then type: python -m pip install -U pip
Then retry importing Pytorch module
Using anaconda, I think you can check to see if pytorch is properly installed inside your conda environment using conda list inside your environment. If it is shown in the list of installed packages, you can directly try to run python in command line and import torch as in the official Pytorch tutorial:
import pytorch
torch.cuda.is_available()
For IDEs like Eclipse, you need to edit the settings of your project so that it uses the correct conda environment.
Try to create conda-env and reinstall pytorch on conda-env.
Then try to import torch again.
import torch
torch.cuda.is_available()

ImportError: No module named IPython

When i try to use from IPython.display import clear_output, display_html, then i show the error:
(ImportError: No module named IPython)
I am using Python 2.7.13, and im trying to make the game of life from John Conway. I am following this link: http://nbviewer.jupyter.org/url/norvig.com/ipython/Life.ipynb
I have read another questions and answers about it, but any answer works for me. First, this error is showed in command line, and when i try to run this code in a file. Second, this error is direct to IPython, not submodule or something similiar.
Ok, finally i achieved my goal.
I wrote ipython --version but i found, it was not installed.
I tried to install it, with pip. I went to C:\Python27\Scripts, here is pip, you can try in this directory, or add to environment variables.
I tried to install ipython, but i found a error
error: Unable to find vcvarsall.bat
so i installed visual studio c++ 9.0, the version to python 2.7.
pip install ipython
If you scrolled this far you may want to try:
import IPython
as opposed to import Ipython. Notice that 2 letters are capitalized
For Anaconda try,
conda install -c anaconda ipython
Use this code to install the IPython library:
!pip install ipython
import IPython
Well, this works on Google Colab.
This is most likely because ipython is not installed.
You can install it with pip.
pip install ipython
If you are using Anaconda (the full version) ipython comes preinstalled. If you are using Miniconda or if the ipython is deleted for some reason you can re-install with
conda install -c anaconda ipython
If you are using it with jupyter. You might want to register the ipython with a user.
python -m ipykernel install [--user] [--name <machine-readable-name>] [--display-name <"User Friendly Name">]
Reference :
Official Documentation
I have a similar issue, but it appears when I was running the script under sudo. Fast and easiest way was to install IPython under sudo.
sudo pip3 install IPython
I am running a script that uses IPython module, in my terminal. If you are also trying to do something similar, this answer might help you.
!pip3 install IPython
Things to keep in mind:-
'I' and 'P' in IPython are uppercase.
I am running the above command in python 3.7.
you need to import
from IPython.display import Image
initially, I imported
from IPython.display import image
so there is Image not image
For me, the problem (that drove me crazy) is that I actually needed capitalization. The correct import after pip install is:
from IPython.display import display, update_display
etc.

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

How to install gensim on windows

Not able to install gensim on windows.Please help me I need to gensim Immediately and tell me installation steps with More details and other software that needs to be installed before it. thanks
First you need to install NumPy then SciPy and then Gensim (assuming you already have Python installed). I used Python 3.4 as I find it easier to install SciPy using version 3.4.
Step 1) Install Numpy:
Download numpy‑1.13.1+mkl‑cp34‑cp34m‑win32.whl from here
note that in cp34-cp34m 34 is version of Python you are using. So download appropriate file
Open command prompt and go the folder in which you just downloaded the file and install Numpy using following command:
pip install numpy‑1.13.1+mkl‑cp34‑cp34m‑win32.whl
You should get successfully installed numpy message
Step 2) Install SciPy:
Follow the same link as above and download the scipy‑0.19.1‑cp34‑cp34m‑win32.whl file.
Install it using the same instructions than in Step 1 but with this file name. The command is the following:
pip install scipy‑0.19.1‑cp34‑cp34m‑win32.whl
You should get this message successfully installed scipy
Step 3) Install gensim:
Follow the link in step 1 and download gensim‑2.3.0‑cp34‑cp34m‑win32.whl (the appropriate version for your system)
Install it using the instructions in Step 1 (with this file name) with following command:
pip install gensim‑2.3.0‑cp34‑cp34m‑win32.whl
You should get this message successfully installed gensim
Now in a Python shell try:
import gensim
It should be successfully imported
NOTES:
Make sure pip is in your environment variables (add C:\python34\scripts to your environment variable).
Make sure to download all the packages according to the Python version you are using.
gensim depends on scipy and numpy.You must have them installed prior to installing gensim. Simple way to install gensim in windows is, open cmd and type
pip install -U gensim
Or download gensim for windows from
https://pypi.python.org/pypi/gensim
then run
python setup.py test
python setup.py install
I struggled with this a bit today trying to figure out if I needed a python 2.7 environment or if I could use my 3.5. I ended up doing this from an Anaconda 3.5 install:
conda install -c anaconda gensim=0.12.4
After a few hours of trying various things, suddenly it all worked on 3.5. My error was that it kept failing to install Scipy. I tried starting over with the conda install and just worked.
See: https://anaconda.org/anaconda/gensim
I strongly suggest using anaconda where the installation of all the packages is very easy.
The command for installing genism and all of its necessary packages on windows using anaconda python 3.7 is below.
conda install -c anaconda gensim
I followed the instruction on https://radimrehurek.com/gensim/install.html which then successfully installed the fast version of Gensim (3.8.0) on Windows:
conda install -c conda-forge gensim
PS:
The following did NOT install the fast version on Windows:
conda install gensim
After attempting some of the above ideas, there was still a "hiccup" with gensim but the error was something else related to punkt. The following (where the interest is the second line)...
import nltk
nltk.download('punkt')
import numpy
import scipy
import gensim
...did the trick. I used conda and not pip but do not believe that mattered.
Versions: latest python
Machine: Windows 10 (latest updates as of 8/2020)

Categories

Resources