Skip to content

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

Open
@davidbitterlich

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

  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)]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions