Skip to content
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

npx version error #56

Closed
Plachey opened this issue Apr 26, 2022 · 10 comments · Fixed by #77
Closed

npx version error #56

Plachey opened this issue Apr 26, 2022 · 10 comments · Fixed by #77
Labels
question Further information is requested

Comments

@Plachey
Copy link

Plachey commented Apr 26, 2022

Hello, I use python 3.8, pyright 1.1.239
config.toml

[tool.pyright]
pythonVersion = "3.8"
pythonPlatform = "Linux"
reportPrivateImportUsage = false
python.analysis.useLibraryCodeForTypes = true

docker-compose where start pyright but i got error:

File "/usr/local/lib/python3.8/site-packages/pyright/node.py", line 121, in version
    raise errors.VersionCheckFailed(
pyright.errors.VersionCheckFailed: Could not find version from `npx --version`, see output above
npm notice 
npm notice New minor version of npm available! 8.6.0 -> 8.7.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.7.0>
npm notice Run `npm install -g npm@8.7.0` to update!
npm notice  

Can't fix it

@RobertCraigie
Copy link
Owner

@Plachey Is that the full output? The output of the npx --version command should be above that stack trace, is it there?

@RobertCraigie RobertCraigie added the question Further information is requested label Apr 26, 2022
@Plachey
Copy link
Author

Plachey commented Apr 26, 2022

@Plachey Is that the full output? The output of the npx --version command should be above that stack trace, is it there?

Here full

 
  | Traceback (most recent call last):
  |   File "/usr/local/bin/pyright", line 8, in <module>
  |     sys.exit(entrypoint())
  |   File "/usr/local/lib/python3.8/site-packages/pyright/cli.py", line 72, in entrypoint
  |     sys.exit(main(sys.argv[1:]))
  |   File "/usr/local/lib/python3.8/site-packages/pyright/cli.py", line 20, in main
  |     return run(*args, **kwargs).returncode
  |   File "/usr/local/lib/python3.8/site-packages/pyright/cli.py", line 36, in run
  |     npx = node.version('npx')
  |   File "/usr/local/lib/python3.8/site-packages/pyright/node.py", line 121, in version
  |     raise errors.VersionCheckFailed(
  | pyright.errors.VersionCheckFailed: Could not find version from `npx --version`, see output above
  | npm notice 
  | npm notice New minor version of npm available! 8.6.0 -> 8.7.0
  | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.7.0>
  | npm notice Run `npm install -g npm@8.7.0` to update!
  | npm notice 

@RobertCraigie
Copy link
Owner

@Plachey That is weird. Could you try setting the env variable PYRIGHT_PYTHON_DEBUG to 1. That'll show you some debug logs and where the node environment is installed to. Could you then try running the downloaded binary like so to see what that outputs, e.g. /tmp/pyright-python/bin/npx --version. Thanks

@Plachey
Copy link
Author

Plachey commented Apr 27, 2022

I did debug, but I'm not sure where use that /tmp/pyright-python/bin/npx --version

| 2022-04-27 05:22:10,583 - DEBUG - pyright.node - Checking for global target binary: npm
  | 2022-04-27 05:22:10,583 - DEBUG - pyright.node - Global target binary: npm not found
  | 2022-04-27 05:22:10,583 - DEBUG - pyright.node - Checking for nodeenv npm binary
  | 2022-04-27 05:22:10,583 - DEBUG - pyright.node - Environment not found at /tmp/pyright-python.root/env
  | 2022-04-27 05:22:10,583 - DEBUG - pyright.node - Installing nodeenv to /tmp/pyright-python.root/env
  | 2022-04-27 05:22:10,583 - DEBUG - pyright.node - Running command with args: ['/usr/local/bin/python', '-m', 'nodeenv', '/tmp/pyright-python.root/env']
  |  * Install prebuilt node (18.0.0) ..... done.
  | 2022-04-27 05:22:17,888 - DEBUG - pyright.node - Running node command with args: ['bash', '-c', '. /tmp/pyright-python.root/env/bin/activate && npm info pyright version']
  | 2022-04-27 05:22:20,045 - DEBUG - pyright.node - Version check for pyright returning 1.1.240
  | 2022-04-27 05:22:20,045 - DEBUG - pyright.node - Checking for global target binary: npx
  | 2022-04-27 05:22:20,045 - DEBUG - pyright.node - Global target binary: npx not found
  | 2022-04-27 05:22:20,045 - DEBUG - pyright.node - Checking for nodeenv npx binary
  | 2022-04-27 05:22:20,045 - DEBUG - pyright.node - Environment exists at /tmp/pyright-python.root/env
  | 2022-04-27 05:22:20,046 - DEBUG - pyright.node - Running node command with args: ['bash', '-c', '. /tmp/pyright-python.root/env/bin/activate && npx --version']
  | 2022-04-27 05:22:20,258 - DEBUG - pyright.node - Version check for npx returning (8, 6, 0)
  | 2022-04-27 05:22:20,258 - DEBUG - pyright.node - Checking for global target binary: npx
  | 2022-04-27 05:22:20,259 - DEBUG - pyright.node - Global target binary: npx not found
  | 2022-04-27 05:22:20,259 - DEBUG - pyright.node - Checking for nodeenv npx binary
  | 2022-04-27 05:22:20,259 - DEBUG - pyright.node - Environment exists at /tmp/pyright-python.root/env
  | 2022-04-27 05:22:20,259 - DEBUG - pyright.node - Running node command with args: ['bash', '-c', '. /tmp/pyright-python.root/env/bin/activate && npx --silent --yes pyright@1.1.240']
  | 2022-04-27 05:22:24,296 - DEBUG - pyright.node - Checking for global target binary: npm
  | 2022-04-27 05:22:24,296 - DEBUG - pyright.node - Found global binary at: /tmp/pyright-python.root/env/bin/npm
  | 2022-04-27 05:22:24,296 - DEBUG - pyright.node - Global binary exists at: /tmp/pyright-python.root/env/bin/npm
  | 2022-04-27 05:22:24,296 - DEBUG - pyright.node - Running node command with args: ['/tmp/pyright-python.root/env/bin/npm', 'info', 'pyright', 'version']
  | 
  | Traceback (most recent call last):
  |   File "/usr/local/bin/pyright", line 8, in <module>
  |     sys.exit(entrypoint())
  |   File "/usr/local/lib/python3.8/site-packages/pyright/cli.py", line 72, in entrypoint
  |     sys.exit(main(sys.argv[1:]))
  |   File "/usr/local/lib/python3.8/site-packages/pyright/cli.py", line 20, in main
  |     return run(*args, **kwargs).returncode
  |   File "/usr/local/lib/python3.8/site-packages/pyright/cli.py", line 28, in run
  |     version = node.latest('pyright')
  |   File "/usr/local/lib/python3.8/site-packages/pyright/node.py", line 145, in latest
  |     raise errors.VersionCheckFailed(
  | pyright.errors.VersionCheckFailed: Version check for pyright failed, see output above.```

@RobertCraigie
Copy link
Owner

@Plachey that error message seems to have changed. It's now saying that it couldn't find a version for pyright (by running the npm info pyright version command).

I'm not sure how to go about resolving this. Are you using a VPN?

@ultmaster
Copy link

I'm having the same issue.

Other than the error message above, I also had an error about GLIBC version. The solution is here: microsoft/pyright#3414.

@olatelnyx
Copy link

olatelnyx commented Jun 10, 2022

I am currently facing this same issue @RobertCraigie here's the log with debug turned on.

root@691b3d39624c:/app# pyright -p pyrightconfig-ci.json 
2022-06-10 17:22:24,668 - DEBUG - pyright.utils - Latest pyright-python version is: 1.1.253
2022-06-10 17:22:24,672 - DEBUG - pyright.node - Checking for global target binary: npx
2022-06-10 17:22:24,674 - DEBUG - pyright.node - Found global binary at: /usr/bin/npx
2022-06-10 17:22:24,674 - DEBUG - pyright.node - Global binary exists at: /usr/bin/npx
2022-06-10 17:22:24,675 - DEBUG - pyright.node - Running node command with args: ['/usr/bin/npx', '--version']
2022-06-10 17:22:27,575 - DEBUG - pyright.node - Version check for npx returning (8, 11, 0)
2022-06-10 17:22:27,576 - DEBUG - pyright.node - Checking for global target binary: npx
2022-06-10 17:22:27,578 - DEBUG - pyright.node - Found global binary at: /usr/bin/npx
2022-06-10 17:22:27,580 - DEBUG - pyright.node - Global binary exists at: /usr/bin/npx
2022-06-10 17:22:27,581 - DEBUG - pyright.node - Running node command with args: ['/usr/bin/npx', '--silent', '--yes', '--', 'pyright@1.1.253', '-p', 'pyrightconfig-ci.json']
2022-06-10 17:22:34,560 - DEBUG - pyright.utils - Latest pyright-python version is: 1.1.253
2022-06-10 17:22:34,563 - DEBUG - pyright.node - Checking for global target binary: npx
2022-06-10 17:22:34,564 - DEBUG - pyright.node - Found global binary at: /usr/bin/npx
2022-06-10 17:22:34,565 - DEBUG - pyright.node - Global binary exists at: /usr/bin/npx
2022-06-10 17:22:34,567 - DEBUG - pyright.node - Running node command with args: ['/usr/bin/npx', '--version']

Traceback (most recent call last):
  File "/usr/local/bin/pyright", line 8, in <module>
    sys.exit(entrypoint())
  File "/usr/local/lib/python3.10/site-packages/pyright/cli.py", line 72, in entrypoint
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/lib/python3.10/site-packages/pyright/cli.py", line 20, in main
    return run(*args, **kwargs).returncode
  File "/usr/local/lib/python3.10/site-packages/pyright/cli.py", line 36, in run
    npx = node.version('npx')
  File "/usr/local/lib/python3.10/site-packages/pyright/node.py", line 121, in version
    raise errors.VersionCheckFailed(
pyright.errors.VersionCheckFailed: Could not find version from `npx --version`, see output above

@RobertCraigie
Copy link
Owner

This is a bizarre issue, I have no idea what would be causing this. Something somewhere is causing a circular call as the version was successfully extracted earlier in those logs.

As I can't figure out what could be causing this, I think the solution here is to simply add an option to disable the version check.

@olatelnyx
Copy link

How can I disable the version check currently?

@RobertCraigie
Copy link
Owner

You currently cannot, sorry if I worded that badly. I will add an option to disable it :)

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

Successfully merging a pull request may close this issue.

4 participants