ocropus-archive / DUP-ocropy

Python-based tools for document analysis and OCR
Apache License 2.0
3.42k stars 591 forks source link

can't set up conda environment correctly for ocropus #338

Closed norahvii closed 3 years ago

norahvii commented 3 years ago

https://github.com/ocropus/ocropy was built in WSL2 using the following commands:

$ conda create -n ocropus_env python=2.7 $ source activate ocropus_env $ conda install --file requirements.txt $ wget -nd https://github.com/zuphilip/ocropy-models/raw/master/en-default.pyrnn.gz $ mv en-default.pyrnn.gz models/ $ python setup.py install

however I encounter some unexpected behavior...

  1. the command ipython launches Python 3.8.3 and not the 2.7 version
  2. from within the ipython interpreter my site-packages are referring to the wrong folder

In [1]: from distutils.sysconfig import get_python_lib In [2]: print(get_python_lib())

rather than the site-packages existing in the expected directory, which would look like this: /mnt/d/anaconda3/envs/ocropus_env/lib/python2.7/site-packages
running the code above shows it's location here: /mnt/d/anaconda3/lib/python3.8/site-packages

in fact the site-packages are contained within the folder: /mnt/d/anaconda3/envs/ocropus_env/lib/python2.7/site-packages

i cannot figure out what command to type to produce an ipython or python interpreter which will refer back to the correct site-packages directory.

i also cannot figure out how to test the recognizer with the prescribed ./run-test command. typing ./run-test only produces the output: : invalid option

norahvii commented 3 years ago

This matter was resolved by me. Recommendations: DO NOT INSTALL BY MEANS OF SOURCE ACTIVATE. source activate ocropus_env is .cmd syntax and may point to the wrong conda. I was using WSL in this case, so I needed to type conda activate ocropus_env instead. Supplemental recommendation (if you encounter this issue):

If you are using zsh get out. type: /bin/bash conda create -n ocropus_env python=2.7 conda activate ocropus_env conda install requirements.txt python setup.py install clean ./run-test