question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install mpi4py after latest release of setuptools: module 'setuptools._distutils.cygwinccompiler' has no attribute 'get_versions'

See original GitHub issue

With the latest release of setuptools (60.1.0), I cannot install mpi4py any more.

I have initially raised this issue with setuptools, but it looks like this fails in conf/mpidistutils.py.

$ pip install -v mpi4py
Using pip 21.3.1 from .../venv-mpi4py/lib/python3.8/site-packages/pip (python 3.8)
Collecting mpi4py
  Using cached mpi4py-3.1.3.tar.gz (2.5 MB)
  Running command .../venv-mpi4py/bin/python /tmp/pip-standalone-pip-fmkquq0f/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-nun8azx9/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools >= 40.9.0' wheel
  Collecting setuptools>=40.9.0
    Using cached setuptools-60.1.0-py3-none-any.whl (952 kB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Installing collected packages: wheel, setuptools
  Successfully installed setuptools-60.1.0 wheel-0.37.1
  Installing build dependencies ... done
  Running command .../venv-mpi4py/bin/python .../venv-mpi4py/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmputajppc5
  Traceback (most recent call last):
    File ".../venv-mpi4py/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File ".../venv-mpi4py/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File ".../venv-mpi4py/lib/python3.8/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-nun8azx9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/tmp/pip-build-env-nun8azx9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-nun8azx9/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 462, in <module>
      from mpidistutils import setup
    File "/tmp/pip-install-k7kbt967/mpi4py_fa187d0418384267943227507227365d/conf/mpidistutils.py", line 29, in <module>
      cygcc_get_versions = cygcc.get_versions
  AttributeError: module 'setuptools._distutils.cygwinccompiler' has no attribute 'get_versions'
  Getting requirements to build wheel ... error

So mpi4py should restrict build dependency to setuptools<60.1.0 or fix this issue. As it stands now, installing latest released mpi4py versions does not work.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dalcinlcommented, Dec 28, 2021

@EnricoMi Many thanks for your help and followup on this issue. I added my own comments. While it is true I could make a new release with the hotfix for the issue, it is also true that setuptools would not be able to install any of the older mpi4py releases, and users may have legitimate reasons to do that. So I truly believe setuptools should provide some sort of fix, even if just adding a line def get_versions(): raise RuntimeError("no longer supported").

1reaction
dalcinlcommented, Dec 25, 2021

@EnricoMi This is a possible workaround. Could you please double-check?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] 60.1.0: Installing mpi4py fails with latest setuptools #2969
Cannot install mpi4py after latest release of setuptools: module 'setuptools._distutils.cygwinccompiler' has no attribute 'get_versions' ...
Read more >
AttributeError: module 'setuptools._distutils' has no attribute ...
I'm using python 3.8.9 64-bit & tensorflow with distutils is already installed which is required by tensorboard. Why is this happening ? Please ......
Read more >
Installation — MPI for Python 3.1.4 documentation
You need to have the following software properly installed in order to build MPI for Python: A working MPI implementation, preferably supporting MPI-3...
Read more >
Can't install petsc4py in Ubuntu - Bitbucket
I need to use open framework openMDAO for my project in Ubuntu. Which needs mpi4py and petsc4py, I have installed mpi4py using pip...
Read more >
Mac mpi4py installation issue - Google Groups
I am using Python 2.7.5 and have installed openmpi-1.8.4. However when i try and build mpi4py-1.3.1 using '$ python setup.py build' in terminal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found