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

Cannot install pip package if package contains native code that should be compiled during install #1803

Open
3 tasks done
davidbitterlich opened this issue Jul 22, 2024 · 0 comments

Comments

@davidbitterlich
Copy link

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

  1. Install IronPython (I used the portable zip file version and ran it using mono)
  2. Enable pip by running: mono ipy.exe -m ensurepip
  3. 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:

  1. Open IronPython cli (mono ipy.exe)
  2. Enter "import sysconfig"
  3. 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)]

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

1 participant