facebook / pyre-check

Performant type-checking for python.
https://pyre-check.org/
MIT License
6.85k stars 437 forks source link

Pyre exited with non-zero return code: 1 #918

Open Victor725 opened 1 month ago

Victor725 commented 1 month ago

Pysa Bug

Pre-submission checklist [ ] I've checked the list of common issues and mine does not appear

Bug description When I run "pyre analyze --no-verify --save-results-to ./pysa-runs", an error occured: image

Reproduction steps I cd to my project dir, and run "pyre init-pysa" image then"pyre analyze --no-verify --save-results-to ./pysa-runs", the bug above reported image

Logs Please run your reproduction steps with --noninteractive (eg. pyre --noninteractive analyze) and paste the output here:

(pyre) root@74b85d172796:/workdir/salt-3002.4# pyre --noninteractive analyze
2024-09-11 01:41:46,835 [PID 59] INFO No binary specified, looking for `pyre.bin` in PATH
2024-09-11 01:41:46,835 [PID 59] INFO Pyre binary is located at `/root/.venvs/pyre/bin/pyre.bin`
2024-09-11 01:41:46,837 [PID 59] INFO Could not determine the number of Pyre workers from configuration. Auto-set the value to 9.
2024-09-11 01:41:46,838 [PID 59] INFO No typeshed specified, looking for it...
2024-09-11 01:41:46,838 [PID 59] INFO Found: `/root/.venvs/pyre/lib/pyre_check/typeshed`
2024-09-11 01:41:46,839 [PID 59] INFO Writing arguments into /tmp/pyre_arguments_12hyaivh.json...
2024-09-11 01:41:46,839 [PID 59] DEBUG Arguments:
{
  "source_paths": {
    "kind": "simple",
    "paths": [
      "/workdir/salt-3002.4"
    ]
  },
  "search_paths": [
    "/root/.venvs/pyre/lib/python3.12/site-packages$testslide",
    "/root/.venvs/pyre/lib/python3.12/site-packages$click",
    "/root/.venvs/pyre/lib/python3.12/site-packages$dataclasses_json",
    "/root/.venvs/pyre/lib/python3.12/site-packages$typeguard",
    "/root/.venvs/pyre/lib/python3.12/site-packages$pip",
    "/root/.venvs/pyre/lib/python3.12/site-packages$marshmallow",
    "/root/.venvs/pyre/lib/python3.12/site-packages$libcst",
    "/root/.venvs/pyre/lib/python3.12/site-packages$packaging",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stdlib",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/ExifRead",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/Pillow",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/PyMySQL",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/PyYAML",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/aiofiles",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/boto",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/chevron",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/colorama",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/ldap3",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/mysqlclient",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/paramiko",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/psycopg2",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/pycurl",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/python-dateutil",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/pytz",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/regex",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/requests",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/retry",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/tqdm",
    "/root/.venvs/pyre/lib/pyre_check/typeshed/stubs/ujson"
  ],
  "excludes": [],
  "checked_directory_allowlist": [
    "/workdir/salt-3002.4"
  ],
  "checked_directory_blocklist": [],
  "extensions": [],
  "log_path": "/workdir/salt-3002.4/.pyre",
  "global_root": "/workdir/salt-3002.4",
  "debug": false,
  "python_version": {
    "major": 3,
    "minor": 12,
    "micro": 5
  },
  "shared_memory": {},
  "parallel": true,
  "number_of_workers": 9,
  "inline_decorators": false,
  "infer_self_tito": false,
  "infer_argument_tito": false,
  "no_verify": false,
  "verify_dsl": false,
  "verify_taint_config_only": false,
  "strict": false,
  "taint_model_paths": [
    "/root/.venvs/pyre/lib/pyre_check/taint",
    "/root/.venvs/pyre/lib/pyre_check/third_party_taint"
  ],
  "use_cache": false,
  "build_cache_only": false,
  "check_invariants": false,
  "limit_entrypoints": false,
  "compact_ocaml_heap": false,
  "saved_state": {
    "watchman_root": null,
    "project_name": null,
    "preset": null,
    "cache_critical_files": []
  },
  "compute_coverage": false
}
2024-09-11 01:41:46,841 [PID 59] ERROR Pyre exited with non-zero return code: 1.

Additional context I used default stubs

arthaud commented 1 month ago

Hi @Victor725,

My guess is that it's an architecture problem, but let's confirm it. Could you run the following commands and give me the output:

Victor725 commented 1 month ago

ok! image emmm.... it seems some important libs are missing, is that the main reason? By the way, I run pysa in a docker container, does it matter?

arthaud commented 1 month ago

It looks like we are building pyre with a version of glibc that cannot be found on your system. You might be using an operating system (within the docker container) that is either too old or too recent. Which operating system is that?

Victor725 commented 1 month ago

I build the docker container upon ubuntu:18.04, maybe I need to try 20.04 or 22.04? here's my dockerfile

FROM ubuntu:18.04

SHELL [ "/bin/bash", "-c" ]

ENV SHELL=/bin/bash

RUN apt update &&\
    apt install -y git curl build-essential python3 python3-pip python3-venv

RUN curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh > ./install_brew.sh &&\
    chmod +x ./install_brew.sh &&\
    NONINTERACTIVE=1 ./install_brew.sh

#RUN (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.bashrc
#RUN eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
ENV PATH=/home/linuxbrew/.linuxbrew/bin:$PATH

RUN brew install watchman

RUN python3 -m venv ~/.venvs/pyre &&\
    source ~/.venvs/pyre/bin/activate &&\
    pip install pyre-check
arthaud commented 1 month ago

yes, 18.04 is definitely too old. Please try 22.04 or above.

Victor725 commented 1 month ago

OK, thank you very much :)