pyroscope icon indicating copy to clipboard operation
pyroscope copied to clipboard

error: failed to get `ffikit` as a dependency of package `pyroscope_ffi v0.1.0`

Open surfer190 opened this issue 3 years ago • 4 comments

Environment:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G14042

$ python --version
Python 3.9.9

$ sysctl kern.version
kern.version: Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT 2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64

Attempting to install pyroscope gives:

$ pip install pyroscope-io
Collecting pyroscope-io
  Using cached pyroscope-io-0.8.0.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting milksnakex>=0.1.6
  Using cached milksnakex-0.1.6-py2.py3-none-any.whl (10 kB)
Collecting cffi>=1.6.0
  Using cached cffi-1.15.1-cp310-cp310-macosx_10_9_x86_64.whl (179 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: pyroscope-io
  Building wheel for pyroscope-io (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pyroscope-io (pyproject.toml) did not run successfully.
  │ exit code: 101
  ╰─> [25 lines of output]
      /private/var/folders/tz/lx2rh_nj1853_wlh5ypgn9l80000gn/T/pip-build-env-z5xila5r/overlay/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-310
      creating build/lib.macosx-10.9-universal2-cpython-310/pyroscope_io
      copying pyroscope_io/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/pyroscope_io
      creating build/lib.macosx-10.9-universal2-cpython-310/pyroscope
      copying pyroscope/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/pyroscope
          Updating git repository `https://github.com/omarabid/read-process-memory.git`
      error: failed to get `ffikit` as a dependency of package `pyroscope_ffi v0.1.0 (/private/var/folders/tz/lx2rh_nj1853_wlh5ypgn9l80000gn/T/pip-install-_tw2u9re/pyroscope-io_248ab0dc47d4422eaf9cf9f5a90c3285/lib)`
      
      Caused by:
        failed to load source for dependency `ffikit`
      
      Caused by:
        Unable to update /private/var/folders/tz/lx2rh_nj1853_wlh5ypgn9l80000gn/T/pip-install-_tw2u9re/ffikit
      
      Caused by:
        failed to read `/private/var/folders/tz/lx2rh_nj1853_wlh5ypgn9l80000gn/T/pip-install-_tw2u9re/ffikit/Cargo.toml`
      
      Caused by:
        No such file or directory (os error 2)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyroscope-io
Failed to build pyroscope-io
ERROR: Could not build wheels for pyroscope-io, which is required to install pyproject.toml-based projects

surfer190 avatar Dec 09 '22 18:12 surfer190

Hello! It looks like the build from source is indeed failing, which is masked on systems that can use the precompiled wheel. In an python:alpine container, apk add gcc g++ cargo git make libffi-dev && pip install pyroscope-io returns a similar error trace:

/ # pip install pyroscope-io
Collecting pyroscope-io
  Using cached pyroscope-io-0.8.0.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting milksnakex>=0.1.6
  Using cached milksnakex-0.1.6-py2.py3-none-any.whl (10 kB)
Collecting cffi>=1.6.0
  Using cached cffi-1.15.1-cp311-cp311-linux_aarch64.whl
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: pyroscope-io
  Building wheel for pyroscope-io (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyroscope-io (pyproject.toml) did not run successfully.
  │ exit code: 101
  ╰─> [25 lines of output]
      /tmp/pip-build-env-7ycmmh2r/overlay/lib/python3.11/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-311
      creating build/lib.linux-aarch64-cpython-311/pyroscope
      copying pyroscope/__init__.py -> build/lib.linux-aarch64-cpython-311/pyroscope
      creating build/lib.linux-aarch64-cpython-311/pyroscope_io
      copying pyroscope_io/__init__.py -> build/lib.linux-aarch64-cpython-311/pyroscope_io
          Updating git repository `https://github.com/omarabid/read-process-memory.git`
      error: failed to get `ffikit` as a dependency of package `pyroscope_ffi v0.1.0 (/tmp/pip-install-ovgx10sy/pyroscope-io_75efe3911e5c4c49b69a41610deb1e49/lib)`

      Caused by:
        failed to load source for dependency `ffikit`

      Caused by:
        Unable to update /tmp/pip-install-ovgx10sy/ffikit

      Caused by:
        failed to read `/tmp/pip-install-ovgx10sy/ffikit/Cargo.toml`

      Caused by:
        No such file or directory (os error 2)
      [end of output]

ffikit is an internal crate in the pyroscope-rs repository,

xvello avatar Dec 13 '22 14:12 xvello

I was wondering if you know how to resolve this installation error? Or does this simply mean Pyroscope currently cannot be installed on Windows/Python?

P.S.

  • I think it is trying to refer to a package at ../../ffikit, which I don't have on my system
  • Before, I got another "file not found" error. Must have been the Rust compiler that wasn't installed yet.

edwinvp avatar Dec 19 '22 15:12 edwinvp

I ran into this issue today. Like has been pointed out earlier, the source distribution relies on some source code which is not included in the distribution. First ffikit referenced at ../../ffikit, which does not exist in the distribution. Then ffikit Cargo.toml references pyroscope at ../../ which is not included as well.

I've found that the package can be successfully installed by pulling down the entire pyroscope-rs repository and installing the package from pyroscope-rs repository, as it contains all the necessary source.

I see built distributions exist for manylinux and macosx but none for windows. Until the build process is fixed I think building from source directly (instead of the sdist) is likely the only way for windows users to install pyroscope-io.

bmccool avatar Oct 24 '23 18:10 bmccool

Hey @bmccool , could you share how you're building the Python wheel from the repository? I'm struggling to navigate the repository and find where the Python bits are produced.

edit:

This seems to kind of do it's job, now I'm just stuck that it still won't build on alpine.

FROM python:3.13-alpine AS build_base
COPY --from=ghcr.io/astral-sh/uv:0.7.2 /uv /bin/uv

RUN apk add --no-cache git curl gcc musl-dev make
RUN (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y)
ENV PATH="/root/.cargo/bin:${PATH}"

# Build pyroscope-io from source, because of https://github.com/grafana/pyroscope/issues/1796#issuecomment-1777810359
RUN git clone https://github.com/grafana/pyroscope-rs --branch python-0.8.6
RUN --mount=type=cache,target=/root/.cargo/registry \
    --mount=type=cache,target=/root/.cargo/git \
    --mount=type=cache,target=/root/.cache/uv \
    cd pyroscope-rs/pyroscope_ffi/python && \
    uv run --no-project --with build make build && \
    mv dist /dist

NiklasRosenstein avatar May 07 '25 22:05 NiklasRosenstein