mtshiba / pylyzer

A fast, feature-rich static code analyzer & language server for Python
http://mtshiba.github.io/pylyzer/
MIT License
2.51k stars 33 forks source link

Infinite loading #110

Open nrydanov opened 1 month ago

nrydanov commented 1 month ago

Hello, thank you for adding virtual environment support.

I've just installed latest Pylyzer version from Cargo, added Pylyzer as source for nvim_lsp and I see infinite loading on "checking files...". However, it seems like using pylyzer on single file from terminal works fine.

Problem reproduces for VSCode too.

Useful information: Pylyzer: 0.0.66 OS: MacOS Sequoia 15.0.1 Python version: 3.10.13 Package manager: Rye/UV Processor: Apple M1

Any thoughts what can be wrong?

ohseunghyeon commented 1 month ago

+2

BrunoMarinhoM commented 1 month ago

Hey guys! I'm not a maintainer but I ran in a similar issue, turned out that running

$USER /path/to/pylyzer --server

Printed the following errors:

[ERR] ERG_PATH not found
[ERR] ERG_PATH not found
[ERR] ERG_PATH/lib/pystd not found
[ERR] ERG_PATH not found
[ERR] ERG_PATH/lib/core.d not found
[ERR] ERG_PATH not found
[ERR] ERG_PATH/lib/std not found

which was already solved in this issue

So I reinstalled it using the sistems package manager and it did exported the correct environment variables;

So, since you guys are on MacOS, I'd try using homebrew or following the solution on the issue I said:

If for some reason the files under lib cannot be installed, you can reinstall them using the following method.

  • pip reinstall
pip install --force-reinstall pylyzer
  • cargo reinstall
cargo install --force pylyzer
python3 <(curl -L https://github.com/mtshiba/ergup/raw/main/ergup.py)

Hope it helps

agrin96 commented 1 month ago

+3 the above solution with reinstalling did not work for me. Running pylyzer from cli is also stuck

nrydanov commented 1 month ago

Didn't helped for me too, Pylyzer is ok with finding env variables or libraries, but still fails to load.

ethanthoma commented 1 month ago

I'm having the same issue. I setup pylyzer through nix shell using 0.0.66 (I made an overlay for it). My CLI is also stuck in a loop forever.

nrydanov commented 1 month ago

@mtshiba Still reproduces on v0.0.67

agrin96 commented 1 month ago

Could problem be in using python 3.12 typing features? I've managed to show the parser produces a stack-overflow on my code and its all written with generics and 3.12 typing.

FahimAnayet commented 1 month ago

Same problem version 0.67.0 and 0.68.0 too

nrydanov commented 1 month ago

UPD. Some of my old projects using poetry works fine.

nrydanov commented 1 month ago

UPD 2. Found repo with Poetry, where error is still reproduces, so there's probably no dependency between package managers.

Also, if I remove .venv in any of these projects, Pylyzer is not stuck anymore. Looks like specific virtual environment state breaks pylyzer.

OliverGuy commented 1 month ago

I've been having similar issues; fixed the ERG_PATH not found through cargo install erg but still got the infinite loading in e.g. pylyzer app.py.

To debug this, I've pip installed different versions of pylyzer to try them on the same (miniconda) virtual environment and test file.

After trying out versions 0.0.53, 54, 55 and 56, I've tried switching back to the latest version of pylyzer, it now prints errors instead of hanging (it now fails to load modules, but that's another issue entirely) !

I'm assuming there's some sort of dependency or environment variable that used to be set via setup.py and didn't get unset when upgrading.

mtshiba commented 3 weeks ago

It seems that a bug in the Erg compiler was causing the checker to hang. I applied a patch to fix the issue and confirmed that it was fixed in some Python packages, but it is unclear whether the problem has been completely resolved.

jensenbox commented 2 weeks ago

Not great for a first experience:

christian@christian-desktop:/projects/core$ pip install pylyzer
Collecting pylyzer
  Downloading pylyzer-0.0.69-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)
Downloading pylyzer-0.0.69-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.5/12.5 MB 65.4 MB/s eta 0:00:00
Installing collected packages: pylyzer
Successfully installed pylyzer-0.0.69

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
christian@christian-desktop:/projects/core$ pylyzer
[ERR] ERG_PATH not found
[ERR] ERG_PATH not found
[ERR] ERG_PATH/lib/pystd not found 
[ERR] ERG_PATH not found
[ERR] ERG_PATH/lib/core.d not found 

Never completes, never does anything. Is there something I am missing here?

nrydanov commented 2 weeks ago

Sorry, but it still reproduces with UV. Analysis ends only for test.py file located in root folder.

All files in src folder are still hanged forever.

artkpv commented 6 days ago

Same issue here. See https://github.com/mtshiba/pylyzer/issues/83#issuecomment-2487887474