Skip to content

Infinite loading #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nrydanov opened this issue Oct 16, 2024 · 20 comments
Open

Infinite loading #110

nrydanov opened this issue Oct 16, 2024 · 20 comments

Comments

@nrydanov
Copy link

nrydanov commented Oct 16, 2024

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?

@nrydanov nrydanov changed the title Infinite loading Infinite loading in Neovim Oct 16, 2024
@nrydanov nrydanov changed the title Infinite loading in Neovim Infinite loading Oct 17, 2024
@ohseunghyeon
Copy link

+2

@BrunoMarinhoM
Copy link

BrunoMarinhoM commented Oct 17, 2024

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
Copy link

agrin96 commented Oct 18, 2024

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

@nrydanov
Copy link
Author

nrydanov commented Oct 18, 2024

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

@ethanthoma
Copy link

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
Copy link
Author

@mtshiba Still reproduces on v0.0.67

@agrin96
Copy link

agrin96 commented Oct 19, 2024

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
Copy link

Same problem version 0.67.0 and 0.68.0 too

@nrydanov
Copy link
Author

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

@nrydanov
Copy link
Author

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
Copy link

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
Copy link
Owner

mtshiba commented Nov 4, 2024

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
Copy link

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
Copy link
Author

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
Copy link

artkpv commented Nov 20, 2024

Same issue here. See #83 (comment)

@Dronakurl
Copy link

It's the same here.

Here is to reproduce:
cargo install pylyzer --locked

Now run it on a single file

pylyzer p.py

# p.py
import numpy as np


def wurst(xx: list[str]):
    print("wurst" + xx)
    print(np.array([1, 2, 3]))

wurst("hu")

Without the numpy part, pylyzer works and reports the type issues. In neovim, I can use "goto definition".
With the numpy part, it takes forever

Ubuntu 24.04
pylyzer 0.0.72
python 3.12

Maybe it's because I use uv and have the virtual environment in the same folder in .venv and it tries to analyze the whole numpy codebase. (Just a wild guess)

@JackKelly
Copy link

I'm sorry to bring bad news but I'm afraid that I'm experiencing the same problem: pylyzer seems stuck in an infinite loop (using 1 CPU core at 100%) "checking files" in a small Python project that uses a uv venv.

(But I'm very excited about pylyzer!)

@nrydanov
Copy link
Author

@mtshiba
Still reproduces on v0.0.76

@ak4nv
Copy link

ak4nv commented Jan 5, 2025

The same here from me...

pylyzer version is 0.0.76
tried to use in Sublime as additional LSP server.

One thread of the process uses CPU 100%....
The message in the status is always "Checking files..." and nothing works properly.

// Settings in here override those in "LSP/LSP.sublime-settings"
{
	"clients": {
		"pylyzer": {
			// https://mtshiba.github.io/pylyzer/options/pyproject/
			"command": [
				"/usr/bin/pylyzer",
				// "--hurry",
				"--verbose",
				"2",
				"--server"
			],
			"enabled": false,
			"settings": {
				"python.path": ".venv/bin/python",
			},
			"selector": "source.python",
		},
	},
}

Here is the log from server (removed text of python files)

:: [19:20:14.969] --> pylyzer initialize (1): {'processId': 3746, 'clientInfo': {'name': 'Sublime Text LSP', 'version': '2.3.0'}, 'rootUri': 'file:///home/ak4nv/projects/air-scheduler', 'rootPath': '/home/ak4nv/projects/air-scheduler', 'workspaceFolders': [{'name': 'air-scheduler', 'uri': 'file:///home/ak4nv/projects/air-scheduler'}], 'capabilities': {'general': {'regularExpressions': {'engine': 'ECMAScript'}, 'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}}, 'textDocument': {'synchronization': {'dynamicRegistration': True, 'didSave': True, 'willSave': True, 'willSaveWaitUntil': True}, 'hover': {'dynamicRegistration': True, 'contentFormat': ['markdown', 'plaintext']}, 'completion': {'dynamicRegistration': True, 'completionItem': {'snippetSupport': True, 'deprecatedSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'tagSupport': {'valueSet': [1]}, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'insertReplaceSupport': True, 'insertTextModeSupport': {'valueSet': [2]}, 'labelDetailsSupport': True}, 'completionItemKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}, 'insertTextMode': 2, 'completionList': {'itemDefaults': ['editRange', 'insertTextFormat', 'data']}}, 'signatureHelp': {'dynamicRegistration': True, 'contextSupport': True, 'signatureInformation': {'activeParameterSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'parameterInformation': {'labelOffsetSupport': True}}}, 'references': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'documentSymbol': {'dynamicRegistration': True, 'hierarchicalDocumentSymbolSupport': True, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, 'tagSupport': {'valueSet': [1]}}, 'documentLink': {'dynamicRegistration': True, 'tooltipSupport': True}, 'formatting': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True, 'rangesSupport': True}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'codeAction': {'dynamicRegistration': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.fixAll', 'source.organizeImports']}}, 'dataSupport': True, 'isPreferredSupport': True, 'resolveSupport': {'properties': ['edit']}}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True, 'prepareSupportDefaultBehavior': 1}, 'colorProvider': {'dynamicRegistration': True}, 'publishDiagnostics': {'relatedInformation': True, 'tagSupport': {'valueSet': [1, 2]}, 'versionSupport': True, 'codeDescriptionSupport': True, 'dataSupport': True}, 'diagnostic': {'dynamicRegistration': True, 'relatedDocumentSupport': True}, 'selectionRange': {'dynamicRegistration': True}, 'foldingRange': {'dynamicRegistration': True, 'foldingRangeKind': {'valueSet': ['comment', 'imports', 'region']}}, 'codeLens': {'dynamicRegistration': True}, 'inlayHint': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['textEdits', 'label.command']}}, 'semanticTokens': {'dynamicRegistration': True, 'requests': {'range': True, 'full': {'delta': True}}, 'tokenTypes': ['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator', 'label'], 'tokenModifiers': ['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'], 'formats': ['relative'], 'overlappingTokenSupport': False, 'multilineTokenSupport': True, 'augmentsSyntaxTokens': True}, 'callHierarchy': {'dynamicRegistration': True}, 'typeHierarchy': {'dynamicRegistration': True}}, 'workspace': {'applyEdit': True, 'didChangeConfiguration': {'dynamicRegistration': True}, 'executeCommand': {}, 'workspaceEdit': {'documentChanges': True, 'failureHandling': 'abort'}, 'workspaceFolders': True, 'symbol': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['location.range']}, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, 'tagSupport': {'valueSet': [1]}}, 'configuration': True, 'codeLens': {'refreshSupport': True}, 'inlayHint': {'refreshSupport': True}, 'semanticTokens': {'refreshSupport': True}, 'diagnostics': {'refreshSupport': True}}, 'window': {'showDocument': {'support': True}, 'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'workDoneProgress': True}}, 'initializationOptions': {}}
:: [19:20:14.978] <<< pylyzer (1) (duration: 9ms): {'capabilities': {'callHierarchyProvider': True, 'codeActionProvider': {'codeActionKinds': ['quickfix', 'refactor'], 'resolveProvider': True}, 'codeLensProvider': {'resolveProvider': False}, 'completionProvider': {'resolveProvider': True, 'triggerCharacters': ['.', ':', '(', ' ']}, 'definitionProvider': True, 'documentHighlightProvider': True, 'documentLinkProvider': {'resolveProvider': False}, 'documentSymbolProvider': True, 'executeCommandProvider': {'commands': ['pylyzer.eliminate_unused_vars']}, 'foldingRangeProvider': True, 'hoverProvider': True, 'implementationProvider': True, 'inlayHintProvider': {'resolveProvider': True}, 'referencesProvider': True, 'renameProvider': True, 'selectionRangeProvider': True, 'semanticTokensProvider': {'full': True, 'legend': {'tokenModifiers': [], 'tokenTypes': ['namespace', 'type', 'class', 'interface', 'typeParameter', 'parameter', 'variable', 'property', 'function', 'method', 'string', 'number', 'operator']}, 'range': False}, 'signatureHelpProvider': {'triggerCharacters': ['(', ',', '|']}, 'typeDefinitionProvider': True, 'workspace': {'fileOperations': {'willRename': {'filters': [{'pattern': {'glob': '**/*.{er,py}', 'matches': 'file'}, 'scheme': 'file'}, {'pattern': {'glob': '**', 'matches': 'folder'}, 'scheme': 'file'}]}}, 'workspaceFolders': {'changeNotifications': True, 'supported': True}}, 'workspaceSymbolProvider': True, 'textDocumentSync': {'change': {'syncKind': 2}, 'didOpen': {}, 'didClose': {}, 'save': {}}}}
:: [19:20:14.978]  -> pylyzer initialized: {}
:: [19:20:14.978]  -> pylyzer workspace/didChangeConfiguration: {'settings': {'python': {'path': '.venv/bin/python'}}}
:: [19:20:14.978] <-- pylyzer workspace/configuration (10001): {'items': [{'section': 'files.autoSave'}]}
:: [19:20:14.981] >>> pylyzer (10001) (duration: 2ms): [None]
:: [19:20:14.984]  -> pylyzer textDocument/didOpen: <params with 17883 characters>
:: [19:20:14.984] --> pylyzer textDocument/documentLink (2): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/test.py'}}
:: [19:20:14.986]  -> pylyzer textDocument/didOpen: {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/vehicles.py', 'languageId': 'python', 'version': 0, 'text': '...'}}
:: [19:20:14.987] --> pylyzer textDocument/documentLink (3): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/vehicles.py'}}
:: [19:20:14.990]  -> pylyzer textDocument/didOpen: {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/aircraft.py', 'languageId': 'python', 'version': 0, 'text': '...'}}
:: [19:20:14.990] --> pylyzer textDocument/documentLink (4): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/aircraft.py'}}
:: [19:20:14.992]  -> pylyzer textDocument/didOpen: {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/run.py', 'languageId': 'python', 'version': 9, 'text': "..."}}
:: [19:20:14.993] --> pylyzer textDocument/documentLink (5): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/run.py'}}
:: [19:20:14.995]  -> pylyzer textDocument/didOpen: <params with 10775 characters>
:: [19:20:14.995] --> pylyzer textDocument/documentLink (6): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/utils/broker.py'}}
:: [19:20:14.997]  -> pylyzer textDocument/didOpen: <params with 23215 characters>
:: [19:20:14.997] --> pylyzer textDocument/documentLink (7): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/tracker.py'}}
:: [19:20:15.000]  -> pylyzer textDocument/didOpen: {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/persons.py', 'languageId': 'python', 'version': 0, 'text': '...'}}
:: [19:20:15.000] --> pylyzer textDocument/documentLink (8): {'textDocument': {'uri': 'file:///home/ak4nv/projects/air-scheduler/app/trackers/persons.py'}}
:: [19:20:15.003] <-- pylyzer workspace/configuration (10000): {'items': []}
:: [19:20:15.004] >>> pylyzer (10000) (duration: 1ms): []
:: [19:20:15.004] <-- pylyzer window/workDoneProgress/create (1): {'token': 'els/start_workspace_diagnostics'}
:: [19:20:15.004] >>> pylyzer (1) (duration: 0ms): None
:: [19:20:15.004] <-  pylyzer $/progress: {'token': 'els/start_workspace_diagnostics', 'value': {'kind': 'end', 'message': 'checked 0 files'}}
:: [19:20:15.004] <-- pylyzer window/workDoneProgress/create (1): {'token': 'checking files ...'}
:: [19:20:15.004] >>> pylyzer (1) (duration: 0ms): None
:: [19:20:15.004] <-  pylyzer $/progress: {'token': 'checking files ...', 'value': {'cancellable': False, 'kind': 'begin', 'percentage': 0, 'title': 'checking files ...'}}
:: [19:20:24.988] <-- pylyzer workspace/configuration (10000): {'items': []}
:: [19:20:24.989] >>> pylyzer (10000) (duration: 1ms): []
:: [19:20:34.989] <-- pylyzer workspace/configuration (10000): {'items': []}
:: [19:20:34.989] >>> pylyzer (10000) (duration: 0ms): []
:: [19:20:44.989] <-- pylyzer workspace/configuration (10000): {'items': []}
:: [19:20:44.989] >>> pylyzer (10000) (duration: 0ms): []
:: [19:20:54.989] <-- pylyzer workspace/configuration (10000): {'items': []}
:: [19:20:54.990] >>> pylyzer (10000) (duration: 0ms): []
:: [19:21:03.568] --> pylyzer shutdown (9): None
:: [19:21:04.989] <-- pylyzer workspace/configuration (10000): {'items': []}
:: [19:21:04.989] >>> pylyzer (10000) (duration: 0ms): []

@Hohnik
Copy link

Hohnik commented Jan 27, 2025

I have the same problem but have narrowed it down to a Numpy, Erg compiler or Venv problem

  1. If I use pylyzer without having numpy installed its never a problem. ✅
  2. If I use pylyzer having numpy installed but no imports in my main.py file its no problem either. ✅
  3. If I use pylyzer having requests installed and imported its working ✅
  4. If I use pylyzer having matplotlib installed (depends on numpy) and imported its no longer working ❌
  5. If I use pylyzer having pytorch installed (depends on numpy) and imported its no longer working ❌
  6. If I use pylyzer having numpy installed and imported its no longer working ❌

The moment numpy is being loaded by pylyzer its no longer working.

Error messages for 4th, 5th and 6th test:

Start checking: main.py
thread 'numpy' panicked at /Users/niklas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/erg_compiler-0.6.52-nightly.0/ty/mod.rs:2405:13:
tys is empty
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'matplotlib/pyplot' has overflowed its stack
fatal runtime error: stack overflow
[1]    32911 abort      pylyzer main.py
Start checking: main.py
thread 'sympy/core/cache' panicked at /Users/niklas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/erg_compiler-0.6.52-nightly.0/context/compare.rs:362:9:
recursion limit exceed: structural_supertype_of(Never, ?U or ?T)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'calculus/optimization' panicked at /Users/niklas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/erg_compiler-0.6.52-nightly.0/context/compare.rs:362:9:
recursion limit exceed: structural_supertype_of({.__div__ = (self: Never, ?R) -> ?O}, Obj)
thread 'pythonmpq' panicked at /Users/niklas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/erg_compiler-0.6.52-nightly.0/context/compare.rs:362:9:
recursion limit exceed: structural_supertype_of(List(Type, ?N), List(Type, 2))

thread 'conflict' has overflowed its stack
fatal runtime error: stack overflow
[1]    33079 abort      pylyzer main.py
Start checking: main.py
thread 'numpy' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/erg_compiler-0.6.52-nightly.0/ty/mod.rs:2405:13:
tys is empty
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Found 12 warnings: main.py

Versions:

  • Python==3.12.7
  • Numpy==2.2.2
  • Cargo==1.84.0
  • Erg==0.6.51
  • UV==0.5.24

System:

  • Macbook Pro M1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests