is there a way to upgrade the pip version that pan...
# general
c
is there a way to upgrade the pip version that pants uses or pass flags into pip? getting this error when trying to package an app that uses
numpy
(for example):
Copy code
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
  WARNING: You are using pip version 20.3.4; however, version 22.2.2 is available.
This is on an M1 mac (12.5) with pants 2.12.0
1
h
Funny you should ask: @enough-analyst-54434 is currently working on supporting newer versions of pip.
But how sure are you that this is the problem?
What versions of Python and numpy are in play here?
c
python 3.9.10, numpy 1.23.1
i’m not sure why its trying to build the numpy wheels since they are available on pypi
wonder if it has something to do with the fact that i’m on 12.5
h
Hmm that numpy has a wheel that should be compatible: numpy-1.23.1-cp39-cp39-macosx_11_0_arm64.whl
I’m macOS 12.4 on an M2, and that wheel is installed if I
pip install numpy==1.23.1
in a virtualenv
What happens if you bypass pants/pex entirely on your system and use pip directly in a python3.9 virtualenv?
c
mine builds from source
Copy code
Collecting numpy==1.23.1
  Downloading numpy-1.23.1.tar.gz (10.7 MB)
     |████████████████████████████████| 10.7 MB 14.7 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517) ... done
  Created wheel for numpy: filename=numpy-1.23.1-cp39-cp39-macosx_12_0_arm64.whl size=5080188 sha256=40bc478bef790e163c1e73a5a4dd3ada5bee6a29a66ff35c12a5a800ef9dc665
  Stored in directory: /Users/ashu/Library/Caches/pip/wheels/e9/08/af/c32ddeb26bf7cf91805eb7b3db6db127625aed4c121f7ad811
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.23.1
fwiw this is the error I get when building w/ pex:
Copy code
assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
    AssertionError: would build wheel with unsupported tag ('cp39', 'cp39', 'macosx_12_5_arm64')
looks like its using the wrong osx deployment target
h
Yeah, so I’m not an expert on this but I believe the macosx_11 wheel should be compatible (and I see it being used on my macosx_12_4) so maybe this is specifically a 12_5 thing? Weird if so but…
c
Aha! It turns out it wasn’t numpy, it was scipy==1.8.1 which tries to build and old version of numpy as part of its dependencies
@happy-kitchen-89482 can you try
pip install scipy==1.8.1
using pip version 20.3.4
h
Copy code
$ pip install scipy==1.8.1
Collecting scipy==1.8.1
  Downloading scipy-1.8.1-cp39-cp39-macosx_12_0_arm64.whl (28.7 MB)
     |████████████████████████████████| 28.7 MB 512 kB/s 
Collecting numpy<1.25.0,>=1.17.3
  Downloading numpy-1.23.2-cp39-cp39-macosx_11_0_arm64.whl (13.3 MB)
     |████████████████████████████████| 13.3 MB 3.1 MB/s 
Installing collected packages: numpy, scipy
Successfully installed numpy-1.23.2 scipy-1.8.1
WARNING: You are using pip version 20.3.4; however, version 22.2.2 is available.
So it’s using the wheels
c
Hmm
Maybe it is 12.5 then
@happy-kitchen-89482 do you know why it would try to build an old version of numpy even though I have a newer version pinned?
h
Pinned where?
c
i have numpy pinned in my top level requirements file
and scipy pinned as well
h
Are you using a lockfile?
c
yeah
i think the issue is that as part of the scipy build, it tries to build numpy
i actually upgraded to the newer version of scipy, and got it to work via pip:
Copy code
PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig" pip install scipy==1.9.0
is there a way to pass that environment variable down when i run
./pants package
?
when I tried doing
PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig" ./pants package
it didn’t seem to work
h
Oh, you mean scipy’s setup.py is manually installing numpy??
I don’t see that in their code
scipy depends on numpy in the normal way, but the lockfile should pick the right version
and I think it is, it sounds like
You can pass env vars through to process sandboxes with this option:
c
the old version of scipy was explicilty installing 1.19.2, no clue why
in any case, what you suggested works. thanks for the help 🙂