aburrell / apexpy

A Python wrapper for Apex coordinates
MIT License
34 stars 25 forks source link

BUG: Issues installing apexpy in python 3.12 #135

Open ljlamarche opened 5 months ago

ljlamarche commented 5 months ago

Describe the bug

Apexpy fails to install in a new python python 3.12 environment. The traceback (provided in full below) suggests this is the main error

ERROR: Could not build wheels for libcst, which is required to install pyproject.toml-based projects

and it may be related to there not being a Rust compiler available.

To Reproduce

  1. Create new python 3.12 environment
  2. pip install apexpy

Expected behavior

Sucessful installation of apexpy.

Traceback

Full traceback (long): apexpy_traceback.txt Most relevant portion:

            writing libcst.egg-info/PKG-INFO
            writing dependency_links to libcst.egg-info/dependency_links.txt
            writing requirements to libcst.egg-info/requires.txt
            writing top-level names to libcst.egg-info/top_level.txt
            ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any
            reading manifest file 'libcst.egg-info/SOURCES.txt'
            reading manifest template 'MANIFEST.in'
            warning: no previously-included files matching '*' found under directory 'native/target'
            adding license file 'LICENSE'
            writing manifest file 'libcst.egg-info/SOURCES.txt'
            /private/var/folders/yf/c17s54f12c1bg0cxdywsxyxjssh4z4/T/pip-build-env-b976c0mm/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:215: _Warning: Package 'libcst.tests.pyre' is absent from the `packages` configuration.
            !!

                    ********************************************************************************
                    ############################
                    # Package would be ignored #
                    ############################
                    Python recognizes 'libcst.tests.pyre' as an importable package[^1],
                    but it is absent from setuptools' `packages` configuration.

                    This leads to an ambiguous overall configuration. If you want to distribute this
                    package, please make sure that 'libcst.tests.pyre' is explicitly added
                    to the `packages` configuration field.

                    Alternatively, you can also rely on setuptools' discovery methods
                    (for example by using `find_namespace_packages(...)`/`find_namespace:`
                    instead of `find_packages(...)`/`find:`).

                    You can read more about "package discovery" on setuptools documentation page:

                    - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

                    If you don't want 'libcst.tests.pyre' to be distributed and are
                    already explicitly excluding 'libcst.tests.pyre' via
                    `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
                    you can try to use `exclude_package_data`, or `include-package-data=False` in
                    combination with a more fine grained `package-data` configuration.

                    You can read more about "package data files" on setuptools documentation page:

                    - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

                    [^1]: For Python, any directory (with suitable naming) can be imported,
                          even if it does not contain any `.py` files.
                          On the other hand, currently there is no concept of package data
                          directory, all directories are treated like packages.
                    ********************************************************************************

            !!
              check.warn(importable)
            copying libcst/py.typed -> build/lib.macosx-11.0-arm64-cpython-312/libcst
            creating build/lib.macosx-11.0-arm64-cpython-312/libcst/tests/pyre
            copying libcst/tests/pyre/.pyre_configuration -> build/lib.macosx-11.0-arm64-cpython-312/libcst/tests/pyre
            copying libcst/tests/pyre/simple_class.json -> build/lib.macosx-11.0-arm64-cpython-312/libcst/tests/pyre
            copying libcst/tests/pyre/simple_class.py -> build/lib.macosx-11.0-arm64-cpython-312/libcst/tests/pyre
            copying libcst/_parser/conversions/README.md -> build/lib.macosx-11.0-arm64-cpython-312/libcst/_parser/conversions
            copying libcst/codemod/tests/codemod_formatter_error_input.py.txt -> build/lib.macosx-11.0-arm64-cpython-312/libcst/codemod/tests
            running build_ext
            running build_rust
            error: can't find Rust compiler

            If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

            To update pip, run:

                pip install --upgrade pip

            and then retry package installation.

            If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for libcst
      Failed to build libcst
      ERROR: Could not build wheels for libcst, which is required to install pyproject.toml-based projects

Computer

aburrell commented 3 weeks ago

When fixed, update docs/installation.rst.

warrickball commented 1 week ago

In case it's useful, I just ran into this myself and managed to install apexpy on Python 3.12 on Fedora 40 after installing rust and cargo from my package manager (dnf).

I haven't run the code at all, other than running import apexpy successfully.