okfn-brasil / querido-diario

📰 Diários oficiais brasileiros acessíveis a todos | 📰 Brazilian government gazettes, accessible to everyone.
https://queridodiario.ok.org.br/
MIT License
1.11k stars 409 forks source link

[bug] Problemas com Deploy #934

Closed trevineju closed 1 year ago

trevineju commented 1 year ago

O #925 deu um erro de deploy, apontando o problema ser com cython: https://github.com/okfn-brasil/querido-diario/actions/runs/6125045990/job/16626235125#step:5:27

O #932, que revertia o #925, também teve problema com cython: https://github.com/okfn-brasil/querido-diario/actions/runs/6224438863/job/16892645365#step:5:27

Tive exatamente o mesmo erro ao executar pip install -r requirements.txt na minha máquina local, quando chega na etapa de instalar o pyyaml:

Collecting pyyaml==5.4.1
  Using cached PyYAML-5.4.1.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [62 lines of output]
      /tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!

              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.

              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************

      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      running egg_info
      writing lib3/PyYAML.egg-info/PKG-INFO
      writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
      writing top-level names to lib3/PyYAML.egg-info/top_level.txt
      Traceback (most recent call last):
        File "/home/trevo/Desktop/Juliana/Repositorios/OKBR/querido-diario/.prod-env/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/trevo/Desktop/Juliana/Repositorios/OKBR/querido-diario/.prod-env/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/trevo/Desktop/Juliana/Repositorios/OKBR/querido-diario/.prod-env/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 271, in <module>
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 318, in run
          self.find_sources()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 326, in find_sources
          mm.run()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 548, in run
          self.add_defaults()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 586, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/command/sdist.py", line 113, in add_defaults
          super().add_defaults()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
        File "<string>", line 201, in get_source_files
        File "/tmp/pip-build-env-z2l467hs/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Aparentemente, tem uma issue sobre isso no repo do pyyaml: https://github.com/yaml/pyyaml/issues/724

trevineju commented 1 year ago

Para conseguir instalar as dependências do QD na minha máquina local, segui um comentário da issue mencionada acima: instalei o pyyaml na versão 5.3.1 (manualmente, precisei retirar a instalação dessa biblioteca dos requirements, pq quando chegava nela, quebrava, parava tudo e não instalava os demais).

Porém o QD vinha usando a versão 5.4.1 (mesmo antes das questões de #925 e #933), então parece ser um problema de outra natureza.

Winzen commented 1 year ago

Instalando localmente, seguindo esse comentário funciono para mim com pyyaml na versão 5.4.1

rennerocha commented 1 year ago

@trevineju é um problema no pyyaml que não pode ser atualizado para a versão 6 por algum motivo que não verifiquei ainda (parece que tem a ver com a versão do awscli e do boto3 que deixamos fixas por algum motivo que não é claro para mim ainda)

A solução temporária é deixar pinado na 5.3.1. Em https://github.com/okfn-brasil/querido-diario/pull/935/files#diff-c7815153c382300025ac730296604e11a6518dc8630f5ec386eaf37a7c212e2cR9 isso está feito e já deve resolver o problema.

natanluiz99 commented 1 year ago

O problema persiste, testei a instalação em uma nova máquina local e houve o mesmo problema com o cython. Segui o comentário instruido

Instalando localmente, seguindo esse comentário funciono para mim com pyyaml na versão 5.4.1

e houve algumas alterações na instalação como o novo erro:

ERROR: To modify pip, please run the following command: C:\Python310\python.exe -m pip install -r data_collection/requirements-dev.txt

e executei o comando, após executar o problema agora foi no chompjs com o seguinte retorno:


Building wheels for collected packages: chompjs, pyyaml
  Building wheel for chompjs (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-cpython-310
      creating build\lib.win32-cpython-310\chompjs
      copying chompjs\chompjs.py -> build\lib.win32-cpython-310\chompjs
      copying chompjs\test_parser.py -> build\lib.win32-cpython-310\chompjs
      copying chompjs\__init__.py -> build\lib.win32-cpython-310\chompjs
      running egg_info
      writing chompjs.egg-info\PKG-INFO
      writing dependency_links to chompjs.egg-info\dependency_links.txt
      writing top-level names to chompjs.egg-info\top_level.txt
      reading manifest file 'chompjs.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'chompjs.egg-info\SOURCES.txt'
      running build_ext
      building '_chompjs' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for chompjs
  Running setup.py clean for chompjs
  Building wheel for pyyaml (setup.py) ... done
  Created wheel for pyyaml: filename=PyYAML-5.3.1-cp310-cp310-win32.whl size=44627 sha256=4fcb6769db5a7444760de22a42f9682837fd959da3414870e0dab409d6ebd5b4
  Stored in directory: c:\users\natan\appdata\local\pip\cache\wheels\0b\a9\6a\d0a6981a8dbb698845178818642f72ce179f14336908c7df01
Successfully built pyyaml
Failed to build chompjs
ERROR: Could not build wheels for chompjs, which is required to install pyproject.toml-based projects

e tenho instalado o Microsoft Visual C++ 14.0 como havia sido instruido, vou testar a instalação do Pyyaml

rennerocha commented 1 year ago

O seu problema não é relacionado ao pyyaml como anteriormente, mas ao chompjs:

Successfully built pyyaml
Failed to build chompjs
trevineju commented 1 year ago

resolvido pelo #945 e #958!