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

subprocess.CalledProcessError: Command '['/usr/local/bin/npm', 'install', '[email protected]']' returned non-zero exit status 217. #213

Open
copdips opened this issue Sep 25, 2023 · 4 comments

Comments

@copdips
Copy link

copdips commented Sep 25, 2023

Hello,

I'm running pyright in github action running on ubuntu-latest with python-version: 3.10.13, I got error when running pyright.
I did not get the error in every github action workflow run, sometimes OK and sometimes KO.

I installed pyright inside github action by pip install pyright without venv.

pip list shows the version of pyright installed:

pyright                     1.1.332
node version: v18.18.2
npm version: 9.8.1

my pre-commit yaml file:

- id: pyright
  name: pyright
  language: system
  entry: pyright
  types: [python]
  args:
    - "."

The error when running pre-commit in github action

pyright..................................................................Failed
- hook id: pyright
- exit code: 1

npm ERR! code ENOTEMPTY
npm ERR! syscall rmdir
npm ERR! path /home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stubs/openpyxl
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rmdir '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stubs/openpyxl'

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-10-23T21_24_58_527Z-debug-0.log
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright", line 8, in <module>
    sys.exit(entrypoint())
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright/cli.py", line 34, in entrypoint
    sys.exit(main(sys.argv[1:]))
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright/cli.py", line 19, in main
    return run(*args, **kwargs).returncode
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright/cli.py", line 25, in run
    pkg_dir = install_pyright(args, quiet=None)
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright/_utils.py", line 61, in install_pyright
    node.run(
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright/node.py", line 124, in run
    subprocess.run(node_args, env=env, **kwargs),
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/bin/npm', 'install', '[email protected]']' returned non-zero exit status 217.
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stdlib/__main__.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stdlib/_ast.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/service/_base_service.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stubs/html5lib/html5lib/_trie/_base.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stubs/google-cloud-ndb/google/cloud/ndb/_batch.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stdlib/_bisect.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stdlib/_bootlocale.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stubs/google-cloud-ndb/google/cloud/ndb/_cache.pyi'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/.cache/pyright-python/1.1.332/node_modules/pyright/dist/typeshed-fallback/stdlib/_codecs.pyi'
...many other npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory lines

checking the content of /home/runner/.cache folder (where $HOME is /home/runner), there's only a pip folder, but pip list shows that pyright is installed.

ls /home/runner/.cache/
pip

The strange thing is that home/runner/.cache/ folder has always only the pip sub folder, never has pright-python sub folder, but pyright during CICD sometimes works, and sometimes not.

hereunder the env vars during CICD:

PYRIGHT_PYTHON_CACHE_DIR: 
XDG_CACHE_HOME: 
HOME: /home/runner

do we have a way to show some debug logs to see how pyright interacts with /home/runner/.cache folder during pip install pyright ?

@copdips
Copy link
Author

copdips commented Oct 23, 2023

@RobertCraigie
could you please have a look at this issue, it bothers me for a long time, I'm sure pyright is installed, it is installed by simply pip install pyright --force-reinstall -v without venv as I'm in a CICD, the install log is like follows:

Collecting pyright
  Using cached https://pkgs.dev.azure.com/xxx/_packaging/daa86ee5-06b8-417b-bc88-e64e3e2eef29/pypi/download/pyright/1.1.332/pyright-1.1.332-py3-none-any.whl (17 kB)
Collecting nodeenv>=1.6.0 (from pyright)
  Downloading https://pkgs.dev.azure.com/xxx/_packaging/daa86ee5-06b8-417b-bc88-e64e3e2eef29/pypi/download/nodeenv/1.8/nodeenv-1.8.0-py2.py3-none-any.whl (22 kB)
Collecting setuptools (from nodeenv>=1.6.0->pyright)
  Using cached https://pkgs.dev.azure.com/xxx/_packaging/daa86ee5-06b8-417b-bc88-e64e3e2eef29/pypi/download/setuptools/68.2.2/setuptools-68.2.2-py3-none-any.whl (807 kB)
Installing collected packages: setuptools, nodeenv, pyright
  Attempting uninstall: setuptools
    Found existing installation: setuptools 65.5.0
    Uninstalling setuptools-65.5.0:
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/_distutils_hack/
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/distutils-precedence.pth
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pkg_resources/
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/setuptools-65.5.0.dist-info/
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/setuptools/
      Successfully uninstalled setuptools-65.5.0
  Attempting uninstall: nodeenv
    Found existing installation: nodeenv 1.8.0
    Uninstalling nodeenv-1.8.0:
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/bin/nodeenv
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/__pycache__/nodeenv.cpython-310.pyc
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/nodeenv-1.8.0.dist-info/
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/nodeenv.py
      Successfully uninstalled nodeenv-1.8.0
  changing mode of /opt/hostedtoolcache/Python/3.10.13/x64/bin/nodeenv to 777
  Attempting uninstall: pyright
    Found existing installation: pyright 1.1.332
    Uninstalling pyright-1.1.332:
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright-langserver
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright-python
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright-python-langserver
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright-1.1.332.dist-info/
      Removing file or directory /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyright/
      Successfully uninstalled pyright-1.1.332
  changing mode of /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright to 777
  changing mode of /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright-langserver to 777
  changing mode of /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright-python to 777
  changing mode of /opt/hostedtoolcache/Python/3.10.13/x64/bin/pyright-python-langserver to 777
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
Successfully installed nodeenv-1.8.0 pyright-1.1.332 setuptools-68.2.2

@copdips copdips changed the title subprocess.CalledProcessError: Command '['/usr/local/bin/npm', 'install', '[email protected]']' returned non-zero exit status 217. subprocess.CalledProcessError: Command '['/usr/local/bin/npm', 'install', '[email protected]']' returned non-zero exit status 217. Oct 23, 2023
@copdips
Copy link
Author

copdips commented Oct 24, 2023

for those github action runs who worked, where pyright tried to find the equivalent of /home/runner/.cache/pyright-python ? As I ran ls /home/runner/.cache before, and it showed only a pip folder inside.

@WSH032
Copy link

WSH032 commented Dec 31, 2023

Hi, are you still being troubled by this issue? You seemed to have mentioned this issue #190 before.

I solved this issue by #200, it might be useful to you.

@copdips
Copy link
Author

copdips commented Jan 2, 2024

@WSH032
Thank you for your notice, I tested multiple times, but I can not say it works or not, as I explained from the beginning that the issue is aleatory, and currently, with or without your workaround, both are working for the moment...

I will keep tracking this workaround and give feedback here.

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

2 participants