Distributive-Network / PythonMonkey

A Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment.
https://pythonmonkey.io
Other
854 stars 40 forks source link

Can't install pythonmonkey in docker #373

Closed oaguirre-vb closed 4 months ago

oaguirre-vb commented 4 months ago

Issue type

Build/Install

How did you install PythonMonkey?

Installed from pip

OS platform and distribution

Docker - Linux Ubuntu 22.04

Python version (python --version)

Python 3.10

PythonMonkey version (pip show pythonmonkey)

No response

Bug Description

When I try use pip install pythonmonkey , I keep getting an error concerning git/hooks/precommit

And I try to clone the repo and run ./setup.sh it halts at Installing Poetry and I eventually have to kill the process.

Standalone code to reproduce the issue

No response

Relevant log output or backtrace

Building wheel for pythonmonkey (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pythonmonkey (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      ln: failed to create symbolic link '.git/hooks/pre-commit': No such file or directory
      Traceback (most recent call last):
        File "/tmp/pip-install-c1evfcjb/pythonmonkey_acb4d454b9204488b9c90dab0b5bf611/build.py", line 81, in <module>       
          build()
        File "/tmp/pip-install-c1evfcjb/pythonmonkey_acb4d454b9204488b9c90dab0b5bf611/build.py", line 74, in build
          ensure_spidermonkey()
        File "/tmp/pip-install-c1evfcjb/pythonmonkey_acb4d454b9204488b9c90dab0b5bf611/build.py", line 41, in ensure_spidermonkey
          execute("bash ./setup.sh", cwd=TOP_DIR)
        File "/tmp/pip-install-c1evfcjb/pythonmonkey_acb4d454b9204488b9c90dab0b5bf611/build.py", line 31, in execute        
          raise subprocess.CalledProcessError(return_code, cmd)
      subprocess.CalledProcessError: Command 'bash ./setup.sh' returned non-zero exit status 1.
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel        
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-szdkvi5b/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/api.py", line 58, in build_wheel
          return WheelBuilder.make_in(
        File "/tmp/pip-build-env-szdkvi5b/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-szdkvi5b/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-szdkvi5b/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-szdkvi5b/overlay/local/lib/python3.10/dist-packages/poetry/core/masonry/builders/wheel.py", line 262, 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', 'build.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 pythonmonkey
Failed to build pythonmonkey
ERROR: Could not build wheels for pythonmonkey, which is required to install pyproject.toml-based projects

Additional info if applicable

No response

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

No response

philippedistributive commented 4 months ago

@caleb-distributive This is quite possibly a regression caused by recent build system changes

Xmader commented 4 months ago

https://github.com/Distributive-Network/PythonMonkey/commit/d4c9223b84bbded29d6b3e7e07c9d188276e2db0 added the git commit hooks.

zollqir commented 4 months ago

This will be fixed in the release today

taivokasper commented 4 months ago

@caleb-distributive I think it is still broken

Test with this Dockerfile:

FROM node:20.15.1-slim

RUN apt-get update -y \
    && apt-get install -y python3-pip python3-dev python3-venv

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install --upgrade pip

RUN pip install --extra-index-url https://nightly.pythonmonkey.io/ --pre pythonmonkey

build command: docker build -f Dockerfile -t pythonmonkey:test .

Error:

53.86       Rust is installed now. Great!
53.86
53.86       To get started you may need to restart your current shell.
53.86       This would reload your PATH environment variable to include
53.86       Cargo's bin directory ($HOME/.cargo/bin).
53.86
53.86       To configure your current shell, you need to source
53.86       the corresponding env file under $HOME/.cargo.
53.86
53.86       This is usually done by running one of the following (note the leading DOT):
53.86       . "$HOME/.cargo/env"            # For sh/bash/zsh/ash/dash/pdksh
53.86       source "$HOME/.cargo/env.fish"  # For fish
53.86       ./setup.sh: line 37: cargo: command not found
53.86       Traceback (most recent call last):
53.86         File "/tmp/pip-install-kcmgztbj/pythonmonkey_d33c5d07339e429b829557e6f0e54316/build.py", line 77, in <module>
53.86           build()
53.86         File "/tmp/pip-install-kcmgztbj/pythonmonkey_d33c5d07339e429b829557e6f0e54316/build.py", line 70, in build
53.86           ensure_spidermonkey()
53.86         File "/tmp/pip-install-kcmgztbj/pythonmonkey_d33c5d07339e429b829557e6f0e54316/build.py", line 44, in ensure_spidermonkey
53.86           execute("bash ./setup.sh", cwd=TOP_DIR)
53.86         File "/tmp/pip-install-kcmgztbj/pythonmonkey_d33c5d07339e429b829557e6f0e54316/build.py", line 34, in execute
53.86           raise subprocess.CalledProcessError(return_code, cmd)
53.86       subprocess.CalledProcessError: Command 'bash ./setup.sh' returned non-zero exit status 127.
53.86       Traceback (most recent call last):
53.86         File "/opt/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
53.86           main()
53.86         File "/opt/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
53.86           json_out['return_val'] = hook(**hook_input['kwargs'])
53.86                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53.86         File "/opt/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
53.86           return _build_backend().build_wheel(wheel_directory, config_settings,
53.86                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53.86         File "/tmp/pip-build-env-_r4u5wuy/overlay/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 58, in build_wheel
53.86           return WheelBuilder.make_in(
53.86                  ^^^^^^^^^^^^^^^^^^^^^
53.86         File "/tmp/pip-build-env-_r4u5wuy/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
53.86           wb.build(target_dir=directory)
53.86         File "/tmp/pip-build-env-_r4u5wuy/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 123, in build
53.86           self._build(zip_file)
53.86         File "/tmp/pip-build-env-_r4u5wuy/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 172, in _build
53.86           self._run_build_script(self._package.build_script)
53.86         File "/tmp/pip-build-env-_r4u5wuy/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 262, in _run_build_script
53.86           subprocess.check_call([self.executable.as_posix(), build_script])
53.86         File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
53.86           raise CalledProcessError(retcode, cmd)
53.86       subprocess.CalledProcessError: Command '['/opt/venv/bin/python3', 'build.py']' returned non-zero exit status 1.
53.86       [end of output]
zollqir commented 4 months ago

This looks to be a different issue than the git hooks one, we're not configuring the current shell to include cargo (. $HOME/.cargo/env) before using it. I'll make a quick patch for this.

oaguirre-vb commented 4 months ago

Yes, I am having the same issue as before unfortunately.

oaguirre-vb commented 4 months ago

I am still having some trouble. It will download without error, but it gets stuck at a certain point and pretty much just stops.

Collecting multidict<7.0,>=4.5 (from aiohttp<4.0.0,>=3.9.5->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached multidict-6.0.5-py3-none-any.whl.metadata (4.2 kB)
Collecting yarl<2.0,>=1.0 (from aiohttp<4.0.0,>=3.9.5->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached yarl-1.9.4-py3-none-any.whl.metadata (31 kB)
Collecting async-timeout<5.0,>=4.0 (from aiohttp<4.0.0,>=3.9.5->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)
Collecting Brotli (from aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached Brotli-1.1.0-cp310-cp310-linux_armv7l.whl
Collecting aiodns (from aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached aiodns-3.2.0-py3-none-any.whl.metadata (4.0 kB)
Collecting idna>=2.0 (from yarl<2.0,>=1.0->aiohttp<4.0.0,>=3.9.5->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting pycares>=4.0.0 (from aiodns->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached pycares-4.4.0-cp310-cp310-linux_armv7l.whl
Collecting cffi>=1.5.0 (from pycares>=4.0.0->aiodns->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached cffi-1.16.0-cp310-cp310-linux_armv7l.whl
Collecting pycparser (from cffi>=1.5.0->pycares>=4.0.0->aiodns->aiohttp[speedups]<4.0.0,>=3.9.5->pythonmonkey)
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Using cached async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Using cached attrs-23.2.0-py3-none-any.whl (60 kB)
Using cached frozenlist-1.4.1-py3-none-any.whl (11 kB)
Using cached multidict-6.0.5-py3-none-any.whl (9.7 kB)
Using cached yarl-1.9.4-py3-none-any.whl (31 kB)
Using cached aiodns-3.2.0-py3-none-any.whl (5.7 kB)
Using cached idna-3.7-py3-none-any.whl (66 kB)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Building wheels for collected packages: pythonmonkey
  Building wheel for pythonmonkey (pyproject.toml) ... \^Z
zollqir commented 4 months ago

The step where it's taking a long time is when it is compiling spidermonkey, which is a lengthy process. If you would like a pre-compiled binary, you can just do pip install pythonmonkey, rather than installing a nightly build (assuming you're on an architecture we have binaries for)

oaguirre-vb commented 3 months ago

Hello again, I wanted to ask (but not open a completely new issue, unless you guys think I should) about how much space is needed to install pythonmonkey. My main issue now is there isn't enough space within the docker container for it to be installed (3.3 gb left for container)