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

building wheel for backports-datetime-fromisoformat - install error #273

Open
umk0m1qk opened this issue Dec 26, 2024 · 10 comments
Open

building wheel for backports-datetime-fromisoformat - install error #273

umk0m1qk opened this issue Dec 26, 2024 · 10 comments
Assignees

Comments

@umk0m1qk
Copy link

Running Fedora 41 with latest Python 3.13.1. I'm getting the following error on pip install dali-rp2. RP2 itself installs without issue. Appreciate any guidance.

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
╰─> [21 lines of output]
/tmp/pip-build-env-_flmvs9r/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
/tmp/pip-build-env-_flmvs9r/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-313/backports
copying backports/init.py -> build/lib.linux-x86_64-cpython-313/backports
creating build/lib.linux-x86_64-cpython-313/backports/datetime_fromisoformat
copying backports/datetime_fromisoformat/init.py -> build/lib.linux-x86_64-cpython-313/backports/datetime_fromisoformat
running build_ext
building 'backports._datetime_fromisoformat' extension
creating build/temp.linux-x86_64-cpython-313/backports/datetime_fromisoformat
gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -O3 -fPIC -I/usr/include/python3.13 -c backports/datetime_fromisoformat/_datetimemodule.c -o build/temp.linux-x86_64-cpython-313/backports/datetime_fromisoformat/_datetimemodule.o
In file included from backports/datetime_fromisoformat/_datetimemodule.c:66:
backports/datetime_fromisoformat/_datetimemodule.h:1:10: fatal error: Python.h: No such file or directory
1 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' 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)

@eprbell
Copy link
Owner

eprbell commented Dec 26, 2024

It sounds like your system doesn't have
backports-datetime-fromisoformat and the installer is trying to build it from source, but you don't have Python
development libraries.

Can you try:
sudo dnf install python3-dev

And then try again?

@umk0m1qk
Copy link
Author

Thanks for the reply. It's actually sudo dnf install python3-devel (which installed without issue). Unfortunately, a similar error is still returned when I now attempt dali install:

error: subprocess-exited-with-error

× Building wheel for backports-datetime-fromisoformat (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
/tmp/pip-build-env-ndz2iguy/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
/tmp/pip-build-env-ndz2iguy/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-313/backports
copying backports/init.py -> build/lib.linux-x86_64-cpython-313/backports
creating build/lib.linux-x86_64-cpython-313/backports/datetime_fromisoformat
copying backports/datetime_fromisoformat/init.py -> build/lib.linux-x86_64-cpython-313/backports/datetime_fromisoformat
running build_ext
building 'backports._datetime_fromisoformat' extension
creating build/temp.linux-x86_64-cpython-313/backports/datetime_fromisoformat
gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -O3 -fPIC -I/usr/include/python3.13 -c backports/datetime_fromisoformat/_datetimemodule.c -o build/temp.linux-x86_64-cpython-313/backports/datetime_fromisoformat/_datetimemodule.o
backports/datetime_fromisoformat/_datetimemodule.c: In function ‘_sanitize_isoformat_str’:
backports/datetime_fromisoformat/_datetimemodule.c:795:25: error: implicit declaration of function ‘_PyUnicode_Copy’; did you mean ‘PyUnicode_Count’? [-Wimplicit-function-declaration]
795 | PyObject *str_out = _PyUnicode_Copy(dtstr);
| ^~~~~~~~~~~~~~~
| PyUnicode_Count
backports/datetime_fromisoformat/_datetimemodule.c:795:25: error: initialization of ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
error: command '/usr/bin/gcc' 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)

@eprbell
Copy link
Owner

eprbell commented Dec 26, 2024

I'm not sure: it sounds like a system specific issue. Here's something suggested by AI:

The follow-up message indicates that installing python3-devel partially addressed the issue, but there's a new compilation error related to the backports-datetime-fromisoformat dependency.
Here's how to tackle this new error:
Error Analysis:

  • The error messages point to issues within the backports-datetime-fromisoformat C code specifically in the function _sanitize_isoformat_str.

  • The errors are related to:

    • Implicit declaration of _PyUnicode_Copy function (likely a missing header file).
    • Incorrect initialization of a variable with an integer value (needs casting).
      Potential Solutions:
  • Try Reinstalling backports-datetime-fromisoformat:
    Sometimes reinstalling the package can resolve issues with missing dependencies. Run the following command:
    pip install --force-reinstall backports-datetime-fromisoformat

  • Check for Missing Header Files:
    The error suggests a missing header file for Unicode functions. Try installing additional development packages that might provide the missing header:
    sudo dnf install python3-devel python3-tkinter # Additional development libraries

  • Consider Building from Source (Advanced):
    If the above solutions don't work, you might need to build backports-datetime-fromisoformat from source. This involves downloading the source code and compiling it manually. It's a more advanced approach and might require additional troubleshooting depending on your system configuration. Refer to the project's documentation for build instructions (if available).
    Additional Tips:

  • Search online forums for solutions related to building backports-datetime-fromisoformat on Fedora with Python 3.13.1.

@tsips7621
Copy link

This error comes from backports-datetime-fromisoformat, not dali-rp2. It's a C compilation error that originates from gcc making implicit cast conversions an error. You can compile it with by setting the CFLAGS environment variable to include -fpermissive. See gcc's documentation on -Wint-conversion, https://man.archlinux.org/man/gcc.1#Wno~62.

@eprbell
Copy link
Owner

eprbell commented Dec 27, 2024

I tried installing DaLI from scratch on my Mac (OSX 15.1) and I'm getting the same problem. Sounds like the solution might be to install backports-datetime-fromisoformat from source with CFLAGS including -fpermissive, as suggested by @tsips7621.

I tried passing -fpermissive using --global-option, but it's now deprecated:
pip install --global-option='-fpermissive' backports-datetime-fromisoformat

issues the following message:

DEPRECATION: --build-option and --global-option are deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to use --config-settings. Discussion can be found at https://github.com/pypa/pip/issues/11859

I also opened an issue for them.

@eprbell
Copy link
Owner

eprbell commented Dec 27, 2024

I opened PR #274 to remove the backports-datetime-fromisoformat dependency from DaLI (it's only needed on Python <= 3.10, so we can just drop support for older Python versions). While the PR is not yet passing CI, it should be good enough to get past this problem: feel free to patch it into the code and try again.

@eprbell
Copy link
Owner

eprbell commented Dec 28, 2024

The issue has been resolved upstream in backports.datetime_fromisoformat: installing DaLI now works again.

@eprbell
Copy link
Owner

eprbell commented Dec 29, 2024

The issue is fixed in the top of the tree, but I can't cut a new release due to some new (unrelated) failures in ccxt tests: see https://github.com/eprbell/dali-rp2/actions/runs/12532067572/job/34950420199.

Reopening and assigning to @macanudo527 to take a look at the test error. Once that is fixed we can cut a new release.

@macanudo527
Copy link
Collaborator

@eprbell I'll be away for another week or two. I think the vcr responses might just need to be recorded again.

Have you tried deleting them and seeing if the tests pass? Then run the test again with the vcr tapes? If that doesn't work I'll take a look at it as soon as I can.

@eprbell
Copy link
Owner

eprbell commented Dec 29, 2024

I'm not sure how that works: can you point me to how to record responses again? I tried deleting the tests/cassettes directory but the tests still fail in the same way. The workaround right now is to use the top of the tree version by cloning from Github: in the worst case we'll fix it when you're back and we'll cut the release then.

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

4 participants