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.

Building Numpy package fails with TypeError: __init__() takes from 3 to 4 positional arguments but 13 were given

See original GitHub issue

I’m trying in build Numpy on Ubuntu Server Xenial (Armbian 5.14). I have installed libexpat1-dev, libpython3-dev, libpython3.5-dev, python3-dev, python3.5-dev, build-essential, gcc, gfortran, gfortran-5, libgfortran-5-dev, libgfortran3, libblas-common, libblas-dev, libblas3, libopenblas-base, libopenblas-dev, cython, libpng-dev. Cloned git repo to a dir and ran python3 setup.py build. Here’s the log:

$ python3 setup.py build

Running from numpy source directory. Cythonizing sources numpy/random/mtrand/mtrand.pyx has not changed Traceback (most recent call last): File "setup.py", line 390, in <module> setup_package() File "setup.py", line 382, in setup_package setup(**metadata) File "/home/odroid/downloads/numpy/numpy/distutils/core.py", line 135, in setup config = configuration() File "setup.py", line 165, in configuration config.add_subpackage('numpy') File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 1001, in add_subpackage caller_level = 2) File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 970, in get_subpackage caller_level = caller_level + 1) File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "numpy/setup.py", line 10, in configuration config.add_subpackage('core') File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 1001, in add_subpackage caller_level = 2) File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 970, in get_subpackage caller_level = caller_level + 1) File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "numpy/core/setup.py", line 638, in configuration generate_numpy_api] File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 1483, in add_extension ext = Extension(**ext_args) File "/home/odroid/downloads/numpy/numpy/distutils/extension.py", line 52, in __init__ export_symbols) TypeError: __init__() takes from 3 to 4 positional arguments but 13 were given

How can it be fixed?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
charriscommented, Aug 20, 2016

@sisp Aha, looking at newest setuptools definition of class Extensions there is a new __init__ function with arguments

    def __init__(self, name, sources, py_limited_api=False, **kw):
        self.py_limited_api = py_limited_api
        _Extension.__init__(self, name, sources, **kw)

So that definitely looks like a problem, one that should be fixed by using the proper call with keywords in Numpy.

0reactions
charriscommented, Aug 21, 2016

@rgommers Re export_symbols, if the symbols aren’t demangled it is probably useless for C++.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: method() takes 1 positional argument but 2 were ...
The object won't expect/handle this and the error is thrown. In the case of the sytax error: The fix is simple, just edit...
Read more >
Python takes 1 positional argument but 2 were given Solution
The “takes 1 positional argument but 2 were given” error is raised when you try to pass an argument through a method in...
Read more >
TypeError: takes 2 positional arguments but 3 were given
Overriding a built-in function by mistake. typeerror takes 2 positional argument but 3 were given. Here is an example of how the error...
Read more >
Changelog — Python 3.11.1 documentation
gh-97612: Fix a shell code injection vulnerability in the get-remote-certificate.py example script. The script no longer uses a shell to run openssl commands....
Read more >
method() takes 1 positional argument but 2 were given - Finxter
You can solve the TypeError: method() takes 1 positional argument but 2 were given by adding an argument named self to your method...
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