When I am trying to execute program for OCR I am getting Module not found error.
I am using Anaconda with Jupyter notebook.
I have already installed tesserocr and activated it in conda console but still getting the same error.
import tesserocr
from PIL import Image
print (tesserocr.tesseract_version() ) # print tesseract-ocr version
print (tesserocr.get_languages() ) # prints tessdata path and list of available languages
image = Image.open('C:\\Users\\xxxxx\\Desktop\\CAR_APPLICATIONS\\2019-11-02_15-29-08.jpg')
print(image)
print (tesserocr.image_to_text(image) ) # print ocr text from image
Error:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import tesserocr
2 from PIL import Image
3 print (tesserocr.tesseract_version() ) # print tesseract-ocr version
4 print (tesserocr.get_languages() ) # prints tessdata path and list of available languages
5
ModuleNotFoundError: No module named 'tesserocr'
fixed.. Installed Pylint and it started working.
Related
I am a newbie with Python and I am going around in circles over python's inability to find a mod. In jupyter notebook here is what I get:
pip install pypdf2
Requirement already satisfied: pypdf2 in c:\users\stanleydenman\appdata\local\programs\python\python311\lib\site-packages (3.0.1)
Note: you may need to restart the kernel to use updated packages.
import pypdf2
import pypdf2
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import pypdf2
ModuleNotFoundError: No module named 'pypdf2
So python acknowledges pypdf2 is installed, but cannot find it to import it? I
I have installed, and reinstalled python. I selected the option once to have environmental variables set, other times set them myself. Nothing makes a difference.
Environmental variable set as follows:
C:\Users\StanleyDenman\AppData\Local\Programs\Python\Python311\Scripts\site-packages;C:\Users\StanleyDenman\AppData\Local\Programs\Python\Python311\;C:\Users\StanleyDenman\AppData\Local\Microsoft\WindowsApps;C:\Users\StanleyDenman\AppData\Roaming\npm;C:\Users\StanleyDenman\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Tesseract-OCR;
Tried with Anaconda, cmd line, and jupyter notebook. All the same result.
Try pip list to make sure it's installed.
I am trying to import kaggle datasets using opendatasets module but after using pandas 1.1.2 with python 3.6v it is not working.
It's giving me this error during the import:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/opendatasets/utils/network.py in <module>()
7 try:
----> 8 urlopen = urllib.request.urlopen
9 except Exception:
AttributeError: module 'urllib' has no attribute 'request'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last
PS. I'm working on virtual colab files and not on a local machine
Following is the command of what i am doing
import opendatasets as od
dataset_url='https://www.kaggle.com/rohanrao/air-quality-data-in-india'
od.download('https://www.kaggle.com/rohanrao/air-quality-data-in-india')
data_dir = './air-quality-data-in-india'
!pip install jovian opendatasets --upgrade --quiet
!pip install -q kaggle
import urllib.request
import opendatasets as od
and then entering your kaggle username as well as your kaggle key allows you to import the dataset (until and unless it's not opendata set)
I have installed with pip several packages (numpy/pandas/blpapi/pyarrow). I work with a Windows 64-bit machine, python3.6 in a sublime environment.
While all packages are shown as correctly imported in the command prompt, some packages are not found by my sublime scripts.
To try and remedy this problem, I used sys.path.insert and changed the names of my scripts, to no avail. The traceback below describes what I'm seeing:
Code in Command Prompt:
>>> import pyarrow
>>> import pandas
>>>
Code in Sublime (better_name.py):
print('Hi')
import numpy
import pandas
Output of better_name.py:
Hi
Traceback (most recent call last):
File "C:\Users\Documents\better_name.py", line 4, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
Obtaining the paths in Command Prompt:
>>> import os
>>> import numpy
>>> path = os.path.dirname(numpy.__file__)
>>> print(path)
C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy
>>> import pandas
>>> path = os.path.dirname(pandas.__file__)
>>> print(path)
C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas
Trying to use sys.path.insert :
print('Hi')
import sys
import numpy
import os
sys.path.insert(1, r"C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas")
Output:
C:\Users\Documents>better_name.py
Hi
Traceback (most recent call last):
File "C:\Users\Documents\better_name.py", line 7, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
I get the same results whether I change the argument in sys.path.insert to 0.
The issue seems to be that your default version of python points to the 32-bit version - i.e. when you say python your windows system executes the 32 bit version.
One workaround is to specify the full path of your 64 bit version - i.e. launch your script as
C:\PATH\TO\64-BIT-VERSION\PYTHON.EXE your_script.py
from the command line.
The other option is to set your windows environment variables to point to the 64 bit version by default. This link should help
Hi I have been trying to install twython for Jupyter Notebook. I have proved through the python repl that it is universally installed throughout my laptop. But it still won't appear on Jupyter Notebook. Looking for help trying to figure out it is found in a spot that it can be found by my Anaconda 3 Jupyter Notebook.
Context: Homework assignment trying to mine twitter for tweets
Here is the errors I am receiving and I am running Mac OS
/Users/name/twitter/__init__.py:22: UserWarning: The twython library has not been installed. Some functionality from the twitter package will not be available.
"The twython library has not been installed. "
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-38297a1141e0> in <module>
----> 1 import twitter
2 import twython
3 #---------------------------------------------
4 # Define a Function to Login Twitter API
5 def oauth_login():
~/twitter/__init__.py in <module>
34
35
---> 36 from nltk.twitter.common import json2csv
ModuleNotFoundError: No module named 'nltk.twitter
Have you installed nltk package?
If not, do it:
pip3 install -U nltk
then run python3
inside python3 command line, run:
import nltk
nltk.download()
after the download, restart jupyter, and run your code again.
I'm trying to access my laptop webcam and from what I have seen, I need to use the cv2 package. I downloaded it from PyPi but the contents of the file seem to be missing a lot of content as it only has __init__.py, cv2.cp36-win32.pyd, and opencv_ffmpeg320.dll. So whenever I try use things such as VideoCapture and imwrite, it says it cannot find a reference to them.
When I run the application, I get the following error message:
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "C:/Users/RedCode/PycharmProjects/FunApps/ImageFile.py", line 1, in <module>
import cv2
File "C:\Users\RedCode\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cv2\__init__.py", line 7, in <module>
from . import cv2
ImportError: numpy.core.multiarray failed to import
I have got the numpy package installed and imported but it didn't fix the issue so I'm guessing that's not the actual cause of the problem, so I'm certain it must have something to do with the cv2 package.
The code I'm using right now is as follows:
import cv2
import numpy
cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)
if vc.isOpened(): # try to get the first frame
rval, frame = vc.read()
else:
rval = False
while rval:
cv2.imshow("preview", frame)
rval, frame = vc.read()
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break
cv2.destroyWindow("preview")
I'm also using Python 3.6 and Windows 10 if that helps with anything.
How can I get my application to work?
In your case you can solve your problem by using the following command:
pip install -U numpy
Check existing package:
pip show numpy
And upgrade it via:
pip install numpy --upgrade
Check the path if you still got error:
> import numpy
> print numpy.__path__
You must install the latest version of numpy. Use the command pip install numpy --upgrade or you can just download the wheel file from http://www.lfd.uci.edu/~gohlke/pythonlibs/ . Just check for your python version and platform and download the necessary wheel file. Next use pip to install the wheel file.