I have all packeges installed.
Heres the code:
from PIL import Image
import pytesseract
im = Image.open("sample1.jpg")
text = pytesseract.image_to_string(im, lang = 'eng')
print(text)
and the error is:
Traceback (most recent call last):
File "C:\Users\Usama Malik\Desktop\New folder (3)\tesseract-python-master\image_example.py", line 2, in <module>
import pytesseract
File "C:\Python27\lib\site-packages\pytesseract\__init__.py", line 1, in <module>
from .pytesseract import (
File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 9, in <module>
import Image
File "C:\Python27\lib\site-packages\PIL\Image.py", line 27, in <module>
from . import VERSION, PILLOW_VERSION, _plugins
ValueError: Attempted relative import in non-package
Related
I simply tried to run a code by importing pyautogui module, using the position function.
However, every time, I got the following error:
Traceback (most recent call last):
File "/Users/rahulbansal/Desktop/gfg/try.py", line 1, in <module>
import pyautogui
File "/Library/Python/2.7/site-packages/pyautogui/__init__.py", line 241, in <module>
import mouseinfo
File "/Users/rahulbansal/Library/Python/2.7/lib/python/site-packages/mouseinfo/__init__.py", line 100, in <module>
from rubicon.objc import ObjCClass, CGPoint
File "/Users/rahulbansal/Library/Python/2.7/lib/python/site-packages/rubicon/objc/__init__.py", line 3, in <module>
from .runtime import ( # noqa: F401
File "/Users/rahulbansal/Library/Python/2.7/lib/python/site-packages/rubicon/objc/runtime.py", line 785
self.restype, *self.argtypes = ctypes_for_method_encoding(self.encoding)
^
SyntaxError: invalid syntax
I was trying to run the RPC rnn example from the following link - https://github.com/pytorch/examples/tree/master/distributed/rpc/rnn
but I am unable to import RPC module of the torch.distributed and getting the following error.
Traceback (most recent call last):
File ".\main.py", line 6, in <module>
import torch.distributed.rpc as rpc
File "C:\Users\Public\Anaconda\lib\site-packages\torch\distributed\rpc\__init__.py", line 9, in <module>
from . import backend_registry
File "C:\Users\Public\Anaconda\lib\site-packages\torch\distributed\rpc\backend_registry.py", line 8, in <module>
import torch.distributed.distributed_c10d as dc10d
File "C:\Users\Public\Anaconda\lib\site-packages\torch\distributed\distributed_c10d.py", line 9, in <module>
from .rendezvous import rendezvous, register_rendezvous_handler # noqa: F401
File "C:\Users\Public\Anaconda\lib\site-packages\torch\distributed\rendezvous.py", line 9, in <module>
from . import FileStore, TCPStore
ImportError: cannot import name 'FileStore' from 'torch.distributed' (C:\Users\Public\Anaconda\lib\site-packages\torch\distributed\__init__.py)
Torch Version:
torch 1.4.0+cpu
torchvision 0.5.0+cpu
PyTorch Distributed package does not support Windows yet. Requests for this feature is tracked here: https://github.com/pytorch/pytorch/issues/37068
When I run import shap I'm getting below error:
import shap
Traceback (most recent call last):
File "<ipython-input-1-efbb001a1501>", line 1, in <module>
import shap
File "C:\ProgramData\Anaconda3\lib\site-packages\shap\__init__.py", line 11, in <module>
from .plots.summary import summary_plot
File "C:\ProgramData\Anaconda3\lib\site-packages\shap\plots\summary.py", line 15, in <module>
from . import colors
File "C:\ProgramData\Anaconda3\lib\site-packages\shap\plots\colors.py", line 7, in <module>
import skimage.color
File "C:\ProgramData\Anaconda3\lib\site-packages\skimage\__init__.py", line 157, in <module>
from .util.dtype import *
File "C:\ProgramData\Anaconda3\lib\site-packages\skimage\util\__init__.py", line 8, in <module>
from .arraycrop import crop
File "C:\ProgramData\Anaconda3\lib\site-packages\skimage\util\arraycrop.py", line 8, in <module>
from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name '_validate_lengths'
I am trying to import skeletonize() function from skimage.morphology but it is throwing some unusual error.
This very command was working fine until my recent Windows update.
The respective versions that I am running are:
numpy 1.11.3
python 3.5.6
scikit-image 0.14.0
This is the command
from skimage.morphology import skeletonize
The error message that follows:
File "<ipython-input-69-3b41733bed63>", line 5, in <module>
from skimage.morphology import skeletonize
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\skimage\morphology\__init__.py", line 1, in <module>
from .binary import (binary_erosion, binary_dilation, binary_opening,
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\skimage\morphology\binary.py", line 6, in <module>
from .misc import default_selem
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\skimage\morphology\misc.py", line 5, in <module>
from .._shared.utils import warn
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\skimage\_shared\utils.py", line 10, in <module>
from ..util import img_as_float
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\skimage\util\__init__.py", line 6, in <module>
from .apply_parallel import apply_parallel
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\skimage\util\apply_parallel.py", line 8, in <module>
import dask.array as da
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\dask\array\__init__.py", line 5, in <module>
from .core import (Array, block, concatenate, stack, from_array, store,
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\dask\array\core.py", line 29, in <module>
from . import chunk
File "C:\Users\Nimesh Shahdadpuri\Anaconda3\lib\site-packages\dask\array\chunk.py", line 73, in <module>
nancumprod = npcompat.nancumprod
AttributeError: module 'dask.array.numpy_compat' has no attribute 'nancumprod'
Please help me resolve this error.
I am trying to run this start up code where I am trying to get python to read photos as I am trying to get it to copy all the photos in 1200 folders and paste them to a single photo for my deep learning project. But I keep getting this error or problem.
from PIL import Image
im = Image.open("1.jpg")
im.show()
This is what I get when I try to run the code.
anthony#anthony-G53JW:~/design4$ python copy2.py
Traceback (most recent call last):
File "copy2.py", line 2, in <module>
im = Image.open("1.jpg")
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2289, in open
preinit()
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 365, in preinit
from PIL import JpegImagePlugin
File "/usr/local/lib/python2.7/dist-packages/PIL/JpegImagePlugin.py", line 40, in <module>
from PIL import Image, ImageFile, TiffImagePlugin, _binary
File "/usr/local/lib/python2.7/dist-packages/PIL/TiffImagePlugin.py", line 50, in <module>
from fractions import Fraction
File "/usr/lib/python2.7/fractions.py", line 7, in <module>
from decimal import Decimal
File "/usr/lib/python2.7/decimal.py", line 139, in <module>
import copy as _copy
File "/home/anthony/design4/copy.py", line 25, in <module>
dataset = Image.open("1.jpg")
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2317, in open
% (filename if filename else fp))
IOError: cannot identify image file '1.jpg'