我正在使用Kaggle做一些工作。
由于某种原因,这一行:import imgaug as aug # data augmentation
导致了这个错误:ImportError: cannot import name 'QhullError' from 'scipy.spatial' (/opt/conda/lib/python3.10/site-packages/scipy/spatial/__init__.py)
scipy
是1.11.1
,scikit-image
是0.21.0
我选择了>Always use the latest environment. Here is the code,它是一个从original tensorflow到pytorch的转换项目
我试过!pip install --upgrade --force-reinstall install scipy
,但没有用。
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[1], line 10
7 import h5py
8 import shutil
---> 10 import imgaug as aug # data augmentation
11 import numpy as np # linear algebra
12 import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
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
字符串
1条答案
按热度按时间mklgxw1f1#
我也只是偶然遇到这个问题。我不知道它来自哪里,但我设法破解它,在从
scipy
导入任何东西之前运行以下代码片段:字符串