Conda package bug? binary incompatability

347 Views Asked by At

I'm working in a remote Jupyter notebook on a system where I don't have root access, or even a shell in which to make many adjustments. I can retrieve packages from Conda's archive and run functions in notebook cells that install packages like this

!conda install /path/to/package-vvv.tar.bz2

I've run into situations where I guess wrong on the version number, install something that is incompatible. The error messages are like the one I produce below, binary incompatability in numpy or mkl.

Now I'm re-tracing problem on an Ubuntu 20.10 notebook where I have admin access. I have a reproducible problem to show and share.

  1. Create an environment with same version of python, numpy and pandas, as we have on remote machine:
$ conda create -n cenv-py368 python=3.6.8 pandas=1.1.2 numpy=1.15.4
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.12
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base -c defaults conda

## Package Plan ##

  environment location: /home/pauljohn/LinuxDownloads/miniconda3/envs/cenv-py368

  added / updated specs:
    - numpy=1.15.4
    - pandas=1.1.2
    - python=3.6.8


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libffi-3.2.1               |    hf484d3e_1007          52 KB
    python-3.6.8               |       h0371630_0        34.4 MB
    libgcc-ng-9.1.0            |       hdf63c60_0         8.1 MB
    libstdcxx-ng-9.1.0         |       hdf63c60_0         4.0 MB
    blas-1.0                   |              mkl           6 KB
    _libgcc_mutex-0.1          |             main           3 KB
    ------------------------------------------------------------
                                           Total:        46.6 MB

The following NEW packages will be INSTALLED:

    _libgcc_mutex:   0.1-main
    blas:            1.0-mkl
    ca-certificates: 2021.1.19-h06a4308_0
    certifi:         2020.12.5-py36h06a4308_0
    intel-openmp:    2020.2-254
    libedit:         3.1.20191231-h14c3975_1
    libffi:          3.2.1-hf484d3e_1007
    libgcc-ng:       9.1.0-hdf63c60_0
    libgfortran-ng:  7.3.0-hdf63c60_0
    libstdcxx-ng:    9.1.0-hdf63c60_0
    mkl:             2020.2-256
    mkl-service:     2.3.0-py36he8ac12f_0
    mkl_fft:         1.2.0-py36h23d657b_0
    mkl_random:      1.1.1-py36h0573a6f_0
    ncurses:         6.2-he6710b0_1
    numpy:           1.15.4-py36h7e9f1db_0
    numpy-base:      1.15.4-py36hde5b4d6_0
    openssl:         1.1.1i-h27cfd23_0
    pandas:          1.1.2-py36he6710b0_0
    pip:             20.3.3-py36h06a4308_0
    python:          3.6.8-h0371630_0
    python-dateutil: 2.8.1-pyhd3eb1b0_0
    pytz:            2021.1-pyhd3eb1b0_0
    readline:        7.0-h7b6447c_5
    setuptools:      52.0.0-py36h06a4308_0
    six:             1.15.0-pyhd3eb1b0_0
    sqlite:          3.33.0-h62c20be_0
    tk:              8.6.10-hbc83047_0
    wheel:           0.36.2-pyhd3eb1b0_0
    xz:              5.2.5-h7b6447c_0
    zlib:            1.2.11-h7b6447c_3

Proceed ([y]/n)? y


Downloading and Extracting Packages
libffi-3.2.1         | 52 KB     | ##################################### | 100%
python-3.6.8         | 34.4 MB   | ##################################### | 100%
libgcc-ng-9.1.0      | 8.1 MB    | ##################################### | 100%
libstdcxx-ng-9.1.0   | 4.0 MB    | ##################################### | 100%
blas-1.0             | 6 KB      | ##################################### | 100%
_libgcc_mutex-0.1    | 3 KB      | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate cenv-py368
#
# To deactivate an active environment, use
#
#     $ conda deactivate
  1. activate that environment.

  2. Install, for example, the package called "fastparquet":

(cenv-py368) $ conda install fastparquet
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 4.5.12
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base -c defaults conda


## Package Plan ##

  environment location: /home/pauljohn/LinuxDownloads/miniconda3/envs/cenv-py368

  added / updated specs:
    - fastparquet

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pyparsing-2.4.7            |     pyhd3eb1b0_0          59 KB
    packaging-20.9             |     pyhd3eb1b0_0          35 KB
    ------------------------------------------------------------
                                           Total:          95 KB

The following NEW packages will be INSTALLED:

    fastparquet: 0.5.0-py36h6323ea4_1
    libllvm10:   10.0.1-hbcb73fb_5
    llvmlite:    0.34.0-py36h269e1b5_4
    numba:       0.51.2-py36h0573a6f_1
    packaging:   20.9-pyhd3eb1b0_0
    pyparsing:   2.4.7-pyhd3eb1b0_0
    thrift:      0.11.0-py36hf484d3e_0

Proceed ([y]/n)? y


Downloading and Extracting Packages
pyparsing-2.4.7      | 59 KB     | ##################################### | 100%
packaging-20.9       | 35 KB     | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
  1. Observe failure of import
(cenv-py368) $ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fastparquet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pauljohn/LinuxDownloads/miniconda3/envs/cenv-py368/lib/python3.6/site-packages/fastparquet/__init__.py", line 5, in <module>
    from .core import read_thrift
  File "/home/pauljohn/LinuxDownloads/miniconda3/envs/cenv-py368/lib/python3.6/site-packages/fastparquet/core.py", line 9, in <module>
    from . import encoding
  File "/home/pauljohn/LinuxDownloads/miniconda3/envs/cenv-py368/lib/python3.6/site-packages/fastparquet/encoding.py", line 13, in <module>
    from .speedups import unpack_byte_array
  File "fastparquet/speedups.pyx", line 1, in init fastparquet.speedups
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
>>> AA

Do you agree I found a bug?

Seems like either Conda should work, or it should say there is no compatible version of fastparquet.

2

There are 2 best solutions below

5
On

That error usually indicates that the NumPy is older than is compatible with the library that is using it, in this case fastparquet. Try updating the Python version to 3.7 or 3.8; Python 3.6 and NumPy 1.15 are not within the recommended versions today. (Updating Python to 3.7+ should also update NumPy; this is not usually done when you do conda update ...). Some recipes pin to >= some minimum version, this one did not seem to.

https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table

1
On

It is a flaw in the preparation of some Python libraries you are importing. When the authors of a package like fastparquet do not correctly set the minimum compatible version of numpy or python for their package, the Conda environment reconciliation has no way to know that the package is incorrect. Conda offers up the package as a solution, although in fact it is not.

In a larger sense, this is a flaw in the way Conda finds compatible packages. Perhaps it is working as intended, so it is not a bug. But it is a flaw, in the sense that when the user pegs numpy=1.15, then the correct answer from Conda should be "there is no compatible package". However, because Conda relies on the version dependencies of contributed packages, it is not able to do so.

I've not encountered the same problem with packaging for RedHat or Debian Linux systems, they tend to report "nothing" rather than providing an inaccurate match.