Page MenuHomePhabricator

Errors with installing MinT locally: Encountered error while trying to install package. ╰─> sentencepiece
Closed, ResolvedPublicBUG REPORT

Description

I've tried to install MinT on my laptop by running pip install -r requirements.txt, and got this error:

Requirement already satisfied: setuptools in ./.venv/lib/python3.11/site-packages (from gevent==22.10.2->-r requirements.txt (line 37)) (66.1.1)
Installing collected packages: sentencepiece, roundrobin, pycld2, msgpack, brotli, zope-interface, zope-event, urllib3, typing-extensions, tomli, six, pyzmq, pyyaml, psutil, pluggy, packaging, numpy, markupsafe, itsdangerous, iniconfig, idna, gunicorn, greenlet, exceptiongroup, ecs-logging, configargparse, click, charset-normalizer, certifi, attrs, werkzeug, requests, pytest, jinja2, gevent, ctranslate2, geventhttpclient, flask, flask-cors, flask-basicauth, locust
  DEPRECATION: sentencepiece is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for sentencepiece ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for sentencepiece did not run successfully.
  │ exit code: 1
  ╰─> [85 lines of output]
      running install
      /home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/__init__.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/_version.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/sentencepiece_model_pb2.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/sentencepiece_pb2.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      running build_ext
      /bin/sh: 1: pkg-config: not found
      Cloning into 'sentencepiece'...
      Note: switching to '58f256cf6f01bb86e6fa634a5cc560de5bd1667d'.
      
      You are in 'detached HEAD' state. You can look around, make experimental
      changes and commit them, and you can discard any commits you make in this
      state without impacting any branches by switching back to a branch.
      
      If you want to create a new branch to retain commits you create, you may
      do so (now or later) by using -c with the switch command. Example:
      
        git switch -c <new-branch-name>
      
      Or undo this operation with:
      
        git switch -
      
      Turn off this advice by setting config variable advice.detachedHead to false
      
      ./build_bundled.sh: 19: cmake: not found
      ./build_bundled.sh: 20: cmake: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-uw2_gze9/sentencepiece_6c2cd63ced2b41c48cc4223597b80765/setup.py", line 136, in <module>
          setup(
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/install.py", line 698, in run
          self.run_command('build')
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions
          self._build_extensions_serial()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-install-uw2_gze9/sentencepiece_6c2cd63ced2b41c48cc4223597b80765/setup.py", line 89, in build_extension
          subprocess.check_call(['./build_bundled.sh', __version__])
        File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['./build_bundled.sh', '0.1.97']' returned non-zero exit status 127.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> sentencepiece

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I naïvely tried installing the "wheel" package, as suggested in the first lines, but it didn't help either. If I try to run pip install -r requirements.txt after installing it, I get this:

Requirement already satisfied: setuptools in ./.venv/lib/python3.11/site-packages (from gevent==22.10.2->-r requirements.txt (line 37)) (66.1.1)
Building wheels for collected packages: flask-basicauth, pycld2, roundrobin, sentencepiece, zope-interface
  Building wheel for flask-basicauth (setup.py) ... done
  Created wheel for flask-basicauth: filename=Flask_BasicAuth-0.2.0-py3-none-any.whl size=4241 sha256=7242bb3c002c89a7e6f79660e43cf9a44793a9f14bd0af7e0dd30e0ba13210f1
  Stored in directory: /home/amir/.cache/pip/wheels/3f/54/3d/8dcca37cc410b1be1ea1812d17f8c1dc892ddf7356353ecee9
  Building wheel for pycld2 (setup.py) ... done
  Created wheel for pycld2: filename=pycld2-0.41-cp311-cp311-linux_x86_64.whl size=9922008 sha256=5a957636342443884326549570bb7615d0059edc84d84eae74f186a4fb68996a
  Stored in directory: /home/amir/.cache/pip/wheels/9a/71/a1/89cdc6ae2ecd7bb3bf67baee27a134f761b3e2922ea7fdfbcb
  Building wheel for roundrobin (setup.py) ... done
  Created wheel for roundrobin: filename=roundrobin-0.0.4-py3-none-any.whl size=4017 sha256=83c9d8c8f673e867973fc3d17f19963569c7b83716af7a22f7096246e0ed420a
  Stored in directory: /home/amir/.cache/pip/wheels/a0/bc/5d/8714573bb8dd7e86b272448c8837bc0ea19e6b4ab3a46fca2b
  Building wheel for sentencepiece (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [80 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/__init__.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/_version.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/sentencepiece_model_pb2.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/sentencepiece_pb2.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      running build_ext
      /bin/sh: 1: pkg-config: not found
      Cloning into 'sentencepiece'...
      Note: switching to '58f256cf6f01bb86e6fa634a5cc560de5bd1667d'.
      
      You are in 'detached HEAD' state. You can look around, make experimental
      changes and commit them, and you can discard any commits you make in this
      state without impacting any branches by switching back to a branch.
      
      If you want to create a new branch to retain commits you create, you may
      do so (now or later) by using -c with the switch command. Example:
      
        git switch -c <new-branch-name>
      
      Or undo this operation with:
      
        git switch -
      
      Turn off this advice by setting config variable advice.detachedHead to false
      
      ./build_bundled.sh: 19: cmake: not found
      ./build_bundled.sh: 20: cmake: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-xwwgpvus/sentencepiece_cb9fe7148fb8457bbddb4f87950cf6ec/setup.py", line 136, in <module>
          setup(
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions
          self._build_extensions_serial()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-install-xwwgpvus/sentencepiece_cb9fe7148fb8457bbddb4f87950cf6ec/setup.py", line 89, in build_extension
          subprocess.check_call(['./build_bundled.sh', __version__])
        File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['./build_bundled.sh', '0.1.97']' returned non-zero exit status 127.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for sentencepiece
  Running setup.py clean for sentencepiece
  Building wheel for zope-interface (setup.py) ... done
  Created wheel for zope-interface: filename=zope.interface-5.5.2-cp311-cp311-linux_x86_64.whl size=246192 sha256=27521ed49a8336d5445f0c4aa89e337bbe5320d0a92d1edfa6df456c52788606
  Stored in directory: /home/amir/.cache/pip/wheels/38/88/58/784eb110a8e0a597e13520796f70e28c06a2c7228d53c83b8a
Successfully built flask-basicauth pycld2 roundrobin zope-interface
Failed to build sentencepiece
Installing collected packages: sentencepiece, roundrobin, pycld2, msgpack, brotli, zope-interface, zope-event, urllib3, typing-extensions, tomli, six, pyzmq, pyyaml, psutil, pluggy, packaging, numpy, markupsafe, itsdangerous, iniconfig, idna, gunicorn, greenlet, exceptiongroup, ecs-logging, configargparse, click, charset-normalizer, certifi, attrs, werkzeug, requests, pytest, jinja2, gevent, ctranslate2, geventhttpclient, flask, flask-cors, flask-basicauth, locust
  Running setup.py install for sentencepiece ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for sentencepiece did not run successfully.
  │ exit code: 1
  ╰─> [69 lines of output]
      running install
      /home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/__init__.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/_version.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/sentencepiece_model_pb2.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      copying src/sentencepiece/sentencepiece_pb2.py -> build/lib.linux-x86_64-cpython-311/sentencepiece
      running build_ext
      /bin/sh: 1: pkg-config: not found
      fatal: destination path 'sentencepiece' already exists and is not an empty directory.
      fatal: destination path 'sentencepiece' already exists and is not an empty directory.
      ./build_bundled.sh: 19: cmake: not found
      ./build_bundled.sh: 20: cmake: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-xwwgpvus/sentencepiece_cb9fe7148fb8457bbddb4f87950cf6ec/setup.py", line 136, in <module>
          setup(
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/install.py", line 698, in run
          self.run_command('build')
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions
          self._build_extensions_serial()
        File "/home/amir/devel/mint/.venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-install-xwwgpvus/sentencepiece_cb9fe7148fb8457bbddb4f87950cf6ec/setup.py", line 89, in build_extension
          subprocess.check_call(['./build_bundled.sh', __version__])
        File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['./build_bundled.sh', '0.1.97']' returned non-zero exit status 127.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> sentencepiece

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

... And now I don't have any idea about how I can fix it.

I'm running Python 3.11.2 on Ubuntu 23.04.

Event Timeline

./build_bundled.sh: 19: cmake: not found

This might be the issue.
You need build-essential package in your OS.(You can install using sudo apt install build-essential)

Amire80 claimed this task.

I already had sudo build-essential installed, but not cmake.

sudo apt install cmake seems to have helped. Thanks!