Reputation: 1051
I wanted to run some code in IronPython using c#. In this code I needed to use numpy. So I tried to install it using the command below:
ipy -X:Frames -m pip install -U numpy
Unfortunately, I get an error and a return message telling me it was a unsuccessful installation. The error message is bellow:
Using cached https://files.pythonhosted.org/packages/3a/20/c81632328b1a4e1db65f45c0a1350a9c5341fd4bbb8ea66cdd98da56fe2e/numpy-1.15.0.zip
Installing collected packages: numpy
Running setup.py install for numpy ... error
Complete output from command "C:\Program Files\IronPython 2.7\ipy.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\mbhamida\\appdata\\local\\temp\\pip-build-t61kxu\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mbhamida\appdata\local\temp\pip-y91bz0-record\install-record.txt --single-version-externally-managed --compile:
Running from numpy source directory.
Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:
- `pip install .` (from a git repo or downloaded source
release)
- `pip install numpy` (last NumPy release on PyPi)
C:\Program Files\IronPython 2.7\Lib\distutils\dist.py:1: UserWarning: Unknown distribution option: 'python_requires'
"""distutils.dist
blas_opt_info:
blas_mkl_info:
customize MSVCCompiler
libraries mkl_rt not found in ['C:\\Program Files\\IronPython 2.7\\lib']
NOT AVAILABLE
blis_info:
customize MSVCCompiler
libraries blis not found in ['C:\\Program Files\\IronPython 2.7\\lib']
NOT AVAILABLE
openblas_info:
customize MSVCCompiler
customize MSVCCompiler
libraries openblas not found in ['C:\\Program Files\\IronPython 2.7\\lib']
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\setup.py", line 410, in <module>
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\core.py", line 135, in setup
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 625, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 433, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 625, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 1758, in calc_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\fcompiler\__init__.py", line 61, in <module>
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\setup.py", line 402, in setup_package
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\setup.py", line 167, in configuration
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 1032, in add_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 998, in get_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 940, in _get_configuration_from_setup_py
File "numpy\setup.py", line 10, in configuration
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 1032, in add_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 998, in get_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 940, in _get_configuration_from_setup_py
File "numpy\core\setup.py", line 832, in configuration
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 433, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 1621, in calc_info
TypeError: a new-style class can't have only classic bases
----------------------------------------
Command ""C:\Program Files\IronPython 2.7\ipy.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\mbhamida\\appdata\\local\\temp\\pip-build-t61kxu\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mbhamida\appdata\local\temp\pip-y91bz0-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\
I searched a lot about a solution, but I guess it is a very common problem. Ps: I face the same problem with many other packages.
What can be the solution?
Upvotes: 4
Views: 16244
Reputation: 191
Python is first and foremost a language and has a default implementation in C: CPython. IronPython is another implementation of the language, based on .NET. As such, it implements the default core language and most of the standard library.
Some Python packages available through PIP are pure Python and rely on elements supported by IronPython. Some other modules are, however, specific to the implementation. In particular, numpy uses native C code, which is supported by CPython but not by IronPython. More info on the IronPython issue tracker: https://github.com/IronLanguages/ironpython2/issues/
For it to work, numpy would have to offer compatibility with .NET. I have seen a .NET refactor of numpy, but never got it working.
A solution for your problem? Avoid mixing numpy and .NET. If you find a way to make it work, though, I'm interested.
[Edit:] You might want to have a look at this answer on how to install numpy: https://stackoverflow.com/a/51900761/6690989
Upvotes: 6