skip to Main Content

Some packages give errors when I try to install them using pip install. This is the error when I try to install djoser, but some other packages give this error as well:
ps: im trying to install libraries in a virtual envirement on cpanel.

$ pip install djoser==2.1.0
Collecting djoser==2.1.0
  Using cached djoser-2.1.0-py3-none-any.whl (46 kB)
Collecting social-auth-app-django<5.0.0,>=4.0.0
  Using cached social_auth_app_django-4.0.0-py3-none-any.whl (24 kB)
Collecting django-templated-mail<2.0.0,>=1.1.1
  Using cached django_templated_mail-1.1.1-py3-none-any.whl (4.7 kB)
Collecting djangorestframework-simplejwt<5.0.0,>=4.3.0
  Using cached djangorestframework_simplejwt-4.8.0-py3-none-any.whl (70 kB)
Requirement already satisfied: asgiref<4.0.0,>=3.2.10 in /home/qcmouhxi/virtualenv/milestone2/3.9/lib/python3.9/site-packages (from djoser==2.1.0) (3.5.2)
Collecting coreapi<3.0.0,>=2.3.3
  Using cached coreapi-2.3.3-py2.py3-none-any.whl (25 kB)
Collecting itypes
  Using cached itypes-1.2.0-py2.py3-none-any.whl (4.8 kB)
Collecting uritemplate
  Using cached uritemplate-4.1.1-py2.py3-none-any.whl (10 kB)
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting coreschema
  Using cached coreschema-0.0.4.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: django in /home/qcmouhxi/virtualenv/milestone2/3.9/lib/python3.9/site-packages (from djangorestframework-simplejwt<5.0.0,>=4.3.0->djoser==2.1.0) (4.1.1)
Collecting pyjwt<3,>=2
  Using cached PyJWT-2.5.0-py3-none-any.whl (20 kB)
Collecting djangorestframework
  Using cached djangorestframework-3.13.1-py3-none-any.whl (958 kB)
Collecting social-auth-core>=3.3.0
  Using cached social_auth_core-4.3.0-py3-none-any.whl (343 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting oauthlib>=1.0.3
  Using cached oauthlib-3.2.1-py3-none-any.whl (151 kB)
Collecting python3-openid>=3.0.10
  Using cached python3_openid-3.2.0-py3-none-any.whl (133 kB)
Collecting defusedxml>=0.5.0rc1
  Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting requests-oauthlib>=0.6.1
  Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting cryptography>=1.4
  Using cached cryptography-38.0.1.tar.gz (599 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [184 lines of output]
      Collecting setuptools!=60.9.0,>=40.6.0
        Using cached setuptools-65.3.0-py3-none-any.whl (1.2 MB)
      Collecting wheel
        Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
      Collecting cffi>=1.12
        Using cached cffi-1.15.1.tar.gz (508 kB)
        Preparing metadata (setup.py): started
        Preparing metadata (setup.py): finished with status 'done'
      Collecting setuptools-rust>=0.11.4
        Using cached setuptools_rust-1.5.1-py3-none-any.whl (23 kB)
      Collecting pycparser
        Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
      Collecting semantic-version<3,>=2.8.2
        Using cached semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)
      Collecting typing-extensions>=3.7.4.3
        Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
      Building wheels for collected packages: cffi
        Building wheel for cffi (setup.py): started
        Building wheel for cffi (setup.py): finished with status 'error'
        error: subprocess-exited-with-error

        × python setup.py bdist_wheel did not run successfully.
        │ exit code: 1
        ╰─> [67 lines of output]
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found

                No working compiler found, or bogus compiler options passed to
                the compiler from Python's standard "distutils" module.  See
                the error messages above.  Likely, the problem is not related
                to CFFI but generic to the setup.py of any Python package that
                tries to compile C code.  (Hints: on OS/X 10.8, for errors about
                -mno-fused-madd see http://stackoverflow.com/questions/22313407/
                Otherwise, see https://wiki.python.org/moin/CompLangPython or
                the IRC channel #python on irc.libera.chat.)

                Trying to continue anyway.  If you are trying to install CFFI from
                a build done in a different context, you can ignore this warning.

            /home/qcmouhxi/virtualenv/milestone2/3.9/lib/python3.9/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
              warnings.warn(msg, warning_class)
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib.linux-x86_64-cpython-39
            creating build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/api.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/lock.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/error.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/model.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-39/cffi
            running build_ext
            building '_cffi_backend' extension
            creating build/temp.linux-x86_64-cpython-39
            creating build/temp.linux-x86_64-cpython-39/c
            /opt/rh/devtoolset-7/root/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fPIC -DFFI_BUILDING=1 -I/usr/include/ffi -I/usr/include/libffi -I/home/qcmouhxi/virtualenv/milestone2/3.9/include -I/opt/alt/python39/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-39/c/_cffi_backend.o
            error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cffi
        Running setup.py clean for cffi
      Failed to build cffi
      Installing collected packages: wheel, typing-extensions, setuptools, semantic-version, pycparser, setuptools-rust, cffi
        Running setup.py install for cffi: started
        Running setup.py install for cffi: finished with status 'error'
        error: subprocess-exited-with-error

        × Running setup.py install for cffi did not run successfully.
        │ exit code: 1
        ╰─> [69 lines of output]
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found
            Package libffi was not found in the pkg-config search path.
            Perhaps you should add the directory containing `libffi.pc'
            to the PKG_CONFIG_PATH environment variable
            No package 'libffi' found

                No working compiler found, or bogus compiler options passed to
                the compiler from Python's standard "distutils" module.  See
                the error messages above.  Likely, the problem is not related
                to CFFI but generic to the setup.py of any Python package that
                tries to compile C code.  (Hints: on OS/X 10.8, for errors about
                -mno-fused-madd see http://stackoverflow.com/questions/22313407/
                Otherwise, see https://wiki.python.org/moin/CompLangPython or
                the IRC channel #python on irc.libera.chat.)

                Trying to continue anyway.  If you are trying to install CFFI from
                a build done in a different context, you can ignore this warning.

            /home/qcmouhxi/virtualenv/milestone2/3.9/lib/python3.9/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
              warnings.warn(msg, warning_class)
            running install
            /home/qcmouhxi/virtualenv/milestone2/3.9/lib/python3.9/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-39
            creating build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/api.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/lock.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/error.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/model.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-39/cffi
            copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-39/cffi
            running build_ext
            building '_cffi_backend' extension
            creating build/temp.linux-x86_64-cpython-39
            creating build/temp.linux-x86_64-cpython-39/c
            /opt/rh/devtoolset-7/root/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fPIC -DFFI_BUILDING=1 -I/usr/include/ffi -I/usr/include/libffi -I/home/qcmouhxi/virtualenv/milestone2/3.9/include -I/opt/alt/python39/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-39/c/_cffi_backend.o
            error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
            [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.
      ╰─> cffi

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

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

× pip subprocess to install build dependencies 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.
((milestone2:3.9)) [qcmouhxi@server125 milestone2]$

2

Answers


  1. it give me that same problem but when I changed my project to use Django 3.X it worked fine.

    Login or Signup to reply.
  2. you can use pymysql:

    pip install PyMySql
    

    and add below code to setting.py file:

    import pymysql
    pymysql.install_as_MySQLdb()
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search