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

Adds a minimal pyproject.toml file #62

Closed
wants to merge 1 commit into from
Closed

Conversation

cdeln
Copy link

@cdeln cdeln commented Dec 8, 2022

Solves #30
Using pyproject.toml solves the bootstrap problem with Cython and makes the project build in isolation, as required by certain build systems (e.g. poetry).

@kylebgorman
Copy link
Owner

Thanks @cdeln. I have never been able to actually replicate #30 so this does help. I also don't really understand the PEP 518 rationale, but I guess that's the way things are headed.

We can't accept outside contributions here (this is just a mirror of code developed internally) but I will study your solution and work something similar into the next release.

@cdeln
Copy link
Author

cdeln commented Dec 8, 2022

Yeah, the Python distribution ecosystem is a bit of a mess, with multiple systems supported at the same time. I see, I'll keep an eye open for a fix into the next release, and use my fork in the meantime to make my project build. Ping me if you want testing of the package (as seen from a package consumer, I can try it out in my project), prior to next release.
Btw it's pretty easy to replicate #30, just create a new virtual env and run pip install . in the repo. In the fresh virtual env you wouldn't have Cython installed, so it fails when trying to import it in setup.py.

@kylebgorman
Copy link
Owner

Yeah, the Python distribution ecosystem is a bit of a mess, with multiple systems supported at the same time. I see, I'll keep an eye open for a fix into the next release, and use my fork in the meantime to make my project build. Ping me if you want testing of the package (as seen from a package consumer, I can try it out in my project), prior to next release.

Will do.

@alealv
Copy link

alealv commented Mar 20, 2023

It still fails for me because it doesn't downloads openFST

╰─ pip install pynini
Collecting pynini
  Using cached pynini-2.1.5.tar.gz (627 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Cython>=0.29 in /Users/aalvarez/.pyenv/versions/test/lib/python3.11/site-packages (from pynini) (0.29.33)
Installing collected packages: pynini
  DEPRECATION: pynini is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for pynini ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pynini did not run successfully.
  │ exit code: 1
  ╰─> [57 lines of output]
      running install
      /Users/aalvarez/.pyenv/versions/test/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-13.2-x86_64-cpython-311
      creating build/lib.macosx-13.2-x86_64-cpython-311/pywrapfst
      copying pywrapfst/__init__.py -> build/lib.macosx-13.2-x86_64-cpython-311/pywrapfst
      creating build/lib.macosx-13.2-x86_64-cpython-311/pynini
      copying pynini/__init__.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini
      creating build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/chatspeak.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/chatspeak_model.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/weather.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/__init__.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/numbers.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/plurals.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/t9.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/case.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/dates.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/examples/g2p.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      creating build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/edit_transducer.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/utf8.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/__init__.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/features.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/pynutil.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/paradigms.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/tagger.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/rule_cascade.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/rewrite.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/lib/byte.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      creating build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pynini/export/__init__.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pynini/export/export.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pynini/export/multi_grm_example.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pynini/export/multi_grm.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pynini/export/grm.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pynini/export/grm_example.py -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      copying pywrapfst/__init__.pyi -> build/lib.macosx-13.2-x86_64-cpython-311/pywrapfst
      copying pywrapfst/py.typed -> build/lib.macosx-13.2-x86_64-cpython-311/pywrapfst
      copying pynini/__init__.pyi -> build/lib.macosx-13.2-x86_64-cpython-311/pynini
      copying pynini/py.typed -> build/lib.macosx-13.2-x86_64-cpython-311/pynini
      copying pynini/examples/py.typed -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/examples
      copying pynini/lib/py.typed -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/lib
      copying pynini/export/py.typed -> build/lib.macosx-13.2-x86_64-cpython-311/pynini/export
      running build_ext
      building '_pywrapfst' extension
      creating build/temp.macosx-13.2-x86_64-cpython-311
      creating build/temp.macosx-13.2-x86_64-cpython-311/extensions
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode-14.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode-14.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/aalvarez/.pyenv/versions/test/include -I/Users/aalvarez/.pyenv/versions/3.11.2/include/python3.11 -c extensions/_pywrapfst.cpp -o build/temp.macosx-13.2-x86_64-cpython-311/extensions/_pywrapfst.o -std=c++17 -Wno-register -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-local-typedefs -funsigned-char -stdlib=libc++ -mmacosx-version-min=10.7
      extensions/_pywrapfst.cpp:815:10: fatal error: 'fst/util.h' file not found
      #include <fst/util.h>
               ^~~~~~~~~~~~
      1 error 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: legacy-install-failure

× Encountered error while trying to install package.
╰─> pynini

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

@kylebgorman
Copy link
Owner

kylebgorman commented Mar 20, 2023 via email

@alealv
Copy link

alealv commented Mar 20, 2023

Update

Just some hours ago I was able to installed from wheel. Problem was that python version isn't specified in project.toml
My environment had python 3.11.2 and there is no wheel yet for that version, so it was trying to build from source.

Sorry for the confusion

@kylebgorman
Copy link
Owner

Addressed in #71.

@kylebgorman kylebgorman closed this Nov 2, 2023
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

Successfully merging this pull request may close these issues.

3 participants