ContactEngineering / SurfaceTopography

Read and analyze surface topographies
https://contactengineering.github.io/SurfaceTopography/
MIT License
17 stars 10 forks source link

How to do a development install of SurfaceTopography ? #315

Open sannant opened 1 year ago

sannant commented 1 year ago

pip install -e yields invalid version errors

pip install -e .
Obtaining file:///local/home/asanner/Repositories/SurfaceTopography
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... error
  error: subprocess-exited-with-error

  × Getting requirements to build editable did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      + meson setup /local/home/asanner/Repositories/SurfaceTopography /local/home/asanner/Repositories/SurfaceTopography/.mesonpy-168h5r3x/build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/local/home/asanner/Repositories/SurfaceTopography/.mesonpy-168h5r3x/build/meson-python-native-file.ini
      The Meson build system
      Version: 1.1.1
      Source dir: /local/home/asanner/Repositories/SurfaceTopography
      Build dir: /local/home/asanner/Repositories/SurfaceTopography/.mesonpy-168h5r3x/build
      Build type: native build
      Project name: SurfaceTopography
      Project version: 1.6.2.dirty
      C compiler for the host machine: cc (gcc 9.4.0 "cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
      C linker for the host machine: cc ld.bfd 2.34
      C++ compiler for the host machine: c++ (gcc 9.4.0 "c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
      C++ linker for the host machine: c++ ld.bfd 2.34
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Program python3 found: YES (/local/home/asanner/Repositories/SurfaceTopography/venv/bin/python)
      Found pkg-config: /usr/bin/pkg-config (0.29.1)
      Build targets in project: 1

      SurfaceTopography 1.6.2.dirty

        User defined options
          Native files: /local/home/asanner/Repositories/SurfaceTopography/.mesonpy-168h5r3x/build/meson-python-native-file.ini
          buildtype   : release
          b_ndebug    : if-release
          b_vscrt     : md

      Found ninja-1.11.1.git.kitware.jobserver-1 at /tmp/pip-build-env-1h9n54bh/overlay/bin/ninja
      Traceback (most recent call last):
        File "/local/home/asanner/Repositories/SurfaceTopography/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/local/home/asanner/Repositories/SurfaceTopography/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/local/home/asanner/Repositories/SurfaceTopography/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 132, in get_requires_for_build_editable
          return hook(config_settings)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 1048, in wrapper
          return func(*args, **kwargs)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 1143, in get_requires_for_build_editable
          return get_requires_for_build_wheel()
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 1048, in wrapper
          return func(*args, **kwargs)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 1092, in get_requires_for_build_wheel
          with _project(config_settings) as project:
        File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
          return next(self.gen)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 986, in _project
          with Project.with_temp_working_dir(
        File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
          return next(self.gen)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 831, in with_temp_working_dir
          yield cls(source_dir, tmpdir, build_dir, meson_args, editable_verbose)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/mesonpy/__init__.py", line 731, in __init__
          self._metadata.version = packaging.version.Version(self._meson_version)
        File "/tmp/pip-build-env-1h9n54bh/overlay/lib/python3.8/site-packages/packaging/version.py", line 198, in __init__
          raise InvalidVersion(f"Invalid version: '{version}'")
      packaging.version.InvalidVersion: Invalid version: '1.6.2.dirty'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
pastewka commented 1 year ago

This is an issue beyond this repository. I will probably move the version discovery code into its own module since it is used across repositories. It should also strip the devel/dirty/etc suffixes, as those are not a valid version numbers. What is considered a valid version is actually quite inhomogeneous across the Python ecosystem.