materialsvirtuallab / m3gnet

Materials graph network with 3-body interactions featuring a DFT surrogate crystal relaxer and a state-of-the-art property predictor.
BSD 3-Clause "New" or "Revised" License
243 stars 62 forks source link

Python 3.11 #43

Closed janosh closed 2 years ago

janosh commented 2 years ago

In https://github.com/materialsproject/pymatgen/pull/2714 it looks like m3gnet can't be installed under Python 3.11.

pip install error (CI run):

Downloading m3gnet-0.0.4.tar.gz (2.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 73.3 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      Traceback (most recent call last):
        File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-opu_sowf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-opu_sowf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-opu_sowf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 60, in <module>
        File "/tmp/pip-build-env-opu_sowf/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 970, in cythonize
          module_list, module_metadata = create_extension_list(
                                         ^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-opu_sowf/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 816, in create_extension_list
          for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
        File "/tmp/pip-build-env-opu_sowf/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 114, in nonempty
          raise ValueError(error_msg)
      ValueError: 'm3gnet/graph/_threebody_indices.pyx' doesn't match any files
      [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.
shyuep commented 2 years ago

This should have been solved with the recent replacement of the Cython file with a pure python version.

janosh commented 2 years ago

It's still failing. For unknown reasons, pip install m3gnet will download lots of old versions of m3gnet:

Collecting m3gnet
  Downloading m3gnet-0.2.3-py3-none-any.whl (285 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 285.0/285.0 kB 12.9 MB/s eta 0:00:00
Collecting pymatgen
  Downloading pymatgen-2022.11.7.tar.gz (2.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 85.0 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting m3gnet
  Downloading m3gnet-0.2.2-py3-none-any.whl (285 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 285.0/285.0 kB 67.1 MB/s eta 0:00:00
  Downloading m3gnet-0.2.1-py3-none-any.whl (285 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 285.1/285.1 kB 72.2 MB/s eta 0:00:00
  Downloading m3gnet-0.2.0-py3-none-any.whl (285 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 285.1/285.1 kB 61.6 MB/s eta 0:00:00
  Downloading m3gnet-0.1.1.tar.gz (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 103.5 MB/s eta 0:00:00
...

and the old versions fail to install with the same old error. I see this both locally and in CI. Installing with --no-deps seems to prevent that but might cause other problems.

shyuep commented 2 years ago

It might be due to the python versions? There is no reason why this doesn't work on Python 3.10 itself, but tensorflow may have requirements.....

janosh commented 2 years ago

Yeah, looks like TF is lacking Python 3.11 support at this point:

https://github.com/tensorflow/tensorflow/issues/58032

shyuep commented 2 years ago

Well, you can always skip isntall of m3gnet if it is py3.11 for now.

janosh commented 2 years ago

Will do.