Cascella-Group-UiO/HyMD

Numpy >=1.24 breaks install compilation of fortran codes due to non-UTF-8 characters

Opened this issue · 0 comments

Should be fixed by removing Unicode characters from compute_angle_forces.f90, compute_angle_forces__double.f90, dipole_reconstruction.f90, and dipole_reconstruction__double.f90.

python3 -m pip install --user hymd
Collecting hymd
  Using cached https://files.pythonhosted.org/packages/b3/8b/48f291ea08e458c8f827e5d17a17c5be349a58fb367a79c7064352e992fd/hymd-1.0.8.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /cluster/software/Python/3.8.2-GCCcore-9.3.0/bin/python3 /cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpsh4imm3y
         cwd: /tmp/pip-install-luwaz27y/hymd
    Complete output (87 lines):
    running dist_info
    running build_src
    INFO: build_src
    INFO: building extension "force_kernels" sources
    INFO: f2py options: []
    INFO: f2py:> build/src.linux-x86_64-3.8/force_kernelsmodule.c
    creating build
    creating build/src.linux-x86_64-3.8
    setup.py:2: DeprecationWarning:

      `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
      of the deprecation of `distutils` itself. It will be removed for
      Python >= 3.12. For older Python versions it will remain present.
      It is recommended to use `setuptools < 60.0` for those Python versions.
      For more details, see:
        https://numpy.org/devdocs/reference/distutils_status_migration.html


      from numpy.distutils.core import setup, Extension
    Reading fortran codes...
    	Reading file 'hymd/compute_bond_forces.f90' (format:free)
    	Reading file 'hymd/compute_bond_forces__double.f90' (format:free)
    Traceback (most recent call last):
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/f2py/crackfortran.py", line 398, in readfortrancode
        l = fin.readline()
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/fileinput.py", line 304, in readline
        line = self._readline()
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/fileinput.py", line 368, in _readline
        return self._readline()
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 2370: ordinal not in range(128)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
        main()
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 69, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 174, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 267, in run_setup
        super(_BuildMetaLegacyBackend,
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 158, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 32, in <module>
        setup(
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/distutils/core.py", line 169, in setup
        return old_setup(**new_attr)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/setuptools/command/dist_info.py", line 31, in run
        egg_info.run()
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/distutils/command/egg_info.py", line 24, in run
        self.run_command("build_src")
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/distutils/command/build_src.py", line 144, in run
        self.build_sources()
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/distutils/command/build_src.py", line 161, in build_sources
        self.build_extension_sources(ext)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/distutils/command/build_src.py", line 321, in build_extension_sources
        sources = self.f2py_sources(sources, ext)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/distutils/command/build_src.py", line 562, in f2py_sources
        numpy.f2py.run_main(f2py_options + ['--lower',
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/f2py/f2py2e.py", line 441, in run_main
        postlist = callcrackfortran(files, options)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/f2py/f2py2e.py", line 342, in callcrackfortran
        postlist = crackfortran.crackfortran(files)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/f2py/crackfortran.py", line 3303, in crackfortran
        readfortrancode(files, crackline)
      File "/tmp/pip-build-env-2d834acc/overlay/lib/python3.8/site-packages/numpy/f2py/crackfortran.py", line 400, in readfortrancode
        raise Exception(
    Exception: readfortrancode: reading hymd/compute_angle_forces.f90#120 failed with
    'ascii' codec can't decode byte 0xf0 in position 2370: ordinal not in range(128).
    It is likely that installing charset_normalizer package will help f2py determine the input file encoding correctly.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /cluster/software/Python/3.8.2-GCCcore-9.3.0/bin/python3 /cluster/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpsh4imm3y Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 22.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.