Troubleshooting Error Code 1 When Installing aiohttp Python Package

Mar 3, 2024 ยท 2 min read

When installing Python packages via pip, you may occasionally see an error like:

error: command 'gcc' failed with exit code 1 in /tmp/pip-build-hhexkf/aiohttp/

This can happen when trying to install aiohttp, a popular Python package for asynchronous HTTP client/server framework.

The key things to understand about this error are:

  • It indicates that part of the aiohttp installation process failed when trying to compile some C code. aiohttp has some C components for performance reasons.
  • Specifically, it failed when trying to invoke the gcc compiler command. The exit code 1 signifies that gcc failed for some reason.
  • It occurred in a temp folder (/tmp/pip-build-xxxx) where pip builds the package before installing it.
  • There are a few common reasons you may see this error:

  • Missing build dependencies - aiohttp requires gcc and Python header files to build some components. Ensure you have gcc, python-dev (on Linux) or equivalent packages installed.
  • Incorrect gcc version - Sometimes a version mismatch between gcc and Python can cause issues. Try updating both to current stable releases.
  • Permissions issue - The /tmp folder may have incorrect permissions causing the build failure. Try installing with sudo or verifying you have write access to /tmp.
  • Corrupted build - Try clearing pip cache and tmp folders then re-trying the install.
  • The key is to diagnose which of those root causes is triggering the compiler error. Checking dependencies, gcc/Python versions, permissions, and trying a clean build are good starting points.

    I hope this gives you some ideas on how to troubleshoot and fix the cryptic "error code 1" you may see when installing aiohttp or other Python packages that include native C code.

    Browse by tags:

    Browse by language:

    The easiest way to do Web Scraping

    Get HTML from any page with a simple API call. We handle proxy rotation, browser identities, automatic retries, CAPTCHAs, JavaScript rendering, etc automatically for you


    Try ProxiesAPI for free

    curl "http://api.proxiesapi.com/?key=API_KEY&url=https://example.com"

    <!doctype html>
    <html>
    <head>
        <title>Example Domain</title>
        <meta charset="utf-8" />
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    ...

    X

    Don't leave just yet!

    Enter your email below to claim your free API key: