ndtatbristol / arim

A Python library for array imaging in ultrasonic testing.
MIT License
23 stars 13 forks source link

Unable to install editable version #18

Closed mgchandler closed 4 months ago

mgchandler commented 4 months ago

I'm having trouble installing the most recent version of arim in dev mode, I believe this would have started when the move to hatch was made. While I haven't really used hatch, a little googling suggests that I should still be able to install in development mode using the same command as previously, i.e. pip install -e . when in the right directory. When I run it, I get this error:

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "/home/matt/miniforge3/envs/arim-env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/matt/miniforge3/envs/arim-env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/matt/miniforge3/envs/arim-env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3oqv94h_/overlay/lib/python3.11/site-packages/hatchling/build.py", line 83, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3oqv94h_/overlay/lib/python3.11/site-packages/hatchling/builders/plugin/interface.py", line 90, in build
          self.metadata.validate_fields()
        File "/tmp/pip-build-env-3oqv94h_/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 265, in validate_fields
          _ = self.version
              ^^^^^^^^^^^^
        File "/tmp/pip-build-env-3oqv94h_/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 149, in version
          self._version = self._get_version()
                          ^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3oqv94h_/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 248, in _get_version
          version = self.hatch.version.cached
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3oqv94h_/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 1466, in cached
          raise type(e)(message) from None
      OSError: Error getting the version from source `regex`: file does not exist: temporary/__init__.py
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

Is this down to the line [tool.hatch.version] in project.toml?

Edit: I've checked, I had installed hatch which I think overwrote the value to a temporary directory

nbud commented 4 months ago

Not fully sure what happened but I'm glad it's fixed!