Skip to content

ModuleNotFoundError: No module named 'cgi' when pip install #155

@setop

Description

@setop

Hi,

I tried to pull web.py==0.62 but I get ModuleNotFoundError: No module named 'cgi' error. As a result, webpy is not available.

Details

$ . .venv/bin/activate

(.venv) $ pip install -r requirements.txt 

Collecting web.py==0.62 (from -r requirements.txt (line 1))
  Downloading web.py-0.62.tar.gz (623 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 623.2/623.2 kB 6.8 MB/s  0:00:00
  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
  ╰─> [33 lines of output]
      /tmp/pip-install-muga9tpt/web-py_46e74015e962407996b7285af05ce67c/web/debugerror.py:96: SyntaxWarning: invalid escape sequence '\-'
        strClassName = strClassName.replace(/\-/g, "\\-");
      Traceback (most recent call last):
        File "/home/mrloyal/Documents/imgproxy/.venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "/home/mrloyal/Documents/imgproxy/.venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/mrloyal/Documents/imgproxy/.venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-n856824x/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-n856824x/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/tmp/pip-build-env-n856824x/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 520, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-n856824x/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 7, in <module>
        File "/tmp/pip-install-muga9tpt/web-py_46e74015e962407996b7285af05ce67c/web/__init__.py", line 4, in <module>
          from . import (  # noqa: F401
          ...<11 lines>...
          )
        File "/tmp/pip-install-muga9tpt/web-py_46e74015e962407996b7285af05ce67c/web/debugerror.py", line 19, in <module>
          from . import webapi as web
        File "/tmp/pip-install-muga9tpt/web-py_46e74015e962407996b7285af05ce67c/web/webapi.py", line 6, in <module>
          import cgi
      ModuleNotFoundError: No module named 'cgi'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 25.3 -> 26.0.1
[notice] To update, run: pip install --upgrade pip
ERROR: Failed to build 'web.py' when getting requirements to build wheel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions