cryo icon indicating copy to clipboard operation
cryo copied to clipboard

Fail building with Poetry

Open albertocevallos opened this issue 1 year ago • 6 comments

Version Latest

Platform Linux

Description Installation via Poetry seems to fail.

I tried this code: poetry add cryo-python or poetry install (if the pkg was manually added to pyproject.toml)

I expected to see this happen: Successful installation and pkg added to pyproject.toml

Instead, this happened:

           Compiling cryo_freeze v0.2.0 (/private/var/folders/6m/hnbzzws969d7blnlbb51qp9w0000gn/T/pip-req-build-mnzq0bdu/local_dependencies/cryo_freeze)
           Compiling pyo3-polars v0.4.0
        error: environment variable `GIT_DESCRIPTION` not defined at compile time
          --> local_dependencies/cryo_cli/src/reports.rs:44:69
           |
        44 |     let cryo_version = format!("{}__{}", env!("CARGO_PKG_VERSION"), env!("GIT_DESCRIPTION"));
           |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^
           |
           = help: use `std::env::var("GIT_DESCRIPTION")` to read the variable at run time
           = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
        
        The following warnings were emitted during compilation:
        
        warning: Could not determine git description
        
        error: could not compile `cryo_cli` (lib) due to previous error
        warning: build failed, waiting for other jobs to finish...
        💥 maturin failed
          Caused by: Failed to build a native library through cargo
          Caused by: Cargo build finished with "exit status: 101": `MACOSX_DEPLOYMENT_TARGET="10.7" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.10-64bit" PYO3_PYTHON="/Users/Library/Caches/pypoetry/virtualenvs/ape-test-CVGu-StC-py3.10/bin/python" PYTHON_SYS_EXECUTABLE="/Users/Library/Caches/pypoetry/virtualenvs/ape-test-CVGu-StC-py3.10/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/var/folders/6m/hnbzzws969d7blnlbb51qp9w0000gn/T/pip-req-build-mnzq0bdu/Cargo.toml" "--release" "--lib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/cryo._cryo_rust.cpython-310-darwin.so"`
        Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/Users/Library/Caches/pypoetry/virtualenvs/ape-test-CVGu-StC-py3.10/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for cryo_python
  Failed to build cryo_python
  ERROR: Could not build wheels for cryo_python, which is required to install pyproject.toml-based projects
  
  [notice] A new release of pip available: 22.3.1 -> 23.2.1
  [notice] To update, run: pip install --upgrade pip
  

  at ~/.poetry/lib/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):

albertocevallos avatar Sep 07 '23 19:09 albertocevallos

the error printed is related to git not being available

can you install git (e.g. brew install git) and see if the command still fails?

sslivkoff avatar Sep 07 '23 20:09 sslivkoff

Had git installed, but ran brew reinstall git just in case and the command is still failing

Prob same as https://github.com/paradigmxyz/cryo/issues/27, building from source worked though

albertocevallos avatar Sep 07 '23 21:09 albertocevallos

did you install maturin separately?

dino-rodriguez avatar Sep 07 '23 21:09 dino-rodriguez

do you know if there is some reason why git might not be available to poetry during build time? I'm not a poetry user and am not familiar with how this issue might arrise

the problem is with this file that runs during the build process. the git command is attempted and for some reason fails, leading to the git warning

sslivkoff avatar Sep 07 '23 22:09 sslivkoff

so i found an interim solution

cloned the cryo repo in my working directory, ran maturin and added this to my pyproject.toml:

[tool.poetry.dependencies]
cryo-python = { file = "./cryo/target/wheels/cryo_python-0.2.0-cp310-cp310-macosx_10_7_x86_64.whl" }

btw @sslivkoff are you using venv or flit instead?

albertocevallos avatar Sep 08 '23 00:09 albertocevallos

seeing the same issue with hatch and adding cryo. could it be due to the latest on pypi being released before the fix in #30?

fmrmf avatar Sep 09 '23 18:09 fmrmf