PrincetonUniversity / SPEC

The Stepped-Pressure Equilibrium Code, an advanced MRxMHD equilibrium solver.
https://princetonuniversity.github.io/SPEC/
GNU General Public License v3.0
25 stars 6 forks source link

Cannot install f90wrap #180

Closed abaillod closed 1 year ago

abaillod commented 2 years ago

Hi,

I can't install Caoxiang's f90wrap version anymore; What I do:

conda create --name test
conda activate test
conda install pip
pip install --upgrade pip
pip install -U git+https://github.com/zhucaoxiang/f90wrap

I get the following error message:

(test) abaillod@spcpc602:~/SPEC> pip install -U git+https://github.com/zhucaoxiang/f90wrap
Collecting git+https://github.com/zhucaoxiang/f90wrap
  Cloning https://github.com/zhucaoxiang/f90wrap to /tmp/pip-req-build-itxezbxl
  Running command git clone --quiet https://github.com/zhucaoxiang/f90wrap /tmp/pip-req-build-itxezbxl
  Resolved https://github.com/zhucaoxiang/f90wrap to commit 27f5f31ff8f5c1761403c6d77f5bab7d2aa21b0e
  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
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "/misc/anaconda3/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/misc/anaconda3/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/misc/anaconda3/envs/test/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-vgkrkxd7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 337, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-vgkrkxd7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 319, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-vgkrkxd7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 334, in run_setup
          exec(code, locals())
        File "<string>", line 38, in <module>
        File "/tmp/pip-build-env-vgkrkxd7/overlay/lib/python3.10/site-packages/numpy/distutils/core.py", line 24, in <module>
          from numpy.distutils.command import config, config_compiler, \
        File "/tmp/pip-build-env-vgkrkxd7/overlay/lib/python3.10/site-packages/numpy/distutils/command/config.py", line 19, in <module>
          from numpy.distutils.mingw32ccompiler import generate_manifest
        File "/tmp/pip-build-env-vgkrkxd7/overlay/lib/python3.10/site-packages/numpy/distutils/mingw32ccompiler.py", line 29, in <module>
          from distutils.msvccompiler import get_build_version as get_build_msvc_version
      ModuleNotFoundError: No module named 'distutils.msvccompiler'
      [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

This happens both on my work computer and on MARCONI. Any clues?

zhucaoxiang commented 2 years ago

I got the same error. This is strange because previously everything was working. I am guessing that the latest version of pip changed something and caused this issue. I will try to revert back to older versions.

I also tried to use pip install f90wrap and got similar errors.

$ pip install f90wrap
Collecting f90wrap
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/53/88/75aaf24d7c1299f468dafdee1b20b6dee243ec3b788d4305092f4a979b86/f90wrap-0.2.7.tar.gz
  Downloading f90wrap-0.2.7.tar.gz (80 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.8/80.8 kB 97.6 kB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none)
      ERROR: No matching distribution found for setuptools
      [end of output]

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

× pip subprocess to install build dependencies 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.
abaillod commented 2 years ago

I think I found a temporary work around: I downgraded setuptools to a version prior to 60.0. Then, I cloned the git repository and installed f90wrap manually with

python setup.py install

It is weird though; I had the same problem when trying to install pyoculus.

zhucaoxiang commented 2 years ago

Good to know that. So I guess the problem is with setuptools. I guess this is related to the following warning.

setup.py:38: 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
tomtangtrp commented 1 year ago

Hi, I am a new phd student at ANU under supervision of Prof Matthew Hole. I got the similar f90wrap error when compiling on Ubuntu 20.04.5 LTS: (spec_env) rongpingtang@MSI-069792:~/SPEC$ pip install -U git+https://github.com/zhucaoxiang/f90wrap ........... ........... ........... ERROR: Failed building wheel for f90wrap Failed to build f90wrap ERROR: Could not build wheels for f90wrap, which is required to install pyproject.toml-based projects

Is there a more detailed work around guide available? Thank you very much!

abaillod commented 1 year ago

Hi,

What version of setuptools are you using? The (ugly) work around I found was to downgrade setuptools to a version prior to 60.0.0, and then install f90wrap. If you are using anaconda, you can try

conda create --name myenv python=3.10 setuptools=59.1.0
conda activate myenv
pip install -U git+https://github.com/zhucaoxiang/f90wrap

@zhucaoxiang - any idea why we can't install your version of f90wrap with the latest version of setuptools?

zhucaoxiang commented 1 year ago

any idea why we can't install your version of f90wrap with the latest version of setuptools?

@abaillod I had an impression it was caused by numpy updates. At some point, I (or some volunteers) should merge our branch back to the official repo. I did it once, but someone else reverted it.

smiet commented 1 year ago

I believe this issue can be worked around by:

And also some of the jiggling around with setuptools versions might help (though the deprecationwarning is a warning, and should not be an issue)

This is getting silly and we do really have to fix this at some point. There is some background work going on to update our f90wrap to the upstream, but this for now has low priority.

Closing, but if someone still has issues, please reopen.