2
respostas

Falha ao executar o pip install -r requirements.txt no python3

Quando fui iniciar o curso tive problema pra instalar as dependências

Building wheels for collected packages: lazy-object-proxy
  Building wheel for lazy-object-proxy (pyproject.toml) ... done
  Created wheel for lazy-object-proxy: filename=lazy_object_proxy-1.4.3-cp311-cp311-linux_x86_64.whl size=10143 sha256=461917b9a9a3b1692f2d2d238242f3f5617419761e2cc16f1d986a1abfcfb8cc
  Stored in directory: /home/dilerval/.cache/pip/wheels/f7/17/11/c1d5ae7b3631bb53cdc30af62687db319a5589b6548ca20240
Successfully built lazy-object-proxy
Installing collected packages: wrapt, typed-ast, toml, pytz, mccabe, sqlparse, six, lazy-object-proxy, isort, asgiref, Django, astroid, pylint, djangorestframework
  DEPRECATION: wrapt 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 wrapt ... done
  DEPRECATION: typed-ast 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 typed-ast ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for typed-ast did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      running install
      /home/dilerval/Dropbox/Cursos_alura/Dev Django Python/Api_com_Django_validacao/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/typed_ast
      copying typed_ast/ast3.py -> build/lib.linux-x86_64-cpython-311/typed_ast
      copying typed_ast/conversions.py -> build/lib.linux-x86_64-cpython-311/typed_ast
      copying typed_ast/ast27.py -> build/lib.linux-x86_64-cpython-311/typed_ast
      copying typed_ast/__init__.py -> build/lib.linux-x86_64-cpython-311/typed_ast
      creating build/lib.linux-x86_64-cpython-311/typed_ast/tests
      copying ast3/tests/test_basics.py -> build/lib.linux-x86_64-cpython-311/typed_ast/tests
      running build_ext
      building '_ast27' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/ast27
      creating build/temp.linux-x86_64-cpython-311/ast27/Custom
      creating build/temp.linux-x86_64-cpython-311/ast27/Parser
      creating build/temp.linux-x86_64-cpython-311/ast27/Python
      x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Iast27/Include "-I/home/dilerval/Dropbox/Cursos_alura/Dev Django Python/Api_com_Django_validacao/venv/include" -I/usr/include/python3.11 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-cpython-311/ast27/Custom/typed_ast.o
      ast27/Custom/typed_ast.c:1:10: fatal error: Python.h: Arquivo ou diretório inexistente
          1 | #include "Python.h"
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [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.
╰─> typed-ast

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

Resolvi instalando as dependencias do requirements.txt uma a uma

python3 -m pip install PACKAGE_NAME

e depois gerei novo arquivo requirements.txt

não sei se tem um comando que já faz esse trabalho, de pegar os módulos presentes no requirements.txt e já instalar atualizando

asgiref==3.7.2
astroid==3.1.0
dill==0.3.8
Django==5.0.3
djangorestframework==3.14.0
isort==5.13.2
lazy-object-proxy==1.10.0
mccabe==0.7.0
packaging==23.2
pip-review==1.3.0
platformdirs==4.2.0
pylint==3.1.0
pytz==2024.1
six==1.16.0
sqlparse==0.4.4
toml==0.10.2
tomlkit==0.12.4
typed-ast==1.5.5
wrapt==1.16.0

Oi! Tudo bem?

Obrigada por compartilhar sua solução pro bug aqui no fórum.

Se outra dúvida surgir, estamos disponíveis.

Abraços!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software