PyThaiNLP / pythainlp

Thai natural language processing in Python
https://pythainlp.org/
Apache License 2.0
984 stars 274 forks source link

bug: pip error: 'sklearn' PyPI package is deprecated #842

Closed konbraphat51 closed 1 year ago

konbraphat51 commented 1 year ago

Description

when pip install pythainlp[full],

got below:

Collecting sklearn (from tltk>=1.3.8->pythainlp[full])
  Using cached sklearn-0.0.post9.tar.gz (3.6 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
      rather than 'sklearn' for pip commands.

      Here is how to fix this error in the main use cases:
      - use 'pip install scikit-learn' rather than 'pip install sklearn'
      - replace 'sklearn' by 'scikit-learn' in your pip requirements files
        (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
      - if the 'sklearn' package is used by one of your dependencies,
        it would be great if you take some time to track which package uses
        'sklearn' instead of 'scikit-learn' and report it to their issue tracker
      - as a last resort, set the environment variable
        SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error

      More information is available at
      https://github.com/scikit-learn/sklearn-pypi-package

      If the previous advice does not cover your use case, feel free to report it at
      https://github.com/scikit-learn/sklearn-pypi-package/issues/new
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Expected results

Install smoothly

Current results

'sklearn' PyPI package is deprecated error

Steps to reproduce

pip install pythainlp[full]

PyThaiNLP version

4.0.2

Python version

3.7.2

Operating system and version

Linux (Google Vertex AI workbentch)

More info

No response

Possible solution

No response

Files

No response

bact commented 1 year ago

This is from TLTK, please refer to this issue: https://github.com/attapol/tltk/issues/7

I will close this.

konbraphat51 commented 1 year ago

So it means we have to wait until TLTK developers handle this?

wannaphong commented 1 year ago

So it means we have to wait until TLTK developers handle this?

Yes, sklearn will gone. I think maybe should drop tltk from full.

bact commented 1 year ago

A PR has been made, but need to be review and merge https://github.com/attapol/tltk/pull/8

bact commented 1 year ago

Dropping tltk from [full] installation can be a solution as well.

bact commented 1 year ago

A current workaround is to avoid full installation, and use combination of these options instead:

wannaphong commented 1 year ago

Dropping tltk from [full] installation can be a solution as well.

I checked pythainlp 4.0.2 and I don't found tltk in setup.py. https://github.com/PyThaiNLP/pythainlp/blob/v4.0.2/setup.py

@konbraphat51 Can you recheck your pythainlp version?

konbraphat51 commented 1 year ago

@wannaphong Really? I simply done pip install pythainlp[full] without any preinstalls. Could it be the python version (3.7.2)'s fault?

konbraphat51 commented 1 year ago

After the error, I performed pip install pythainlp (not [full]) and the version was 4.0.2

wannaphong commented 1 year ago

@wannaphong Really? I simply done pip install pythainlp[full] without any preinstalls. Could it be the python version (3.7.2)'s fault?

Maybe. The log show tltk is request from pythainlp but we doesn't has tltk in any requirements and setup.py. I think you should update pip.

bact commented 1 year ago

TLTK 1.7 seems to fixed this already https://pypi.org/project/tltk/1.7/