I was trying to use RandAugment supported by torchvision, but encountered this Error
input:
from torchvision.transforms import v2
Error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/requests/compat.py:11
10 try:
---> 11 import chardet
12 except ImportError:
ModuleNotFoundError: No module named 'chardet'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
Cell In[15], line 1
----> 1 import torchvision
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/torchvision/__init__.py:6
3 from modulefinder import Module
5 import torch
----> 6 from torchvision import datasets, io, models, ops, transforms, utils
8 from .extension import _HAS_OPS
10 try:
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/torchvision/datasets/__init__.py:1
----> 1 from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
2 from ._stereo_matching import (
3 CarlaStereo,
4 CREStereo,
(...)
12 SintelStereo,
13 )
14 from .caltech import Caltech101, Caltech256
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/torchvision/datasets/_optical_flow.py:13
10 from PIL import Image
12 from ..io.image import _read_png_16
---> 13 from .utils import _read_pfm, verify_str_arg
14 from .vision import VisionDataset
17 T1 = Tuple[Image.Image, Image.Image, Optional[np.ndarray], Optional[np.ndarray]]
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/torchvision/datasets/utils.py:22
19 from urllib.parse import urlparse
21 import numpy as np
---> 22 import requests
23 import torch
24 from torch.utils.model_zoo import tqdm
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/requests/__init__.py:45
41 import warnings
43 import urllib3
---> 45 from .exceptions import RequestsDependencyWarning
47 try:
48 from charset_normalizer import __version__ as charset_normalizer_version
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/requests/exceptions.py:9
1 """
2 requests.exceptions
3 ~~~~~~~~~~~~~~~~~~~
4
5 This module contains the set of Requests' exceptions.
6 """
7 from urllib3.exceptions import HTTPError as BaseHTTPError
----> 9 from .compat import JSONDecodeError as CompatJSONDecodeError
12 class RequestException(IOError):
13 """There was an ambiguous exception that occurred while handling your
14 request.
15 """
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/requests/compat.py:13
11 import chardet
12 except ImportError:
---> 13 import charset_normalizer as chardet
15 import sys
17 # -------
18 # Pythons
19 # -------
20
21 # Syntax sugar.
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/charset_normalizer/__init__.py:24
2 """
3 Charset-Normalizer
4 ~~~~~~~~~~~~~~
(...)
20 :license: MIT, see LICENSE for more details.
21 """
22 import logging
---> 24 from .api import from_bytes, from_fp, from_path
25 from .legacy import detect
26 from .models import CharsetMatch, CharsetMatches
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/charset_normalizer/api.py:5
2 from os import PathLike
3 from typing import Any, BinaryIO, List, Optional, Set
----> 5 from .cd import (
6 coherence_ratio,
7 encoding_languages,
8 mb_encoding_languages,
9 merge_coherence_ratios,
10 )
11 from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE
12 from .md import mess_ratio
File ~/miniconda3/envs/EMBI/lib/python3.10/site-packages/charset_normalizer/cd.py:8
5 from typing import Counter as TypeCounter, Dict, List, Optional, Tuple
7 from .assets import FREQUENCIES
----> 8 from .constant import KO_NAMES, LANGUAGE_SUPPORTED_COUNT, TOO_SMALL_SEQUENCE, ZH_NAMES
9 from .md import is_suspiciously_successive_range
10 from .models import CoherenceMatches
ImportError: cannot import name 'KO_NAMES' from 'charset_normalizer.constant' (/home/myname/miniconda3/envs/EMBI/lib/python3.10/site-packages/charset_normalizer/constant.py)
And this is related pkgs I was using: enter image description here
I've tried updating charset_normalizer pkg, but encountered this question.
You need to install the chardet
module : pip install chardet