label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

ner: docker-compose build / up fails

Open d3vopz-net opened this issue 2 years ago • 5 comments

Collecting psycopg2==2.9.5
  Downloading psycopg2-2.9.5.tar.gz (384 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.3/384.3 kB 13.3 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running egg_info
      creating /tmp/pip-pip-egg-info-ggtkyjjc/psycopg2.egg-info
      writing /tmp/pip-pip-egg-info-ggtkyjjc/psycopg2.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-ggtkyjjc/psycopg2.egg-info/dependency_links.txt
      writing top-level names to /tmp/pip-pip-egg-info-ggtkyjjc/psycopg2.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-ggtkyjjc/psycopg2.egg-info/SOURCES.txt'
      
      Error: pg_config executable not found.
      
      pg_config is required to build psycopg2 from source.  Please add the directory
      containing pg_config to the $PATH or specify the full executable path with the
      option:
      
          python setup.py build_ext --pg-config /path/to/pg_config build ...
      
      or with the pg_config option in 'setup.cfg'.
      
      If you prefer to avoid building psycopg2 from source, please install the PyPI
      'psycopg2-binary' package instead.
      
      For further information please check the 'doc/src/install.rst' file (also at
      <https://www.psycopg.org/docs/install.html>).
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

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

[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: pip install --upgrade pip

Fixed with RUN apt update && apt-get install -y libpq-dev

d3vopz-net avatar Aug 18 '23 18:08 d3vopz-net

next is

Running setup.py install for uwsgi: started
  Running setup.py install for uwsgi: finished with status 'error'
  error: subprocess-exited-with-error
  
  × Running setup.py install for uwsgi did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      /usr/local/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'descriptions'
        warnings.warn(msg)
      running install
      using profile: buildconf/default.ini
      detected include path: ['/usr/include', '/usr/local/include']
      Traceback (most recent call last):
        File "/tmp/pip-install-njxyo9af/uwsgi_a7f76216da8e4f3f955d60d90ef8a392/uwsgiconfig.py", line 747, in __init__
          gcc_version_components = gcc_version.split('.')
      AttributeError: 'NoneType' object has no attribute 'split'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-njxyo9af/uwsgi_a7f76216da8e4f3f955d60d90ef8a392/setup.py", line 117, in <module>
          setup(
        File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-njxyo9af/uwsgi_a7f76216da8e4f3f955d60d90ef8a392/setup.py", line 77, in run
          conf = uc.uConf(get_profile())
        File "/tmp/pip-install-njxyo9af/uwsgi_a7f76216da8e4f3f955d60d90ef8a392/uwsgiconfig.py", line 755, in __init__
          raise Exception("you need a C compiler to build uWSGI")
      Exception: you need a C compiler to build uWSGI
      [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.
╰─> uwsgi

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

[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: pip install --upgrade pip

fixed with RUN apt update && apt-get install -y libpq-dev build-essential

d3vopz-net avatar Aug 19 '23 21:08 d3vopz-net

next is:

docker-compose up
Creating network "ner-20230819125600_default" with the default driver
Creating redis ... done
Creating server ... done
Attaching to redis, server
server    | /bin/sh: 1: exec: gunicorn: not found
redis     | 1:C 19 Aug 2023 21:33:28.851 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis     | 1:C 19 Aug 2023 21:33:28.851 # Redis version=7.0.12, bits=64, commit=00000000, modified=0, pid=1, just started
redis     | 1:C 19 Aug 2023 21:33:28.851 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis     | 1:M 19 Aug 2023 21:33:28.851 * monotonic clock: POSIX clock_gettime

fixed with RUN pip install --no-cache-dir gunicorn

d3vopz-net avatar Aug 19 '23 21:08 d3vopz-net

next is

docker-compose up
server    | Traceback (most recent call last):
server    |   File "/usr/local/bin/gunicorn", line 8, in <module>
server    |     sys.exit(run())
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
server    |     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 236, in run
server    |     super().run()
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run
server    |     Arbiter(self).run()
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 58, in __init__
server    |     self.setup(app)
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 118, in setup
server    |     self.app.wsgi()
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
server    |     self.callable = self.load()
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
server    |     return self.load_wsgiapp()
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
server    |     return util.import_app(self.app_uri)
server    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/util.py", line 371, in import_app
server    |     mod = importlib.import_module(module)
server    |   File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
server    |     return _bootstrap._gcd_import(name[level:], package, level)
server    |   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
server    |   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
server    |   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
server    |   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
server    |   File "<frozen importlib._bootstrap_external>", line 843, in exec_module
server    |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
server    |   File "/app/_wsgi.py", line 32, in <module>
server    |     from ner import TransformersBasedTagger
server    |   File "/app/ner.py", line 28, in <module>
server    |     from utils import calc_slope
server    | ModuleNotFoundError: No module named 'utils'
server exited with code 1

hmmm in README.md: cp ner/utils.py my-ml-backend/utils.py

d3vopz-net avatar Aug 19 '23 21:08 d3vopz-net

next is

docker-compose up


Attaching to server
server    | [2023-08-19 22:05:35,098] [ERROR] [ner::predict::369] No model loaded! Please train model before getting predictions!
server    | [2023-08-19 22:05:35,776] [ERROR] [ner::predict::369] No model loaded! Please train model before getting predictions!
server    | [2023-08-19 22:05:55,266] [ERROR] [ner::predict::369] No model loaded! Please train model before getting predictions!

d3vopz-net avatar Aug 19 '23 22:08 d3vopz-net

did you solve the last problem ?

EtienneFerrandi avatar Nov 27 '23 09:11 EtienneFerrandi