Skip to content

pip install backports-datetime-fromisoformat no longer works #61

Closed

Description

@eprbell

I'm on a Mac (OSX 15.1), but this behavior has been observed on Fedora Linux as well.

When I try:
pip install backports-datetime-fromisoformat

I get:

Collecting backports-datetime-fromisoformat
  Using cached backports_datetime_fromisoformat-2.0.2.tar.gz (23 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: backports-datetime-fromisoformat
  Building wheel for backports-datetime-fromisoformat (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for backports-datetime-fromisoformat (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-15.0-arm64-cpython-313/backports
      copying backports/__init__.py -> build/lib.macosx-15.0-arm64-cpython-313/backports
      creating build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      copying backports/datetime_fromisoformat/__init__.py -> build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      running egg_info
      writing backports_datetime_fromisoformat.egg-info/PKG-INFO
      writing dependency_links to backports_datetime_fromisoformat.egg-info/dependency_links.txt
      writing top-level names to backports_datetime_fromisoformat.egg-info/top_level.txt
      reading manifest file 'backports_datetime_fromisoformat.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'backports_datetime_fromisoformat.egg-info/SOURCES.txt'
      copying backports/datetime_fromisoformat/_datetimemodule.c -> build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      copying backports/datetime_fromisoformat/_datetimemodule.h -> build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      copying backports/datetime_fromisoformat/module.c -> build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      copying backports/datetime_fromisoformat/timezone.c -> build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      copying backports/datetime_fromisoformat/timezone.h -> build/lib.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      running build_ext
      building 'backports._datetime_fromisoformat' extension
      creating build/temp.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -I/Users/marcoz/prj/rp2/.venv/include -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -c backports/datetime_fromisoformat/_datetimemodule.c -o build/temp.macosx-15.0-arm64-cpython-313/backports/datetime_fromisoformat/_datetimemodule.o
      backports/datetime_fromisoformat/_datetimemodule.c:795:25: error: call to undeclared function '_PyUnicode_Copy'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          PyObject *str_out = _PyUnicode_Copy(dtstr);
                              ^
      backports/datetime_fromisoformat/_datetimemodule.c:795:15: error: incompatible integer to pointer conversion initializing 'PyObject *' (aka 'struct _object *') with an expression of type 'int' [-Wint-conversion]
          PyObject *str_out = _PyUnicode_Copy(dtstr);
                    ^         ~~~~~~~~~~~~~~~~~~~~~~
      2 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for backports-datetime-fromisoformat
Failed to build backports-datetime-fromisoformat
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (backports-datetime-fromisoformat)

Any help would be appreciated, thanks.

Activity

  1. movermeyer commented on Dec 27, 2024

    @movermeyer
    Owner

    @eprbell Thanks for reporting this. I'll look into it when I can.

    That said, this package does nothing in Python 3.11+, so you don't need it in Python 3.13 (that I see in the provided stack trace).

    You can conditionally install it, by adding ; python_version < '3.11' to the dependency in pyproject.toml.

    Something like:

    pyproject.toml:

    [project]
    dependencies = [
      "backports-datetime-fromisoformat; python_version < '3.11'",
    ]
  2. eprbell commented on Dec 27, 2024

    @eprbell
    Author

    Thanks for the quick response and the tip. While it's true that in this instance I am using Python 3.13, the package supports 3.8+, so the problem would persist for people with older versions.

  3. movermeyer commented on Dec 28, 2024

    @movermeyer
    Owner

    so the problem would persist for people with older versions.

    @eprbell I believe that the problem only occurs in Python 3.13+, and is a result of python/cpython#106382

    For example, on Python 3.12, it works fine:

    env_312/bin/pip install --no-binary :all: backports.datetime_fromisoformat
    Collecting backports.datetime_fromisoformat
      Using cached backports_datetime_fromisoformat-2.0.2.tar.gz (23 kB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: backports.datetime_fromisoformat
      Building wheel for backports.datetime_fromisoformat (pyproject.toml) ... done
      Created wheel for backports.datetime_fromisoformat: filename=backports_datetime_fromisoformat-2.0.2-cp312-cp312-macosx_15_0_x86_64.whl size=26381 sha256=d3399887ad1d98f321be4ededf37b415bf20aaa5c531f38f03c6aeda720c4043
      Stored in directory: /Users/michael.overmeyer/Library/Caches/pip/wheels/64/6e/89/079008f751a68fdfeffbd72cf8a057eae3f52ac718617c706c
    Successfully built backports.datetime_fromisoformat
    Installing collected packages: backports.datetime_fromisoformat
    Successfully installed backports.datetime_fromisoformat-2.0.2
    

    But on Python 3.13, it fails in the way that you described.

    When I get more time, I might see about modifying the code to work on Python 3.13+, but in the meantime, adding the ; python_version < '3.11' selector should be sufficient.

  4. eprbell commented on Dec 28, 2024

    @eprbell
    Author

    Thanks for the quick resolution: I appreciate it!

  5. movermeyer commented on Dec 28, 2024

    @movermeyer
    Owner

    Fixed in v2.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions