conda-forge / pyproj-feedstock

A conda-smithy repository for pyproj.
BSD 3-Clause "New" or "Revised" License
2 stars 15 forks source link

CRS transformer gives different results when installed via conda-forge vs pypi #149

Closed deniederhut closed 1 month ago

deniederhut commented 1 month ago

Solution to issue cannot be found in the documentation.

Issue

When using pyproj.Transformer, the results are different in conda environments where pyproj was installed via conda-forge versus environments where pyproj was installed via pip.

Briefly, one environment returns (3116323.5569992694, 10074358.862867432) and the other returns (3116322.1679980303, 10074357.149642758) on the same CRS pair and lat/lon pair (Scholz Garden in Austin 😄). It's not clear to me why this would happen or which pair of values is correct, but it was different enough to trigger a regression test in CI after I changed the source from pypi to conda-forge.

conda-forge installation details

So, e.g. this environment spec: ```yaml name: pyproj-conda channels: - conda-forge - defaults dependencies: - python=3.9 - scipy - numba - numpy - pandas - pyarrow - pyproj==3.6.1 - pip ``` gives this pyproj installation: ``` pyproj info: pyproj: 3.6.1 PROJ: 9.4.0 data dir: .../envs/pyproj-conda/share/proj user_data_dir: .../Library/Application Support/proj PROJ DATA (recommended version): 1.17 PROJ Database: 1.3 EPSG Database: v11.004 [2024-02-24] ESRI Database: ArcGIS Pro 3.2 [2023-11-02] IGNF Database: 3.1.0 [2019-05-24] System: python: 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:53:33) [Clang 16.0.6 ] executable: .../envs/pyproj-conda/bin/python machine: macOS-14.4.1-x86_64-i386-64bit Python deps: certifi: 2024.2.2 Cython: None setuptools: 69.5.1 pip: 24.0 ``` and this result for a lookup of a particular lat/lon ```python >>> from pyproj import Transformer >>> transformer.from_crs('EPSG:4326', 'EPSG:2277') >>> transformer = Transformer.from_crs('EPSG:4326', 'EPSG:2277') >>> transformer.transform(30.277843930587345, -97.73617262622221) (3116323.5569992694, 10074358.862867432) ```

pip installation details

whereas this environment spec: ```yaml name: pyproj-pip channels: - conda-forge - defaults dependencies: - python=3.9 - scipy - numba - numpy - pandas - pyarrow - pip - pip: - pyproj==3.6.1 ``` gives this pyproj installation ``` pyproj info: pyproj: 3.6.1 PROJ: 9.3.0 data dir: .../envs/pyproj-pip/lib/python3.9/site-packages/pyproj/proj_dir/share/proj user_data_dir: .../Library/Application Support/proj PROJ DATA (recommended version): 1.15 PROJ Database: 1.2 EPSG Database: v10.094 [2023-08-08] ESRI Database: ArcGIS Pro 3.1 [2023-19-01] IGNF Database: 3.1.0 [2019-05-24] System: python: 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:53:33) [Clang 16.0.6 ] executable: .../envs/pyproj-pip/bin/python machine: macOS-14.4.1-x86_64-i386-64bit Python deps: certifi: 2024.2.2 Cython: None setuptools: 69.5.1 pip: 24.0 ``` and this, slightly different, set of values for the same lat/lon pair: ```python >>> from pyproj import Transformer >>> transformer = Transformer.from_crs('EPSG:4326', 'EPSG:2277') >>> transformer.transform(30.277843930587345, -97.73617262622221) (3116322.1679980303, 10074357.149642758) ``` ### Installed packages ```shell # packages in environment at .../envs/pyproj-conda: # # Name Version Build Channel aws-c-auth 0.7.18 ha578917_3 conda-forge aws-c-cal 0.6.12 h7d0aca8_0 conda-forge aws-c-common 0.9.17 hec52a4b_0 conda-forge aws-c-compression 0.2.18 h94d6f14_4 conda-forge aws-c-event-stream 0.4.2 he2569f2_9 conda-forge aws-c-http 0.8.1 h0f62bc1_12 conda-forge aws-c-io 0.14.7 hb30fd87_9 conda-forge aws-c-mqtt 0.10.4 h4c8fe3b_1 conda-forge aws-c-s3 0.5.7 h91d17e0_4 conda-forge aws-c-sdkutils 0.1.16 h94d6f14_0 conda-forge aws-checksums 0.1.18 h94d6f14_4 conda-forge aws-crt-cpp 0.26.8 h1422e4f_6 conda-forge aws-sdk-cpp 1.11.267 h764722f_8 conda-forge bzip2 1.0.8 h10d778d_5 conda-forge c-ares 1.28.1 h10d778d_0 conda-forge ca-certificates 2024.2.2 h8857fd0_0 conda-forge certifi 2024.2.2 pyhd8ed1ab_0 conda-forge gflags 2.2.2 hb1e8313_1004 conda-forge glog 0.7.0 h31b1b29_0 conda-forge krb5 1.21.2 hb884880_0 conda-forge lerc 4.0.0 hb486fe8_0 conda-forge libabseil 20240116.2 cxx17_hc1bcbd7_0 conda-forge libarrow 16.0.0 hb6a69ac_1_cpu conda-forge libarrow-acero 16.0.0 hf036a51_1_cpu conda-forge libarrow-dataset 16.0.0 hf036a51_1_cpu conda-forge libarrow-substrait 16.0.0 h85bc590_1_cpu conda-forge libblas 3.9.0 22_osx64_openblas conda-forge libbrotlicommon 1.1.0 h0dc2134_1 conda-forge libbrotlidec 1.1.0 h0dc2134_1 conda-forge libbrotlienc 1.1.0 h0dc2134_1 conda-forge libcblas 3.9.0 22_osx64_openblas conda-forge libcrc32c 1.1.2 he49afe7_0 conda-forge libcurl 8.7.1 h726d00d_0 conda-forge libcxx 17.0.6 h88467a6_0 conda-forge libdeflate 1.20 h49d49c5_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libev 4.33 h10d778d_2 conda-forge libevent 2.1.12 ha90c15b_1 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libgfortran 5.0.0 13_2_0_h97931a8_3 conda-forge libgfortran5 13.2.0 h2873a65_3 conda-forge libgoogle-cloud 2.23.0 h651e89d_1 conda-forge libgoogle-cloud-storage 2.23.0 ha67e85c_1 conda-forge libgrpc 1.62.2 h384b2fc_0 conda-forge libjpeg-turbo 3.0.0 h0dc2134_1 conda-forge liblapack 3.9.0 22_osx64_openblas conda-forge libllvm14 14.0.6 hc8e404f_4 conda-forge libnghttp2 1.58.0 h64cf6d3_1 conda-forge libopenblas 0.3.27 openmp_hfef2a42_0 conda-forge libparquet 16.0.0 h904a336_1_cpu conda-forge libprotobuf 4.25.3 h4e4d658_0 conda-forge libre2-11 2023.09.01 h81f5012_2 conda-forge libsqlite 3.45.3 h92b6c6a_0 conda-forge libssh2 1.11.0 hd019ec5_0 conda-forge libthrift 0.19.0 h064b379_1 conda-forge libtiff 4.6.0 h129831d_3 conda-forge libutf8proc 2.8.0 hb7f2c08_0 conda-forge libwebp-base 1.4.0 h10d778d_0 conda-forge libzlib 1.2.13 h8a1eda9_5 conda-forge llvm-openmp 18.1.5 h39e0ece_0 conda-forge llvmlite 0.42.0 py39he5a6977_1 conda-forge lz4-c 1.9.4 hf0c8a7f_0 conda-forge ncurses 6.5 h5846eda_0 conda-forge numba 0.59.1 py39hb7f44fa_0 conda-forge numpy 1.26.4 py39h28c39a1_0 conda-forge openssl 3.3.0 hd75f5a5_0 conda-forge orc 2.0.0 hf146577_1 conda-forge pandas 2.2.2 py39haf03413_0 conda-forge pip 24.0 pyhd8ed1ab_0 conda-forge proj 9.4.0 h23b96cc_1 conda-forge pyarrow 16.0.0 py39hbd905a8_0 conda-forge pyarrow-core 16.0.0 py39h8665caa_0_cpu conda-forge pyproj 3.6.1 py39hde0ae58_6 conda-forge python 3.9.19 h7a9c478_0_cpython conda-forge python-dateutil 2.9.0 pyhd8ed1ab_0 conda-forge python-tzdata 2024.1 pyhd8ed1ab_0 conda-forge python_abi 3.9 4_cp39 conda-forge pytz 2024.1 pyhd8ed1ab_0 conda-forge re2 2023.09.01 hb168e87_2 conda-forge readline 8.2 h9e318b2_1 conda-forge scipy 1.13.0 py39h72a3afc_1 conda-forge setuptools 69.5.1 pyhd8ed1ab_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.2.0 h6dc393e_1 conda-forge sqlite 3.45.3 h7461747_0 conda-forge tk 8.6.13 h1abcd95_1 conda-forge tzdata 2024a h0c530f3_0 conda-forge wheel 0.43.0 pyhd8ed1ab_1 conda-forge xz 5.2.6 h775f41a_0 conda-forge zstd 1.5.6 h915ae27_0 conda-forge ``` ### Environment info ```shell active environment : pyproj-conda active env location : .../envs/pyproj-conda shell level : 2 user config file : .../.condarc populated config files : conda version : 4.12.0 conda-build version : not installed python version : 3.9.19.final.0 virtual packages : __osx=10.16=0 __unix=0=0 __archspec=1=x86_64 base environment : ... (writable) conda av data dir : .../etc/conda conda av metadata url : None channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch package cache : .../pkgs .../.conda/pkgs envs directories : .../envs .../.conda/envs platform : osx-64 user-agent : conda/4.12.0 requests/2.31.0 CPython/3.9.19 Darwin/23.4.0 OSX/10.16 UID:GID : 502:20 netrc file : None offline mode : False ```
ocefpaf commented 1 month ago

I don't think this is a bug, just different versions of the underlying proj library. Conda-forge uses 9.4.0 and the wheel seems to be built against 9.3.0. See https://github.com/pyproj4/pyproj-wheels/blob/ae2b29839f5f96d0802fb17fc0445c50a5094204/config.sh#L9


Edit: It is not the version. See the comment below.

snowman2 commented 1 month ago

https://gis.stackexchange.com/a/463016/144357

deniederhut commented 1 month ago

Whoa, okay. Thanks for super quick reply!