Joe Burger
Joe Burger

Reputation: 13

Ipython seems installed but is showing as module not available

I am using Python 3.7.3 installed from Anaconda. It has installed Ipython: I can invoke Ipython from the command line and running the following code in Jupyter notebooks I can see the ipython as an installed package

import subprocess
import sys

reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
installed_packages = [r.decode().split('==')[0] for r in reqs.split()]
print (installed_packages)

However in the same Jupyter notebook when I run the following code

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pydotplus
from Ipython.display import Image
from sklearn.linear_model import LogisticRegression
from sklearn import tree
from sklearn.tree import DecisionTreeClassifier
from sklearn.decomposition import FactorAnalysis
from sklearn.cluster import KMeans
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix,accuracy_score,f1_score

I get the error returned : ModuleNotFoundError: No module named 'Ipython'

It's a Windows 10 machine. I tried reinstalling with conda install and conda update to no avail, and I tried variants of capitalisation.

Upvotes: 1

Views: 98

Answers (1)

Wayne
Wayne

Reputation: 9800

You have a typo. The P in IPython is meant to be capitalized.
Use:

from IPython.display import Image

Upvotes: 1

Related Questions