Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build/install via pip on python 3.10 (x86 macOS) #6

Open
shakfu opened this issue Oct 22, 2022 · 7 comments
Open

Fails to build/install via pip on python 3.10 (x86 macOS) #6

shakfu opened this issue Oct 22, 2022 · 7 comments

Comments

@shakfu
Copy link

shakfu commented Oct 22, 2022

Can't install cppyy via pip on macOS Catalina (intel mac):

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H2026

$ python3 --version
Python 3.10.8

$ pip3 install cppyy
Collecting cppyy
  Using cached cppyy-2.4.1.tar.gz (24 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [91 lines of output]
      Collecting cppyy-cling==6.27.0
        Using cached cppyy_cling-6.27.0-py2.py3-none-macosx_10_12_x86_64.whl (23.1 MB)
      Collecting cppyy-backend==1.14.9
        Using cached cppyy-backend-1.14.9.tar.gz (34 kB)
        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'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: cppyy-backend
        Building wheel for cppyy-backend (pyproject.toml): started
        Building wheel for cppyy-backend (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        × Building wheel for cppyy-backend (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [67 lines of output]
            Error in sitecustomize; set PYTHONVERBOSE for traceback:
            AssertionError:
            /usr/local/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
              warnings.warn(msg, warning_class)
            running bdist_wheel
            running build
            running build_ext
            Error in sitecustomize; set PYTHONVERBOSE for traceback:
            AssertionError:
            /usr/local/Cellar/[email protected]/3.10.8/bin/python3.10: Error while finding module specification for 'cppyy_backend._cling_config' (ModuleNotFoundError: No module named 'cppyy_backend')
            Traceback (most recent call last):
              File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
                main()
              File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
                json_out['return_val'] = hook(**hook_input['kwargs'])
              File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
                return _build_backend().build_wheel(wheel_directory, config_settings,
              File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 412, in build_wheel
                return self._build_with_temp_dir(['bdist_wheel'], '.whl',
              File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
                self.run_setup()
              File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 482, in run_setup
                super(_BuildMetaLegacyBackend,
              File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
                exec(code, locals())
              File "<string>", line 182, in <module>
              File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
                return distutils.core.setup(**attrs)
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
                return run_commands(dist)
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
                dist.run_commands()
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
                self.run_command(cmd)
              File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
                super().run_command(command)
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
                cmd_obj.run()
              File "/usr/local/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
                self.run_command('build')
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
                self.distribution.run_command(command)
              File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
                super().run_command(command)
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
                cmd_obj.run()
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
                self.run_command(cmd_name)
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
                self.distribution.run_command(command)
              File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
                super().run_command(command)
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
                cmd_obj.run()
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
                self.build_extensions()
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
                self._build_extensions_serial()
              File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
                self.build_extension(ext)
              File "<string>", line 73, in build_extension
              File "<string>", line 58, in get_include_path
              File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 421, in check_output
                return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
              File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 526, in run
                raise CalledProcessError(retcode, process.args,
            subprocess.CalledProcessError: Command '['/usr/local/Cellar/[email protected]/3.10.8/bin/python3.10', '-m', 'cppyy_backend._cling_config', '--incdir']' returned non-zero exit status 1.
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cppyy-backend
      Failed to build cppyy-backend
      ERROR: Could not build wheels for cppyy-backend, which is required to install pyproject.toml-based projects
      [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 backend 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.
@wlav
Copy link
Owner

wlav commented Oct 25, 2022

For the first, I'm surprised that a warning shows up as an AssertionError, but that one is now fixed in repo.

The other one I don't understand at all ... cppyy_backend._cling_config.py is provided by cppyy_cling-6.27.0-py2.py3-none-macosx_10_12_x86_64.whl, which is installed as a dependency. Any change to run with PYTHONVERBOSE=1 to see whether there's more information?

@shakfu
Copy link
Author

shakfu commented Oct 25, 2022

Hi @wlav

It's a very strange one. I just checked that if I pip install cppyy using virtualenv, it works without issues. Yet if I do the same on my system python3 (brew installed), I get the error as above. I thought it was something to do with cache so I deleted it and ran with --no-cache-dir, but the problem has persisted.

In any case, as requested, I'm including runs here with PYTHONVERBOSE=1 and PYTHONVERBOSE=0 using the following for verbose: pip3 install --no-cache-dir cppyy > stdout_verbose.txt 2>stderr_verbose.txt and pip3 install --no-cache-dir cppyy > stdout.txt 2>stderr.txt for normal verbosity.

These are attached here.
stdout.txt
stdout_verbose.txt
stderr.txt
stderr_verbose.txt

@shakfu
Copy link
Author

shakfu commented Oct 26, 2022

Incidentally, I'm not sure if this is the only reason, but I just upgraded to macOS Montery (I was on Catalina previously) and I was able to pip install cppyy without issues. Thanks for your help in any case!

@wlav
Copy link
Owner

wlav commented Oct 26, 2022

I don't suspect the cache (wheels are just zip files, so there's nothing to their structure per se). The .toml file should guarantee a fixed build environment per PEP517, so final installation location should not matter: the build dependencies are installed in a temporary directory.

Perhaps the system pip version is old and doesn't implement PEP517 correctly yet? Using virtualenv gets you an updated one. Can you see what python -m pip --version shows?

As a workaround, can you first install cppyy-cling, then the rest?

$ python -m pip install cppyy-cling
$ python -m pip install cppyy

That should not make a difference (b/c the installed environment is supposed to be ignored under PEP517), but then again, it should have worked in the first place. :)

@wlav
Copy link
Owner

wlav commented Oct 26, 2022

Oh, comments crossed. So if updating helped, then that points even more to the system pip simply having been old ... Is what it is, old setuptools way of installing and PEP517 way aren't compatible: can't support them both. :/

@shakfu
Copy link
Author

shakfu commented Nov 3, 2022

@wlav

It's a weird issue for sure. I just tried on another intel macbook pro running Monterey and with the latest pip tried to install cppyy and got the same error as above, but then I installed cppyy-cling first and then cppyy as per your suggestion above, and it worked.

This sequence as it happened:

% pip3 install cppyy
Collecting cppyy
  Using cached cppyy-2.4.1-py3-none-any.whl
Collecting cppyy-cling==6.27.0
  Using cached cppyy_cling-6.27.0-py2.py3-none-macosx_10_12_x86_64.whl (23.1 MB)
Collecting CPyCppyy==1.12.11
  Using cached CPyCppyy-1.12.11-cp310-cp310-macosx_12_0_x86_64.whl
Collecting cppyy-backend==1.14.9
  Using cached cppyy-backend-1.14.9.tar.gz (34 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: cppyy-backend
  Building wheel for cppyy-backend (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cppyy-backend (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [67 lines of output]
      Error in sitecustomize; set PYTHONVERBOSE for traceback:
      AssertionError:
      /usr/local/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      running bdist_wheel
      running build
      running build_ext
      Error in sitecustomize; set PYTHONVERBOSE for traceback:
      AssertionError:
      /usr/local/Cellar/[email protected]/3.10.8/bin/python3.10: No module named cppyy_backend._cling_config
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 412, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
          self.run_setup()
        File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 483, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 182, in <module>
        File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
          self._build_extensions_serial()
        File "/usr/local/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 73, in build_extension
        File "<string>", line 58, in get_include_path
        File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 421, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['/usr/local/Cellar/[email protected]/3.10.8/bin/python3.10', '-m', 'cppyy_backend._cling_config', '--incdir']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cppyy-backend
Failed to build cppyy-backend
ERROR: Could not build wheels for cppyy-backend, which is required to install pyproject.toml-based projects

% pip3 install cppyy-cling
Collecting cppyy-cling
  Using cached cppyy_cling-6.27.0-py2.py3-none-macosx_10_12_x86_64.whl (23.1 MB)
Installing collected packages: cppyy-cling
Successfully installed cppyy-cling-6.27.0

% pip3 install cppyy
Collecting cppyy
  Using cached cppyy-2.4.1-py3-none-any.whl
Requirement already satisfied: cppyy-cling==6.27.0 in /usr/local/lib/python3.10/site-packages (from cppyy) (6.27.0)
Collecting cppyy-backend==1.14.9
  Using cached cppyy-backend-1.14.9.tar.gz (34 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting CPyCppyy==1.12.11
  Using cached CPyCppyy-1.12.11-cp310-cp310-macosx_12_0_x86_64.whl
Building wheels for collected packages: cppyy-backend
  Building wheel for cppyy-backend (pyproject.toml) ... done
  Created wheel for cppyy-backend: filename=cppyy_backend-1.14.9-py2.py3-none-macosx_12_x86_64.whl size=68540 sha256=bf79653c342b55742e82515d6131d32b43f492347f966d00ab7bc88a7883904f
  Stored in directory: $HOME/Library/Caches/pip/wheels/6a/7c/45/f20b039342c154da381776b8f514cb8d0a6848eee5f36f66e9
Successfully built cppyy-backend
Installing collected packages: cppyy-backend, CPyCppyy, cppyy
Successfully installed CPyCppyy-1.12.11 cppyy-2.4.1 cppyy-backend-1.14.9

@mattreid9956
Copy link

Just a side note regs Ubuntu - no issues for me installing on python 3.10 - only thing I had to change was collections.Mapping --> collections.abc.Mapping in cppyy_backend/_cppyy_generator.py as they were removed out of the main init in the newer version. Appreciate you pulling this out of ROOT for people to use in such a light weight way!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants