I’m trying to load a LMDB dataset with torch.utils.data.Dataloader like below.
class LmdbDataset(Dataset):
    def __init__(self,lmdb_root):
        super().__init__()
        self.env = lmdb.open(lmdb_root, max_readers=32, readonly=True)
# create dataloder
 data = LmdbDataset('train')
loader = DataLoader(data,sampler=DistributedSampler(data,shuffle=True),num_workers=16)
#run 

However,  some erros occur.
-- Process 0 terminated with the following error:
    for batch_idx, batch in enumerate(dataloader):
  File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 278, in __iter__
    return _MultiProcessingDataLoaderIter(self)
  File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 682, in __init__
    w.start()
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/process.py", line 105, in start
    self._popen = self._Popen(self)
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/miniconda/envs/py36/lib/python3.6/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: can't pickle Environment objects


So could anyone give me some advice to solve this problem?
Thanks very much.