Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when installing cocoex with pip without code fabrication #1

Open
ttusar opened this issue Jul 29, 2024 · 1 comment

Comments

@ttusar
Copy link
Contributor

ttusar commented Jul 29, 2024

If one attempts to install cocoex with pip before fabricating the code, an error occurs. The resulting error message (see below) is unhelpful. We should add a hint that the code needs to be fabricated first.

(cocoex) D:\Delo\Github\numbbo-coco-experiment\build\python>pip install .
Processing d:\delo\github\numbbo-coco-experiment\build\python
  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
  ╰─> [55 lines of output]
      Traceback (most recent call last):
        File "C:\Users\Tea\anaconda3\envs\cocoex\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\Tea\anaconda3\envs\cocoex\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\anaconda3\envs\cocoex\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 14, in <module>
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 158, in setup
          dist.parse_config_files()
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\dist.py", line 614, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 70, in apply_configuration
          config = read_configuration(filepath, True, ignore_option_errors, dist)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 139, in read_configuration
          return expand_configuration(asdict, root_dir, ignore_option_errors, dist)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 164, in expand_configuration
          return _ConfigExpander(config, root_dir, ignore_option_errors, dist).expand()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 212, in expand
          self._expand_all_dynamic(dist, package_dir)
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 257, in _expand_all_dynamic
          version=self._obtain_version(dist, package_dir),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 306, in _obtain_version
          return _expand.version(self._obtain(dist, "version", package_dir))
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 295, in _obtain
          return self._expand_directive(
                 ^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 289, in _expand_directive
          return _expand.read_attr(directive["attr"], package_dir, root_dir)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\expand.py", line 186, in read_attr
          spec = _find_spec(module_name, path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Tea\AppData\Local\Temp\pip-build-env-6urkgvn5\overlay\Lib\site-packages\setuptools\config\expand.py", line 198, in _find_spec
          spec = spec or importlib.util.find_spec(module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib.util>", line 92, in find_spec
      ModuleNotFoundError: No module named 'cocoex'
      [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.
olafmersmann added a commit that referenced this issue Aug 14, 2024
…ckage

Instead of outputting a ModuleNotFoundError when attempting to build the
cocoex Python package without running `scripts/fabricate` beforehand,
output an informative error message that tells you how to resolve the
issue.

Fixes #1
@olafmersmann
Copy link
Contributor

olafmersmann commented Aug 14, 2024

With commit a610238 you now get

❯ pip install .                                                                                                                                                              (cocoex)
Processing /home/olafm/work/coco-experiment/build/python
  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: 255
  ╰─> [12 lines of output]
      BUILD ERROR

      Missing source files: src/cocoex/coco.c, src/cocoex/coco.h

      Could not find some generated source files. These are required to build the
      Python package. If you are building in-tree from a git checkout of the
      'numbbo/coco-experiment' repository, did you forget to run the
      `scripts/fabricate` script to generate the COCO source bundles?

      If you are not building in-tree or ran `scripts/fabricate`, please file an
      issue on Github: https://github.com/numbbo/coco-experiment/issues

      [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: 255
╰─> See above for output.

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

olafmersmann added a commit that referenced this issue Aug 14, 2024
…ckage

Instead of outputting a ModuleNotFoundError when attempting to build the
cocoex Python package without running `scripts/fabricate` beforehand,
output an informative error message that tells you how to resolve the
issue.

Fixes #1
olafmersmann added a commit that referenced this issue Aug 14, 2024
…ckage

Instead of outputting a ModuleNotFoundError when attempting to build the
cocoex Python package without running `scripts/fabricate` beforehand,
output an informative error message that tells you how to resolve the
issue.

Fixes #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants