bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.38k stars 388 forks source link

SyntaxError: invalid decimal literal #433

Open syheliel opened 8 months ago

syheliel commented 8 months ago

How to reproduce

git clone https://github.com/NVIDIA/cccl.git
cd cccl
pipreqs .

error msg

ERROR: Failed on file: ./libcudacxx/libcxx/utils/generate_feature_test_macro_components.py
Traceback (most recent call last):
  File "/home/xxx/miniforge3/envs/cupy/bin/pipreqs", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/xxx/miniforge3/envs/cupy/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 528, in main
    init(args)
  File "/home/xxx/miniforge3/envs/cupy/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 455, in init
    candidates = get_all_imports(input_path,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/miniforge3/envs/cupy/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 131, in get_all_imports
    raise exc
  File "/home/xxx/miniforge3/envs/cupy/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 117, in get_all_imports
    tree = ast.parse(contents)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/miniforge3/envs/cupy/lib/python3.12/ast.py", line 52, in parse
    return compile(source, filename, mode, flags,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<unknown>", line 36
    "c++14": 201304L
                  ^
vishalnandagopal commented 7 months ago

Try upgrading pipreqs, they seemed to have fixed the UTF-8 issue.

pip install pipreqs --upgrade --no-deps
pip install yarg==0.1.9 docopt==0.6.2

This avoids the tons of unnecessary jupyter notebook modules.