ambitious-spoon-69726
05/19/2023, 7:33 PMPANTS_2
file:
python_requirement(
name='gdal',
requirements=['gdal==3.6.4'],
dependencies=[":numpy"],)
???refined-addition-53644
05/19/2023, 7:46 PMnumpy
similarly somewhereambitious-spoon-69726
05/19/2023, 7:59 PMpython_requirement(
name='numpy',
requirements=['numpy==1.23.5'])
However, I can tell that it's not honoring the order because the gdal_array
functions are not getting installed (they typically do not if numpy
hasn't been installed at the time that gdal
is being installed).refined-addition-53644
05/19/2023, 8:02 PMambitious-spoon-69726
05/19/2023, 8:02 PMrefined-addition-53644
05/19/2023, 8:09 PMgdal_array
doesn't define its dependency on numpy
explicitly. Hence you are forcing it to depend on numpy
this way.
I don't know about gdal_array
and hence I was asking.ambitious-spoon-69726
05/19/2023, 8:11 PMgdal_array
package gets built / compiled if numpy
is available when gdal
is installed. numpy
is not a dependency inside of gdal
(which is frustrating)... but if numpy
happens to be installed, then the array
functions (via gdal_array
are built). Hence trying to force numpy
to get installed before gdal
is installed....refined-addition-53644
05/19/2023, 8:14 PMnumpy
? I tried to directly do a pip install and it shows a warning and fails with error for some missing config
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [86 lines of output]
WARNING: numpy not available! Array support will not be enabled
....
raise gdal_config_error(e)
gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
[end of output]
ambitious-spoon-69726
05/19/2023, 8:15 PMrefined-addition-53644
05/19/2023, 8:16 PMpip install gdal
ambitious-spoon-69726
05/19/2023, 8:16 PMambitious-spoon-69726
05/19/2023, 8:19 PMpython (3.11)
. NOTE that this python already has numpy
installed before GDAL is built. Then, trying to use pants to build, and the system GDAL and libraries are installed, but because it's a new virtual environment.. GDAL has to be reinstalled [but the environment variables and LD_LIBRARY environment variables ensure that GDAL is locatable]. The issue is that the virtual environment that pants builds doesn't install numpy before gdal... 😐refined-addition-53644
05/19/2023, 8:26 PMrefined-addition-53644
05/19/2023, 8:34 PMLD_LIBRARY
envs as described here
https://www.pantsbuild.org/docs/reference-subprocess-environment#advanced-options
Inside pants.toml
[subprocess-environment]
env_vars.add = ["<insert_LD_LIB_var>"]
ambitious-spoon-69726
05/19/2023, 8:44 PM... ⠋ 79.86s Building requirements.pex with 44 requirements
refined-addition-53644
05/19/2023, 8:51 PMambitious-spoon-69726
05/19/2023, 9:25 PMambitious-spoon-69726
05/19/2023, 9:25 PMnumpy
before doing anything else?broad-processor-92400
05/20/2023, 2:04 AMgdal
pants will also make sure that numpy
is available. I don't know of a way to carefully control the environment in which pex (which pants uses for python requirements) runs pip to build the package into wheels (these wheels are then used as the actual runtime packages).
I believe one option for finnicky package-building problems is to pre-build wheels/bdists, and publish them to an internal index, and have pants/pex consume those wheels, rather than the PyPI sdistsenough-analyst-54434
05/20/2023, 3:34 AMenough-analyst-54434
05/20/2023, 3:48 AM