Skip to content

[DEP] NumPy required in base install #353

@mmaybeno

Description

@mmaybeno

Describe the bug
The base installation requires numpy. Specifically importing the main package calls __init__.py which imports benchmarks which imports numpy. This was noticed in a downstream package that has PyThaiNLP as a requirement.

To Reproduce

# Install with no extras
pip install pythainlp

>>> python
Python 3.7.6 (default, Dec 30 2019, 19:38:26) 
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pythainlp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maybeno/workspace/Envs/newspaper-nvz7rtlC/lib/python3.7/site-packages/pythainlp/__init__.py", line 26, in <module>
    from pythainlp.benchmarks import benchmark
  File "/Users/maybeno/workspace/Envs/newspaper-nvz7rtlC/lib/python3.7/site-packages/pythainlp/benchmarks/__init__.py", line 1, in <module>
    from .word_tokenization import benchmark
  File "/Users/maybeno/workspace/Envs/newspaper-nvz7rtlC/lib/python3.7/site-packages/pythainlp/benchmarks/word_tokenization.py", line 6, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Expected behavior
Run import pythainlp without error.

Source Code
https://github.com/PyThaiNLP/pythainlp/blob/dev/pythainlp/__init__.py#L26

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Python Version 3.7
  • Version 2.1.3

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugbugs in the library

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions