I am trying to install pytesseract in a virtual environment in Anaconda prompt. I have tried the following commands
conda create -y -n tesseract python=3.8
conda activate tesseract
conda install -c conda-forge pytesseract
After this I installed the tesseract OCR
conda install -c conda-forge tesseract
Next I added my virtual environment(tesseract) to Jupyter by typing:
python -m ipykernel install --user --name=tesseract
After this I launch the jupyter lab
I tried the following code (from https://pythonforundergradengineers.com/how-to-install-pytesseract.html)
try:
from PIL import Image
except ImportError:
import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Users\abc\Anaconda3\envs\tesseract\Library\bin\tesseract.exe'
The problem is that I get the following error
Traceback (most recent call last):
import pytesseract
ImportError: No module named pytesseract
I have looked at the answer for a similar problem(https://stackoverflow.com/a/51530457/12164941). My question is that even though my jupyter notebook is running in my virtual environment and the pytesseract library is added and exist in C:\Users\abc\anaconda3\envs\tesseract\Lib\site-packages why do i still get the error?
However I no longer get the error if I copy the pytesseract package folder from C:\Users\abc\anaconda3\envs\tesseract\Lib\site-packages to C:\Users\abc\anaconda3\Lib\site-packages