Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: <lambda>() takes 0 positional arguments but 1 was given #6436

Closed
ahmadmustafaanis opened this issue Nov 19, 2023 · 2 comments
Closed

Comments

@ahmadmustafaanis
Copy link

Describe the bug

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-35-7b6becee3685>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from datasets import Dataset

9 frames
[/usr/local/lib/python3.10/dist-packages/datasets/__init__.py](https://localhost:8080/#) in <module>
     20 __version__ = "2.15.0"
     21 
---> 22 from .arrow_dataset import Dataset
     23 from .arrow_reader import ReadInstruction
     24 from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder

[/usr/local/lib/python3.10/dist-packages/datasets/arrow_dataset.py](https://localhost:8080/#) in <module>
     61 import pyarrow.compute as pc
     62 from huggingface_hub import CommitOperationAdd, CommitOperationDelete, DatasetCard, DatasetCardData, HfApi
---> 63 from multiprocess import Pool
     64 from requests import HTTPError
     65 

[/usr/local/lib/python3.10/dist-packages/multiprocess/__init__.py](https://localhost:8080/#) in <module>
     31 
     32 import sys
---> 33 from . import context
     34 
     35 #

[/usr/local/lib/python3.10/dist-packages/multiprocess/context.py](https://localhost:8080/#) in <module>
      4 
      5 from . import process
----> 6 from . import reduction
      7 
      8 __all__ = ()

[/usr/local/lib/python3.10/dist-packages/multiprocess/reduction.py](https://localhost:8080/#) in <module>
     14 import os
     15 try:
---> 16     import dill as pickle
     17 except ImportError:
     18     import pickle

[/usr/local/lib/python3.10/dist-packages/dill/__init__.py](https://localhost:8080/#) in <module>
     24 
     25 
---> 26 from ._dill import (
     27     dump, dumps, load, loads, copy,
     28     Pickler, Unpickler, register, pickle, pickles, check,

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in <module>
    166 try:
    167     from _pyio import open as _open
--> 168     PyTextWrapperType = get_file_type('r', buffering=-1, open=_open)
    169     PyBufferedRandomType = get_file_type('r+b', buffering=-1, open=_open)
    170     PyBufferedReaderType = get_file_type('rb', buffering=-1, open=_open)

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in get_file_type(*args, **kwargs)
    154 def get_file_type(*args, **kwargs):
    155     open = kwargs.pop("open", __builtin__.open)
--> 156     f = open(os.devnull, *args, **kwargs)
    157     t = type(f)
    158     f.close()

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in open(file, mode, buffering, encoding, errors, newline, closefd, opener)
    280             return result
    281         encoding = text_encoding(encoding)
--> 282         text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering)
    283         result = text
    284         text.mode = mode

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in __init__(self, buffer, encoding, errors, newline, line_buffering, write_through)
   2043                 encoding = "utf-8"
   2044             else:
-> 2045                 encoding = locale.getpreferredencoding(False)
   2046 
   2047         if not isinstance(encoding, str):

TypeError: <lambda>() takes 0 positional arguments but 1 was given

or

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-36-652e886d387f>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import datasets

9 frames
[/usr/local/lib/python3.10/dist-packages/datasets/__init__.py](https://localhost:8080/#) in <module>
     20 __version__ = "2.15.0"
     21 
---> 22 from .arrow_dataset import Dataset
     23 from .arrow_reader import ReadInstruction
     24 from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder

[/usr/local/lib/python3.10/dist-packages/datasets/arrow_dataset.py](https://localhost:8080/#) in <module>
     61 import pyarrow.compute as pc
     62 from huggingface_hub import CommitOperationAdd, CommitOperationDelete, DatasetCard, DatasetCardData, HfApi
---> 63 from multiprocess import Pool
     64 from requests import HTTPError
     65 

[/usr/local/lib/python3.10/dist-packages/multiprocess/__init__.py](https://localhost:8080/#) in <module>
     31 
     32 import sys
---> 33 from . import context
     34 
     35 #

[/usr/local/lib/python3.10/dist-packages/multiprocess/context.py](https://localhost:8080/#) in <module>
      4 
      5 from . import process
----> 6 from . import reduction
      7 
      8 __all__ = ()

[/usr/local/lib/python3.10/dist-packages/multiprocess/reduction.py](https://localhost:8080/#) in <module>
     14 import os
     15 try:
---> 16     import dill as pickle
     17 except ImportError:
     18     import pickle

[/usr/local/lib/python3.10/dist-packages/dill/__init__.py](https://localhost:8080/#) in <module>
     24 
     25 
---> 26 from ._dill import (
     27     dump, dumps, load, loads, copy,
     28     Pickler, Unpickler, register, pickle, pickles, check,

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in <module>
    166 try:
    167     from _pyio import open as _open
--> 168     PyTextWrapperType = get_file_type('r', buffering=-1, open=_open)
    169     PyBufferedRandomType = get_file_type('r+b', buffering=-1, open=_open)
    170     PyBufferedReaderType = get_file_type('rb', buffering=-1, open=_open)

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in get_file_type(*args, **kwargs)
    154 def get_file_type(*args, **kwargs):
    155     open = kwargs.pop("open", __builtin__.open)
--> 156     f = open(os.devnull, *args, **kwargs)
    157     t = type(f)
    158     f.close()

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in open(file, mode, buffering, encoding, errors, newline, closefd, opener)
    280             return result
    281         encoding = text_encoding(encoding)
--> 282         text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering)
    283         result = text
    284         text.mode = mode

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in __init__(self, buffer, encoding, errors, newline, line_buffering, write_through)
   2043                 encoding = "utf-8"
   2044             else:
-> 2045                 encoding = locale.getpreferredencoding(False)
   2046 
   2047         if not isinstance(encoding, str):

TypeError: <lambda>() takes 0 positional arguments but 1 was given

Steps to reproduce the bug

import datasets on colab

Expected behavior

work fine

Environment info

colab

!pip install datasets

@mariosasko
Copy link
Collaborator

This looks like a problem with your environment rather than datasets.

@Shuntw6096
Copy link

I meet the same problem,
and originally use

locale.getpreferredencoding = lambda : "UTF-8"

and change to

locale.getpreferredencoding = lambda x: "UTF-8"

and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants