Skip to content

BUG: AttributeError: 'Extension' object has no attribute 'extra_c_compile_args' #20928

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

Closed
jschueller opened this issue Jan 28, 2022 · 2 comments · Fixed by #20934
Closed

BUG: AttributeError: 'Extension' object has no attribute 'extra_c_compile_args' #20928

jschueller opened this issue Jan 28, 2022 · 2 comments · Fixed by #20934

Comments

@jschueller
Copy link

jschueller commented Jan 28, 2022

Describe the issue:

It seems #19713 included in numpy >=1.22 is preventing to build some extensions such as in the assimulo package with the error:
'Extension' object has no attribute 'extra_c_compile_args'

cc @serge-sans-paille

Reproduce the code example:

curl -fSsL https://github.com/modelon-community/Assimulo/archive/Assimulo-3.2.9.tar.gz | tar xz
cd Assimulo-Assimulo-3.2.9
python3 setup.py install --extra-fortran-link-flags="-shared" --sundials-home=/usr/local --lapack-home=/usr/lib64 --blas-home=/usr/lib64


### Error message:

```shell
Traceback (most recent call last):
  File "/usr/local/src/Assimulo-Assimulo-3.2.9/setup.py", line 691, in <module>                                                                                                                                                             
    ndc.setup(name=NAME,                                                                                                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/numpy/distutils/core.py", line 169, in setup                                                                                                                                                 
    return old_setup(**new_attr)                                                                                                                                                                                                            
  File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup                                                                                                                                                  
    return distutils.core.setup(**attrs)                                                                                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup                                                                                                                                           
    return run_commands(dist)                                                                                                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands                                                                                                                                    
    dist.run_commands()                                                                                                                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands                                                                                                                                    
    self.run_command(cmd)                                                                                                                                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command                                                                                                                                     
    cmd_obj.run()                                                                                                                                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 60, in run                                                                                                                                         
    r = self.setuptools_run()                                                                                                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 54, in setuptools_run                                                                                                                              
    self.do_egg_install()                                                                                                                                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 116, in do_egg_install                                                                                                                                  
    self.run_command('bdist_egg')                                                                                                                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command                                                                                                                                      
    self.distribution.run_command(command)                                                                                                                                                                                                  
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command                                                                                                                                     
    cmd_obj.run()                                                                                                                                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 164, in run                                                                                                                                           
    cmd = self.call_command('install_lib', warn_dir=0)                                                                                                                                                                                      
  File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command                                                                                                                                  
    self.run_command(cmdname)                                                                                                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command                                                                                                                                      
    self.distribution.run_command(command)                                                                                                                                                                                                  
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command                                                                                                                                     
    cmd_obj.run()                                                                                                                                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run                                                                                                                                          
    self.build()                                                                                                                                                                                                                            
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 107, in build                                                                                                                            
    self.run_command('build_ext')                                                                                                                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command                                                                                                                                      
    self.distribution.run_command(command)                                                                                                                                                                                                  
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command                                                                                                                                     
    cmd_obj.run()                                                                                                                                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 316, in run                                                                                                                                      
    self.build_extensions()                                                                                                                                                                                                                 
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions                                                                                                                   
    self._build_extensions_serial()                                                                                                                                                                                                         
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial                                                                                                           
    self.build_extension(ext)                                                                                                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension                                                                                                                          
    extra_cflags = ext.extra_c_compile_args or []                                                                                                                                                                                           
AttributeError: 'Extension' object has no attribute 'extra_c_compile_args'


### NumPy/Python version information:

numpy 1.22.x
@serge-sans-paille
Copy link
Contributor

serge-sans-paille commented Jan 28, 2022 via email

@charris charris added this to the 1.22.2 release milestone Jan 28, 2022
serge-sans-paille added a commit to serge-sans-paille/numpy that referenced this issue Jan 28, 2022
Numpy extensions define the extra_cxx_compile_args and extra_c_compile_args
filed, but distutils extensions don't. Take that into account when populating
build_extension.

Should fix numpy#20928
@serge-sans-paille
Copy link
Contributor

ok, it happens because you're using non-numpy extensions with Numpy setup rules. #20934 should restore a compatible behavior.

charris pushed a commit to charris/numpy that referenced this issue Jan 29, 2022
Numpy extensions define the extra_cxx_compile_args and extra_c_compile_args
filed, but distutils extensions don't. Take that into account when populating
build_extension.

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

Successfully merging a pull request may close this issue.

3 participants