kachayev / fn.py

Functional programming in Python: implementation of missing features to enjoy FP
Other
3.35k stars 204 forks source link

ImportError: cannot import name Iterable from collections on Python 3.10 #91

Open lucasew opened 2 years ago

lucasew commented 2 years ago

It just doesn't work. It expects Iterable from collections but this is not available.

This log is from building python310Packages.fn with nix but should be reproducible on any python 3.10 out there

Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/bhfhqwy9y6x63h4dq2lpimzkl0b2b29i-fn-0.4.3.tar.gz
source root is fn-0.4.3
setting SOURCE_DATE_EPOCH to timestamp 1407495729 of file fn-0.4.3/setup.cfg
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing setuptoolsBuildPhase
Traceback (most recent call last):
  File "/build/fn-0.4.3/nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 6, in <module>
    import fn
  File "/build/fn-0.4.3/fn/__init__.py", line 1, in <module>
    from .stream import Stream
  File "/build/fn-0.4.3/fn/stream.py", line 9, in <module>
    from .iters import map, range
  File "/build/fn-0.4.3/fn/iters.py", line 2, in <module>
    from collections import deque, Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/nix/store/443qk9752l44kfp8pzsrp0m9jyq6jz2p-python3-3.10.3/lib/python3.10/collections/__init__.py)

Backlinks: https://github.com/NixOS/nixpkgs/pull/167402

albertmenglongli commented 2 years ago

for now, it still can not be successfully installed for Python3.10, version fn 0.4.3

adrian-herscu commented 2 days ago
pip install fn
Collecting fn
  Using cached fn-0.4.3.tar.gz (38 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "/home/adrian-herscu/projects/pam-2/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/adrian-herscu/projects/pam-2/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/adrian-herscu/projects/pam-2/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-n2gvn_wt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-n2gvn_wt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-n2gvn_wt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 503, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-n2gvn_wt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 6, in <module>
        File "/tmp/pip-install-xg9el38v/fn_a61ac9d1a7484f0bac9f25b166d91bd6/fn/__init__.py", line 1, in <module>
          from .stream import Stream
        File "/tmp/pip-install-xg9el38v/fn_a61ac9d1a7484f0bac9f25b166d91bd6/fn/stream.py", line 9, in <module>
          from .iters import map, range
        File "/tmp/pip-install-xg9el38v/fn_a61ac9d1a7484f0bac9f25b166d91bd6/fn/iters.py", line 2, in <module>
          from collections import deque, Iterable
      ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.12/collections/__init__.py)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 24.1.2 -> 24.2
[notice] To update, run: pip install --upgrade pip