Add actionable error message for no npm on system during pip install#152
Merged
Add actionable error message for no npm on system during pip install#152
Conversation
…lled
The error now displays like this:
Building wheels for collected packages: pminit
Building wheel for pminit (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pminit (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
PythonMonkey Build Error:
* It appears npm is not installed on this system.
* npm is required for PythonMonkey to build.
* Please install NPM and Node.js before installing PythonMonkey.
* Refer to the documentation for installing NPM and Node.js here: https://nodejs.org/en/download
Traceback (most recent call last):
File "/tmp/pip-req-build-75mp6ch1/post-install-hook.py", line 38, in <module>
main()
File "/tmp/pip-req-build-75mp6ch1/post-install-hook.py", line 33, in main
raise Exception("PythonMonkey build error: Unable to find npm on the system.")
Exception: PythonMonkey build error: Unable to find npm on the system.
Traceback (most recent call last):
File "/home/will/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/will/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/will/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-emge0d96/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/api.py", line 57, in build_wheel
return WheelBuilder.make_in(
File "/tmp/pip-build-env-emge0d96/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
wb.build(target_dir=directory)
File "/tmp/pip-build-env-emge0d96/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/builders/wheel.py", line 123, in build
self._build(zip_file)
File "/tmp/pip-build-env-emge0d96/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/builders/wheel.py", line 172, in _build
self._run_build_script(self._package.build_script)
File "/tmp/pip-build-env-emge0d96/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/builders/wheel.py", line 232, in _run_build_script
subprocess.check_call([self.executable.as_posix(), build_script])
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'post-install-hook.py']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pminit
Failed to build pminit
ERROR: Could not build wheels for pminit, which is required to install pyproject.toml-based projects
Contributor
|
question: Is it worth telling folks to use It looks like we aren't concerned with lock file versions, so any version of |
Collaborator
Author
I like this - However, I'm not sure which version we should specify - also keeping in mind older versions of NPM have security vulnerabilities |
Xmader
approved these changes
Jul 28, 2023
Collaborator
Author
|
Thanks @Xmader ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change prints an error message during pip install when npm is not installed on the system:
The error should show up like this:
If there is a cleaner way to do this which results in less output, please let me know