Kaggle / docker-python

Kaggle Python docker image
Apache License 2.0
2.47k stars 954 forks source link

error import #1276

Closed lengocthu7504 closed 12 months ago

lengocthu7504 commented 1 year ago

I try my code:

python standard libraries

import os import random import fnmatch import datetime import pickle

data processing

import numpy as np np.set_printoptions(formatter={'float_kind':lambda x: "%.4f" % x})

import pandas as pd pd.set_option('display.width', 300) pd.set_option('display.float_format', '{:,.4f}'.format) pd.set_option('display.max_colwidth', 200)

tensorflow

import tensorflow as tf import keras from keras.models import Sequential # V2 is tensorflow.keras.xxxx, V1 is keras.xxx from keras.layers import Conv2D, MaxPool2D, Dropout, Flatten, Dense from keras.optimizers import Adam from keras.models import load_model print( f'tf.version: {tf.version}' ) print( f'keras.version: {keras.version}' )

sklearn

from sklearn.utils import shuffle from sklearn.model_selection import train_test_split

imaging

import cv2 from imgaug import augmenters as img_aug import matplotlib.pyplot as plt import matplotlib.image as mpimg %matplotlib inline from PIL import Image

And I have error:

ImportError Traceback (most recent call last) Cell In[5], line 10 8 # imaging 9 import cv2 ---> 10 from imgaug import augmenters as img_aug 11 import matplotlib.pyplot as plt 12 import matplotlib.image as mpimg

File /opt/conda/lib/python3.10/site-packages/imgaug/init.py:9 4 # this contains some deprecated classes/functions pointing to the new 5 # classes/functions, hence always place the other imports below this so that 6 # the deprecated stuff gets overwritten as much as possible 7 from imgaug.imgaug import # pylint: disable=redefined-builtin ----> 9 import imgaug.augmentables as augmentables 10 from imgaug.augmentables import 11 import imgaug.augmenters as augmenters

File /opt/conda/lib/python3.10/site-packages/imgaug/augmentables/init.py:8 6 from imgaug.augmentables.lines import 7 from imgaug.augmentables.heatmaps import ----> 8 from imgaug.augmentables.segmaps import 9 from imgaug.augmentables.batches import

File /opt/conda/lib/python3.10/site-packages/imgaug/augmentables/segmaps.py:12 9 import six.moves as sm 11 from .. import imgaug as ia ---> 12 from ..augmenters import blend as blendlib 13 from .base import IAugmentable 16 @ia.deprecated(alt_func="SegmentationMapsOnImage", 17 comment="(Note the plural 'Maps' instead of old 'Map'.)") 18 def SegmentationMapOnImage(*args, **kwargs):

File /opt/conda/lib/python3.10/site-packages/imgaug/augmenters/init.py:21 19 import imgaug.augmenters.pillike # use via: iaa.pillike. 20 from imgaug.augmenters.pooling import ---> 21 from imgaug.augmenters.segmentation import 22 from imgaug.augmenters.size import 23 from imgaug.augmenters.weather import *

File /opt/conda/lib/python3.10/site-packages/imgaug/augmenters/segmentation.py:21 17 import numpy as np 18 # use skimage.segmentation instead from skimage import segmentation here, 19 # because otherwise unittest seems to mix up imgaug.augmenters.segmentation 20 # with skimage.segmentation for whatever reason ---> 21 import skimage.segmentation 22 import skimage.measure 23 import six

File /opt/conda/lib/python3.10/site-packages/skimage/segmentation/init.py:7 5 from .slic_superpixels import slic 6 from ._quickshift import quickshift ----> 7 from .boundaries import find_boundaries, mark_boundaries 8 from ._clear_border import clear_border 9 from ._join import join_segmentations, relabel_sequential

File /opt/conda/lib/python3.10/site-packages/skimage/segmentation/boundaries.py:5 2 from scipy import ndimage as ndi 4 from .._shared.utils import _supported_float_type ----> 5 from ..morphology import dilation, erosion, square 6 from ..util import img_as_float, view_as_windows 7 from ..color import gray2rgb

File /opt/conda/lib/python3.10/site-packages/skimage/morphology/init.py:12 10 from ..measure._label import label 11 from ._skeletonize import medial_axis, skeletonize, skeletonize_3d, thin ---> 12 from .convex_hull import convex_hull_image, convex_hull_object 13 from .grayreconstruct import reconstruction 14 from .misc import remove_small_holes, remove_small_objects

File /opt/conda/lib/python3.10/site-packages/skimage/morphology/convex_hull.py:4 2 from itertools import product 3 import numpy as np ----> 4 from scipy.spatial import ConvexHull, QhullError 5 from ..measure.pnpoly import grid_points_in_poly 6 from ._convex_hull import possible_hull

ImportError: cannot import name 'QhullError' from 'scipy.spatial' (/opt/conda/lib/python3.10/site-packages/scipy/spatial/init.py)

I think that I have a problem with the version of the library but I can't fix it :'(((

djherbis commented 1 year ago

@lengocthu7504 Its a bit hard to follow since this is a long message. Could you move this into a public kaggle notebook and link that here demoing the issue?

Have you tried pip installing any missing packages / incorrect versions?