sparkfish / augraphy

Augmentation pipeline for rendering synthetic paper printing, faxing, scanning and copy machine processes
https://github.com/sparkfish/augraphy
MIT License
354 stars 46 forks source link

No module named 'sklearn' #210

Closed cs-mshah closed 1 year ago

cs-mshah commented 1 year ago

I created a separate environment to run an augraphy pipeline on my server, but in spite of having 'sklearn' in the pip list, augraphy is throwing this error:

  File "training.py", line 1, in <module>
    from augraphy import *
  File "/home/rivest/anaconda3/envs/ocr/lib/python3.7/site-packages/augraphy/__init__.py", line 1, in <module>
    from augraphy.augmentations import *
  File "/home/rivest/anaconda3/envs/ocr/lib/python3.7/site-packages/augraphy/augmentations/__init__.py", line 1, in <module>
    from augraphy.augmentations.badphotocopy import BadPhotoCopy
  File "/home/rivest/anaconda3/envs/ocr/lib/python3.7/site-packages/augraphy/augmentations/badphotocopy.py", line 6, in <module>
    from augraphy.augmentations.lib import smooth
  File "/home/rivest/anaconda3/envs/ocr/lib/python3.7/site-packages/augraphy/augmentations/lib.py", line 16, in <module>
    from sklearn.datasets import make_blobs
ModuleNotFoundError: No module named 'sklearn'

Here is the pip list output:

(ocr) $ pip list
Package                      Version
---------------------------- --------------------
absl-py                      1.3.0
apturl                       0.5.2
asttokens                    2.1.0
astunparse                   1.6.3
backcall                     0.2.0
bcrypt                       3.1.7
blinker                      1.4
Brlapi                       0.7.0
cachetools                   5.2.0
certifi                      2019.11.28
chardet                      3.0.4
charset-normalizer           2.1.1
Click                        7.0
colorama                     0.4.3
command-not-found            0.3
contourpy                    1.0.5
cryptography                 2.8
cupshelpers                  1.0
cycler                       0.11.0
dbus-python                  1.2.16
debugpy                      1.6.3
decorator                    4.4.2
defer                        1.0.6
distro                       1.4.0
distro-info                  0.23ubuntu1
docker-pycreds               0.4.0
duplicity                    0.8.12.0
entrypoints                  0.3
executing                    1.2.0
fasteners                    0.14.1
flatbuffers                  22.9.24
fonttools                    4.37.4
future                       0.18.2
gast                         0.4.0
gitdb                        4.0.9
GitPython                    3.1.29
google-auth                  2.13.0
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.49.1
h5py                         3.7.0
httplib2                     0.14.0
hupper                       1.10.3
idna                         2.8
imageio                      2.22.2
importlib-metadata           5.0.0
ipykernel                    6.17.1
ipython                      8.6.0
ipython_genutils             0.2.0
jedi                         0.18.1
joblib                       1.2.0
jupyter_client               7.4.7
jupyter_core                 5.0.0
keras                        2.10.0
Keras-Preprocessing          1.1.2
keyring                      18.0.1
kiwisolver                   1.4.4
language-selector            0.1
launchpadlib                 1.10.13
lazr.restfulclient           0.14.2
lazr.uri                     1.0.3
libclang                     14.0.6
lockfile                     0.12.2
louis                        3.12.0
macaroonbakery               1.3.1
Mako                         1.1.0
Markdown                     3.4.1
MarkupSafe                   2.1.1
matplotlib                   3.6.0
matplotlib-inline            0.1.6
monotonic                    1.5
nest-asyncio                 1.5.6
netifaces                    0.10.4
networkx                     2.8.7
nltk                         3.7
numpy                        1.23.4
oauthlib                     3.1.0
olefile                      0.46
opencv-python                4.6.0.66
opt-einsum                   3.3.0
packaging                    21.3
panda                        0.3.1
pandas                       1.5.0
paramiko                     2.6.0
parso                        0.8.3
PasteDeploy                  3.0.1
pathtools                    0.1.2
pexpect                      4.6.0
pickleshare                  0.7.5
Pillow                       9.2.0
pip                          22.3.1
plaster                      1.0
plaster-pastedeploy          0.7
platformdirs                 2.5.4
promise                      2.3
prompt-toolkit               3.0.32
protobuf                     3.19.6
psutil                       5.9.2
pure-eval                    0.2.2
pyasn1                       0.4.8
pyasn1-modules               0.2.8
pycairo                      1.16.2
pycups                       1.9.73
Pygments                     2.13.0
PyGObject                    3.36.0
PyJWT                        1.7.1
pymacaroons                  0.13.0
PyNaCl                       1.3.0
pyparsing                    3.0.9
pyramid                      1.9.2
pyRFC3339                    1.1
python-apt                   2.0.0+ubuntu0.20.4.8
python-dateutil              2.8.2
python-debian                0.1.36ubuntu1
pytz                         2022.5
PyWavelets                   1.4.1
pyxdg                        0.26
PyYAML                       5.3.1
pyzmq                        24.0.1
regex                        2022.9.13
reportlab                    3.5.34
repoze.lru                   0.7
requests                     2.28.1
requests-oauthlib            1.3.1
requests-unixsocket          0.2.0
rsa                          4.9
scikit-image                 0.19.3
scikit-learn                 0.24.2
scipy                        1.9.2
screen-resolution-extra      0.0.0
seaborn                      0.12.1
SecretStorage                2.3.1
sentry-sdk                   1.9.10
setproctitle                 1.3.2
setuptools                   45.2.0
shortuuid                    1.0.9
simplejson                   3.16.0
six                          1.14.0
sklearn                      0.0.post1
smmap                        5.0.0
ssh-import-id                5.10
stack-data                   0.6.1
systemd-python               234
tensorboard                  2.10.1
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.10.0
tensorflow-estimator         2.10.0
tensorflow-gpu               2.10.0
tensorflow-io-gcs-filesystem 0.27.0
termcolor                    2.0.1
threadpoolctl                3.1.0
tifffile                     2022.10.10
tornado                      6.2
tqdm                         4.64.1
traitlets                    5.5.0
translationstring            1.4
typing_extensions            4.4.0
ubuntu-advantage-tools       27.11.2
ubuntu-drivers-common        0.0.0
ufw                          0.36
unattended-upgrades          0.1
urllib3                      1.26.12
usb-creator                  0.3.7
venusian                     3.0.0
wadllib                      1.3.3
wandb                        0.13.4
wcwidth                      0.2.5
WebOb                        1.8.7
Werkzeug                     2.2.2
wheel                        0.34.2
wrapt                        1.14.1
xkit                         0.0.0
zipp                         3.9.0
zope.deprecation             4.4.0
zope.interface               5.5.0

This error did not come in my base environment in local pc. I tried reinstalling sklearn and augraphy both, but this error did not seem to go.

kwcckw commented 1 year ago

This is a known issue from sklearn due to the changes of pip install sklearn to pip install scikit-learn. To resolve the issue, please install Augraphy from the current repo instead of pypi using pip install git+https://github.com/sparkfish/augraphy.

cs-mshah commented 1 year ago

tried that. now even though augraphy appears in the pip list, I get ModuleNotFoundError: No module named 'augraphy'

Edit: resolved everything. the pip was not from the conda env. so did conda install pip. but it should have been, so I found that conda wasn't updated so did conda update -n base -c defaults conda