I was trying to import all modules for ArcGIS to perform a machine learning analysis. However, the code gives me an error at the line from arcgis.learn.
Code:
%matplotlib inline
import pandas as pd
from datetime import datetime
from IPython.display import Image
from IPython.display import HTML
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from datetime import datetime as dt
import arcgis
from arcgis.gis import GIS
from arcgis.learn import MLModel, prepare_tabulardata
from arcgis.raster import Raster
from fastai.vision import *
Error:
NameError Traceback (most recent call last) in 12 import arcgis 13 from arcgis.gis import GIS ---> 14 from arcgis.learn import MLModel, prepare_tabulardata 15 from arcgis.raster import Raster 16
~\anaconda3\envs\prj\lib\site-packages\arcgis\learn_init_.py in 15 16 if not _LAMBDA_TEXT_CLASSIFICATION: ---> 17 from .models import ( 18 SingleShotDetector, 19 UnetClassifier,
~\anaconda3\envs\prj\lib\site-packages\arcgis\learn\models_init_.py in 2 3 if not _LAMBDA_TEXT_CLASSIFICATION: ----> 4 from ._ssd import SingleShotDetector 5 from ._unet import UnetClassifier 6 from ._retinanet import RetinaNet
~\anaconda3\envs\prj\lib\site-packages\arcgis\learn\models_ssd.py in ----> 1 from ._arcgis_model import ArcGISModel, _get_device 2 from pathlib import Path 3 import json 4 from ._codetemplate import code 5 import warnings
~\anaconda3\envs\prj\lib\site-packages\arcgis\learn\models_arcgis_model.py in 33 if not _LAMBDA_TEXT_CLASSIFICATION: 34 from fastai.vision.learner import model_meta, _default_meta ---> 35 from .._utils.common import get_post_processed_model 36 from torchvision import models 37
~\anaconda3\envs\prj\lib\site-packages\arcgis\learn_utils\common.py in 125 126 --> 127 class ArcGISMSImage(Image): 128 def show( 129 self, ax=None, rgb_bands=None, show_axis=False, title=None, return_ax=False
~\anaconda3\envs\prj\lib\site-packages\arcgis\learn_utils\common.py in ArcGISMSImage() 180 181 @classmethod --> 182 def open(cls, path, cast_to=np.float32, div=None, imagery_type=None): 183 path = str(os.path.abspath(path)) 184 if not os.path.exists:
NameError: name 'np' is not defined
What is wrong because I am not using numpy here and it's not needed!