IronLanguages / IronLanguages/ironpython3
Cannot install pip package if package contains native code that should be compiled during install
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
Prerequisites
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
Description
When I try to install a python package that is compatible with Python 3.4 but contains native code which should be compiled during installation, it simply fails with the error message:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-i_0bp7r8/
The package I wanted to use is pycryptodome version 3.9.9 which is a dependency of another package I wanted to use...
Steps to Reproduce
- Install IronPython (I used the portable zip file version and ran it using mono)
- Enable pip by running: mono ipy.exe -m ensurepip
- Try to install the package: mono ipy.exe -m pip install pycryptodomex==3.9.9
Since I think, the problem is caused by missing build variables which should be exposed by distutil's sysconfig -> get_config_var (and get_config_vars), you could end up with the following procedure to reproduce:
- Open IronPython cli (mono ipy.exe)
- Enter "import sysconfig"
- Enter "print(sysconfig.get_config_var('CC'))"
Expected behavior:
The installation succeeds and the package will be installed
Actual behavior:
The compilation fails.
From what I've seen so far, the setup.py script tries to use set_compiler_options which then runs a function to check if the system is using clang or gcc. For that reason it tries to compile some small sample code against either clang or gcc. As part of that, the function test_compilation (in compiler_opt.py in the package) is invoked which runs distutils.sysconfig.customize_compiler()
customize_compiler comes from the pre-bundled distutils version which is part of this repository. From what I've found out, the method customize_compiler in sysconfig.py of distutils tries to use get_config_vars to get values for CC, CXX, OPT, CFLAGS, CCSHARED, LDSHARED, SHLIB_SUFFIX, AR and ARFLAGS.
None of them are returned by get_config_vars - and I think that's the underlying problem.
Version Information
Ironpython 3.4.1 (3.4.1.1000)
[.NETFramework,Version=V4.6.2 on Mono 6.8.0.105 (Debian 6.8.0.105+dfsg-3.3 Wed Dec 14 11:30:18 UTC 2022) (64-bit)]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with IronPython and the pycryptodomex installation command, then inspect the bundled distutils sysconfig.py, especially customize_compiler and get_config_vars. Compare the compiler variables named in the issue and trace their use from the package's setup.py and compiler_opt.py. Done means the native package installs successfully and compilation no longer fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100