Trying to run python script but can't find module IPython.display.. Seems like it would be something simple but I can't find an answer anywhere!
/vagrant/dreamify.py in <module>()
4 import scipy.ndimage as nd
5 import PIL.Image
----> 6 from IPython.display import clear_output, Image, display
7 from google.protobuf import text_format
8
ImportError: No module named display
According to the IPython's repository, the IPython.display module was added in commit 5462c7e, and it was released with IPython 0.13.
I think you have an older version of IPython.
You can check the IPython version with ipython --version.
It can be upgraded with pip install --upgrade IPython.
In Pycharm import module ipython. In Pycharm go to preferences and then project interpreter. Click on the "+" sign then search ipython and install package.
Related
I'm trying to learn PyCaret but having a problem when trying to import it in Jupyter Lab.
I'm working in a virtualenv and installed pycaret via pip:
pip install pycaret
I can confirm its installed via pip list:
prompt-toolkit 3.0.7
protobuf 3.13.0
py 1.9.0
pycaret 2.1.2
pycparser 2.20
The very first line in the notebook is:
from pycaret.nlp import *
however this results in:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-7c206b4a9ead> in <module>
----> 1 from pycaret.nlp import *
2 import psycopg2
3 import sys, os
4 import numpy as np
5 import pandas as pd
ModuleNotFoundError: No module named 'pycaret'
I'm pulling my hair out trying to figure this out and can't find anyone else with something similar.
I've tried to import via the python shell as well and that works perfectly.
You should create a seperate environment for installing time series alpha module
after creating a new environment and switching into
pip install pycaret-ts-alpha
and then you will be able to access
https://towardsdatascience.com/announcing-pycarets-new-time-series-module-b6e724d4636c
I forgot that you had to install modules via Jupyter.
Following this guide: http://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/index.html
Installing like so:
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy
Got it working
First Create a new environment conda documentation
Second Download the Pycaret with this instruction
Third check your sklearn version is greater thansklearn>=0.23.2.
Because if it's greater PyCaret is not compatible with that.
Nothing works for you? Download directly from github with this command
pip install git+https://github.com/pycaret/pycaret.git#egg=pycaret
I read on the tutorial page of pycaret that to install it through a Jupyter-notebook you should add an exclamation mark in front of the python command in the Jupyter-cell:
!pip install pycaret
Once again, the "pip3 install" was successful
This is what the error message looks like:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-fb370059137a> in <module>
1 from PIL import Image
----> 2 import pytesseract
3 import sys
4 from pdf2image import convert_from_path
5 import os
ModuleNotFoundError: No module named 'pytesseract'
check which pip you are using for installation and also see where your Jupyter Notebook is reading from.
1- In the terminal (outside Jupyter), make sure that you can import the package. Note the path of your Python.
2- When in Jupyter Notebook, find your Python path with the following command and make sure they match:
import sys
print(sys.executable)
If the problem was not a PATH issue (which it seems it is!), you should figure out why it's not installed correctly.
Try installing Pillow package along with the pytesseract package
pip install pytesseract Pillow
I have a working Python 3.6 and the package imutils is recognized, importable in its shell. Today I installed some packages on my Python 2 for another task, and now my IPython does not recognize imutils anymore:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-b01afa4ab41d> in <module>()
4 import random
5 import math
----> 6 import imutils
7 import re
8 import time
ImportError: No module named imutils
What's going on? How fragile are these things, seriously.
I run sys.executable on both environments and the result is the same:
/usr/bin/python3
I checked my Python2 and the package is not installed there:
sudo -H pip2.7 uninstall imutils
Skipping imutils as it is not installed.
Doing this:
/usr/bin/python3 -V
Returns this:
Python 3.6.7
Restarting does not work. I did use sudo commands, installed, uninstalled several times - no luck. Something has screwed up my Python, I think.
P.S: I do use Python3 on my IPython as interpreter.
P.S: I don't use Python 3.4 as a kernel whatsoever, they are all 3.6.
EDIT: Okay it is clear that ROS installation screwed up my Python path since I see this:
os.getenv("PYTHONPATH")
'/home/user/ros_ws/devel/lib/python2.7/dist-packages:/opt/ros/melodic/lib/python2.7/dist-packages'
HOW CAN I SET IT BACK TO WHERE IT WAS BY DEFAULT?
It was due to the fact that ROS sourced its own Python version (2.7) by changing the PYTHONPATH.
Once I removed it from my .bashrc, it started to work again.
I'm new to python and Anaconda and I tried to run my code which contains Levenshtein import, however, it shows me this error:
ImportError Traceback (most recent call last)
<ipython-input-1-896847aaaa86> in <module>()
1 import pandas as pd
2 import numpy as np
----> 3 import Levenshtein as lv
4 import math
5 import re
ImportError: No module named 'Levenshtein'
Any recommendations regarding this, I owe you tons of thanks
The error happens because Anaconda does not ship with the Levenshtein package. You'll have to install it.
Usually, you want to install python packages on Jupyter Notebook by using the conda command. I was having trouble installing this package in particular on a Windows, however, simply because Windows Defender held out the process indefinitely.
The way I managed to install it as by using pip in Windows's cmd. First you have to figure out were the python executable from your Notebook is running.
In your notebook:
import sys
{sys.executable}
Copy the path the cell outputs, open the cmd. There, use the following command:
[PASTE THE PATH HERE] -m pip install python-levenshtein
After that you should be able to import Levenshtein.
I am installed some modules for python, numpy, biopython, mx.. on my mac (10.10.5). I started the Terminal and tried to import them and it works.
After that I installed Spyder, when I try to import bumpy in Spyder it works but biopython (from Bio import *) does not work -> (ImportError: No module named Bio).
also import mx does not works.
If I start Python in the Terminal the import still works.