Fix Dataset failing to load helper packages should not crash

This commit is contained in:
allegroai 2022-09-18 14:19:22 +03:00
parent 40f92dfb62
commit 19dada0fb4

View File

@ -5,6 +5,7 @@ import shutil
import psutil import psutil
import mimetypes import mimetypes
import re import re
import logging
from copy import deepcopy, copy from copy import deepcopy, copy
from multiprocessing.pool import ThreadPool from multiprocessing.pool import ThreadPool
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
@ -34,26 +35,35 @@ try:
except ImportError: except ImportError:
_Path = None _Path = None
try:
import pandas as pd
except ImportError:
pd = None
try:
import pyarrow
except ImportError:
pyarrow = None
try:
import fastparquet
except ImportError:
fastparquet = None
try: try:
import numpy as np import numpy as np
except ImportError: except ImportError:
np = None np = None
try:
import pandas as pd
except ImportError:
pd = None
except Exception as e:
logging.warning("ClearML Dataset failed importing pandas: {}".format(e))
pd = None
try:
import pyarrow # noqa
except ImportError:
pyarrow = None
except Exception as e:
logging.warning("ClearML Dataset failed importing pyarrow: {}".format(e))
pyarrow = None
try:
import fastparquet # noqa
except ImportError:
fastparquet = None
except Exception as e:
logging.warning("ClearML Dataset failed importing fastparquet: {}".format(e))
fastparquet = None
@attrs @attrs
class FileEntry(object): class FileEntry(object):