conda-forge / tesseract-feedstock

A conda-smithy repository for tesseract.
BSD 3-Clause "New" or "Revised" License
5 stars 17 forks source link

TESSDATA_PREFIX environment variable not set #3

Closed CurtLH closed 6 years ago

CurtLH commented 6 years ago

Issue: I installed tesseract from Conda-Forge, and as per the directions on the tesseract GitHub, I attempted to use the following command:

$ tesseract image.png outputbase

However, the following error was generated:

Error opening data file /home/curtis/Program_Files/miniconda3/envs/my-env/share/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.

From reading on the tesseract GitHub, I see the following statement that references TESSDATA_PREFIX.

osd.traineddata, for Orientation and Segmentation and eng.traineddata and other 
language data files for English should be in the "tessdata" directory. TESSDATA_PREFIX 
environment variable should be set to the parent directory of "tessdata" directory.

From searching around the tesseract GitHub organization, I came across the tessdata repo. I'm wondering if this needs to also be packaged in Conda-Forge and then somehow linked to the tesseract package?

As I'm way out of my element here, can someone from @conda-forge/staged-recipes help me resolve this issue?

For what it's worth, tesseract seems to be properly installed, just missing some things.

$ tesseract --version
tesseract 3.05.01
 leptonica-1.76.0
  libgif 5.1.4 : libjpeg 9b : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.5.2 : libopenjp2 2.3.0


Environment (conda list):

``` $ conda list # packages in environment at /home/curtis/Program_Files/miniconda3/envs/my-env: # # Name Version Build Channel ca-certificates 2018.4.16 0 conda-forge certifi 2018.4.16 py35_0 conda-forge giflib 5.1.4 0 conda-forge jpeg 9b 2 conda-forge leptonica 1.76.0 h1ccaaf6_4 conda-forge libedit 3.1.20170329 h6b74fdf_2 libffi 3.2.1 hd88cf55_4 libgcc-ng 7.2.0 hdf63c60_3 libpng 1.6.34 0 conda-forge libstdcxx-ng 7.2.0 hdf63c60_3 libtiff 4.0.9 0 conda-forge libwebp 0.5.2 7 conda-forge ncurses 6.1 hf484d3e_0 openjpeg 2.3.0 2 conda-forge openssl 1.0.2o 0 conda-forge pip 10.0.1 py35_0 python 3.5.5 hc3d631a_4 readline 7.0 ha6073c6_4 setuptools 39.2.0 py35_0 sqlite 3.23.1 he433501_0 tesseract 3.05.01 h1ccaaf6_1 conda-forge tk 8.6.7 hc745277_3 wheel 0.31.1 py35_0 xz 5.2.4 h14c3975_4 zlib 1.2.11 ha838bed_2 ```


Details about conda and system ( conda info ):

``` $ conda info active environment : my-env active env location : /home/curtis/Program_Files/miniconda3/envs/my-env shell level : 2 user config file : /home/curtis/.condarc populated config files : conda version : 4.5.4 conda-build version : 3.10.5 python version : 3.6.5.final.0 base environment : /home/curtis/Program_Files/miniconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /home/curtis/Program_Files/miniconda3/pkgs /home/curtis/.conda/pkgs envs directories : /home/curtis/Program_Files/miniconda3/envs /home/curtis/.conda/envs platform : linux-64 user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/4.4.0-124-generic ubuntu/16.04 glibc/2.23 UID:GID : 1000:1000 netrc file : None offline mode : False ```
CurtLH commented 6 years ago

For convenience, here is a sample image to test with:

image

jakirkham commented 6 years ago

Sounds like you want an activate script. Docs are a bit sparse on this. However if you look for activate.sh files in conda-forge, you should be able to find some good examples.

isuruf commented 6 years ago

You need to package tessdata into $PREFIX/share/tessdata/ and you don't need the env variable.

CurtLH commented 6 years ago

Closed with #4

abumubaarak commented 4 years ago

Kindly follow this link

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907831

Make sure you in the /usr/share/openalpr/runtime_data/ocr directory and run sudo ln -s tessdata/* .

It works for me

djsutherland commented 4 years ago

@realDeve, this problem was solved a year and a half ago for the conda packages; it seems you're using a different packaging method for tesseract, not relevant to this repository.

0FoolishProgrammer commented 3 years ago

我也遇到了此问题,方便问一下怎么解决的吗

xylar commented 3 years ago

@0FoolishProgrammer, are you activating your conda environment with conda activate? If not, the environment variables (including TESSDATA_PREFIX wont' be getting set).