2

I'm running into an issue with pip install --no-deps --no-build-isolation -r requirements.txt that I would not expect.

As a way of working around Python dependency hell using pip (the use of other package managers, e.g., poetry, are longer-term projects), we want to freeze our dependencies and install the exact versions of various packages we need.

In the list of dependencies includes:

fastparquet==0.4.1
...
numpy==1.17.4

The former depends on the latter.

In an attempt to get fastparquet to use the version of numpy we want, I thought that pip install --no-deps --no-build-isolation -r requirements.txt would work. --no-deps would ensure that dependencies of the packages listed won't be pulled down by pip, and --no-build-isolation would ensure we don't build fastparquet with a newer version of numpy as a result of pip's build isolation behavior.

Running pip install ... works without error. However, when running my code, I still get this issue when using fastparquet:

ValueError: numpy.ndarray size changed, may indicate binary incompatibility.
Expected 88 from C header, got 80 from PyObject

This error appears to be a numpy version compatibility issue.

Reinstalling fastparquet==0.4.1 via pip install --upgrade --force-reinstall fixes the issue, which implies to me that, the first time around, pip is still using a newer version of numpy.

Note that we are starting from a clean Python virtual environment with neither numpy nor fastparquet installed.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
bacchuswng
  • 335
  • 2
  • 9

1 Answers1

0

I think your analysis makes sense. The build environment and runtime environment are separate. When building fastparquet, the system doesn't know which numpy has been installed, so it just pulled the latest numpy based on its build settings. You may want to install numpy before fastparquet and use --no-build-isolation option.

Have you tried adding the option into requirements.txt?

fastparquet==0.4.1, --no-build-isolation

This works with pip version larger than 20.2.2

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Zheng Gao
  • 151
  • 1
  • 8