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

no-npm error should not display stack trace #429

Closed
wesgarland opened this issue Sep 8, 2024 · 2 comments
Closed

no-npm error should not display stack trace #429

wesgarland opened this issue Sep 8, 2024 · 2 comments
Assignees
Milestone

Comments

@wesgarland
Copy link
Collaborator

Issue type

Bug

How did you install PythonMonkey?

None

OS platform and distribution

macOs 10.15.7

Python version (python --version)

3.11.4

PythonMonkey version (pip show pythonmonkey)

No response

Bug Description

The stack trace here scrolls the page so much that the users don't see the error message unless the scroll back. This makes it look a build error, something most end users can't solve themselves. This makes them less likely to try using PythonMonkey.

[~] Wes-iMac-2019:wes# wget https://nightly.pythonmonkey.io/pythonmonkey/pythonmonkey-0.8.2.dev25+c8aa8d7-cp311-cp311-macosx_11_0_x86_64.whl -O pythonmonkey-0.8.2-cp311-cp311-macosx_10_15_x86_64.whl
--2024-09-08 11:50:46--  https://nightly.pythonmonkey.io/pythonmonkey/pythonmonkey-0.8.2.dev25+c8aa8d7-cp311-cp311-macosx_11_0_x86_64.whl
Resolving nightly.pythonmonkey.io (nightly.pythonmonkey.io)... 185.199.109.153, 185.199.108.153, 185.199.110.153, ...
Connecting to nightly.pythonmonkey.io (nightly.pythonmonkey.io)|185.199.109.153|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14947862 (14M) [application/octet-stream]
Saving to: ‘pythonmonkey-0.8.2-cp311-cp311-macosx_10_15_x86_64.whl’

pythonmonkey-0.8.2-cp311-cp311-macosx_10_15_x8 100%[=================================================================================================>]  14.25M  8.85MB/s    in 1.6s    

2024-09-08 11:50:48 (8.85 MB/s) - ‘pythonmonkey-0.8.2-cp311-cp311-macosx_10_15_x86_64.whl’ saved [14947862/14947862]

[~] Wes-iMac-2019:wes# pip install ./pythonmonkey-0.8.2-cp311-cp311-macosx_10_15_x86_64.whl
Processing ./pythonmonkey-0.8.2-cp311-cp311-macosx_10_15_x86_64.whl
Collecting aiohttp[speedups]<4.0.0,>=3.9.5
  Using cached aiohttp-3.10.5-cp311-cp311-macosx_10_9_x86_64.whl (397 kB)
Collecting pminit>=0.4.0
  Using cached pminit-0.8.1.tar.gz (7.5 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting aiohappyeyeballs>=2.3.0
  Using cached aiohappyeyeballs-2.4.0-py3-none-any.whl (12 kB)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting attrs>=17.3.0
  Using cached attrs-24.2.0-py3-none-any.whl (63 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl (55 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.5-cp311-cp311-macosx_10_9_x86_64.whl (30 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.10.0-cp311-cp311-macosx_10_9_x86_64.whl (114 kB)
Collecting Brotli
  Using cached Brotli-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl (446 kB)
Collecting aiodns>=3.2.0
  Using cached aiodns-3.2.0-py3-none-any.whl (5.7 kB)
Collecting pycares>=4.0.0
  Using cached pycares-4.4.0-cp311-cp311-macosx_10_9_x86_64.whl (75 kB)
Collecting idna>=2.0
  Using cached idna-3.8-py3-none-any.whl (66 kB)
Requirement already satisfied: cffi>=1.5.0 in /usr/local/lib/python3.11/site-packages (from pycares>=4.0.0->aiodns>=3.2.0->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey==0.8.2) (1.16.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.11/site-packages (from cffi>=1.5.0->pycares>=4.0.0->aiodns>=3.2.0->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey==0.8.2) (2.21)
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
  ╰─> [41 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 "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-install-dzft8fam/pminit_ac882addb8034325872a7a66e357f519/post-install-hook.py", line 38, in <module>
          main()
        File "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-install-dzft8fam/pminit_ac882addb8034325872a7a66e357f519/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 "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/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 "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-build-env-ddqo2tlr/overlay/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 58, in build_wheel
          return WheelBuilder.make_in(
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-build-env-ddqo2tlr/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
          wb.build(target_dir=directory)
        File "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-build-env-ddqo2tlr/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 123, in build
          self._build(zip_file)
        File "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-build-env-ddqo2tlr/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 172, in _build
          self._run_build_script(self._package.build_script)
        File "/private/var/folders/64/b8cgz6zx1sx62yr5kwql813c0000gn/T/pip-build-env-ddqo2tlr/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 262, in _run_build_script
          subprocess.check_call([self.executable.as_posix(), build_script])
        File "/usr/local/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/local/Cellar/[email protected]/3.11.4_1/bin/python3.11', '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

[notice] A new release of pip is available: 23.0.1 -> 24.2
[notice] To update, run: python3.11 -m pip install --upgrade pip
[~] Wes-iMac-2019:wes# 

Standalone code to reproduce the issue

No response

Relevant log output or backtrace

No response

Additional info if applicable

No response

What branch of PythonMonkey were you developing on? (If applicable)

No response

@wesgarland
Copy link
Collaborator Author

If for some reason we can't get rid of the stack here for 1.0, we can make the NPM error message go "press enter to continue and fail installation" when stdin is a tty instead.

@philippedistributive philippedistributive moved this from Backlog to Ready To Do in PythonMonkey Kanban Board Sep 9, 2024
@wesgarland wesgarland changed the title no-npm error should display stack trace no-npm error should not display stack trace Sep 10, 2024
@philippedistributive philippedistributive moved this from Ready To Do to In progress in PythonMonkey Kanban Board Sep 10, 2024
@wiwichips
Copy link
Collaborator

wiwichips commented Sep 10, 2024

If for some reason we can't get rid of the stack here for 1.0, we can make the NPM error message go "press enter to continue and fail installation" when stdin is a tty instead.

@wesgarland Is it typical for a Python package to do this during pip install? My gut feeling says this is a bad idea, but I haven't put a lot of thought into why I think that so I could totally be wrong --- maybe it's better than not knowing why it failed because it's hidden in logs?


EDIT: @Xmader looked into it, and you are not able to get stdin input during pip install https://dstrbtv.slack.com/archives/C03RNFRL4NQ/p1725994072130149

@Xmader Xmader closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in PythonMonkey Kanban Board Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants