udacity / nd0821-c2-build-model-workflow-starter

Starter Code for the Course 2 project of the Udacity ML DevOps Nanodegree Program
Other
16 stars 431 forks source link

Download step "np.object" error #33

Open BatuhanYilmaz opened 5 months ago

BatuhanYilmaz commented 5 months ago

Greetings,

I forked the repository and when I try to test the download step from the main project, I expected it to work from components/get_data with the script below:

mlflow run . -P steps="download"

On the other hand, I am stuch with these errors:

/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/types/schema.py:49: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  binary = (7, np.dtype("bytes"), "BinaryType", np.object)
Traceback (most recent call last):
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/bin/mlflow", line 7, in <module>
    from mlflow.cli import cli
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/__init__.py", line 52, in <module>
    import mlflow.fastai as fastai  # noqa: E402
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/fastai.py", line 22, in <module>
    from mlflow import pyfunc
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/pyfunc/__init__.py", line 219, in <module>
    import mlflow.pyfunc.model
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/pyfunc/model.py", line 17, in <module>
    from mlflow.models import Model
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/models/__init__.py", line 25, in <module>
    from .signature import ModelSignature, infer_signature
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/models/signature.py", line 12, in <module>
    from mlflow.types.schema import Schema
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/types/__init__.py", line 6, in <module>
    from .schema import DataType, ColSpec, Schema, TensorSpec
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/types/schema.py", line 20, in <module>
    class DataType(Enum):
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/types/schema.py", line 49, in DataType
    binary = (7, np.dtype("bytes"), "BinaryType", np.object)
  File "/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/numpy/__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. 
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

I suspect that the dependencies are a bit old, since the last commit is done about two years ago. Do you have any idea how can we solve this problem?

Mohamedadlyi commented 3 months ago

hello, I know a workaround by editing line 49 in the file

/home/teamx/miniconda3/envs/nyc_airbnb_dev/lib/python3.9/site-packages/mlflow/types/schema.py

binary = (7, np.dtype("bytes"), "BinaryType", np.object)

to

binary = (7, np.dtype("bytes"), "BinaryType", object)

and another solution is to install older numpy version < 1.20.0, but i don't recommend this as it will cause other conflicts.