pyproj: PROJ 9.1.1 doesn't work with Global Context

https://github.com/pyproj4/pyproj/actions/runs/3596938993/jobs/6058180954

=================================== FAILURES ===================================
___________________ test_transformer_group__network_disabled ___________________

    @pytest.mark.grid
    @patch.dict("os.environ", {"PROJ_NETWORK": "ON"}, clear=True)
    def test_transformer_group__network_disabled():
        with proj_network_env():
            pyproj.network.set_network_enabled(active=False)
>           trans_group = TransformerGroup(4326, 2964)

test/test_transformer.py:869: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyproj/transformer.py:197: in __init__
    super().__init__(
pyproj/_transformer.pyx:215: in pyproj._transformer._TransformerGroup.__init__
    _Transformer._from_pj(
pyproj/_transformer.pyx:563: in pyproj._transformer._Transformer._from_pj
    transformer._init_from_crs(always_xy)
pyproj/_transformer.pyx:614: in pyproj._transformer._Transformer._init_from_crs
    self._initialize_from_projobj()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   raise ProjError("Input is not a transformation.")
E   pyproj.exceptions.ProjError: Input is not a transformation.: (Internal Proj Error: pipeline: Pipeline: Bad step definition: inv (File not found or invalid))

pyproj/_transformer.pyx:324: ProjError
------------------------------ Captured log call -------------------------------
DEBUG    pyproj:transformer.py:197 PROJ_ERROR: hgridshift: could not find required grid(s).
DEBUG    pyproj:transformer.py:197 PROJ_ERROR: pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
____________________ test_transformer_group__download_grids ____________________

get_user_data_dir_mock = <MagicMock name='get_user_data_dir' id='140700317128784'>
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-2/test_transformer_group__downlo0')
capsys = <_pytest.capture.CaptureFixture object at 0x7ff7586c11f0>

    @pytest.mark.grid
    @pytest.mark.network
    @patch("pyproj.transformer.get_user_data_dir")
    def test_transformer_group__download_grids(get_user_data_dir_mock, tmp_path, capsys):
        get_user_data_dir_mock.return_value = str(tmp_path)
        with proj_network_env():
            pyproj.network.set_network_enabled(active=False)
>           trans_group = TransformerGroup(4326, 2964)
E   pyproj.exceptions.ProjError: Input is not a transformation.: (Internal Proj Error: pipeline: Pipeline: Bad step definition: inv (File not found or invalid))

pyproj/_transformer.pyx:324: ProjError
------------------------------ Captured log call -------------------------------
DEBUG    pyproj:transformer.py:197 PROJ_ERROR: hgridshift: could not find required grid(s).
DEBUG    pyproj:transformer.py:197 PROJ_ERROR: pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
____________ test_coordinate_operation_grids__alternative_grid_name ____________

    @pytest.mark.grid
    def test_coordinate_operation_grids__alternative_grid_name():
        cc = CoordinateOperation.from_epsg(1312, True)
        assert len(cc.grids) == 1
        grid = cc.grids[0]
        assert grid.direct_download is True
        assert grid.open_license is True
        assert grid.short_name == "ca_nrc_ntv1_can.tif"
        assert grid.package_name == ""
        assert grid.url == "https://cdn.proj.org/ca_nrc_ntv1_can.tif"
        if (PROJ_GTE_91 and grids_available(grid.short_name, check_network=False)) or (
            not PROJ_GTE_91 and grids_available(grid.short_name)
        ):
            assert grid.available is True
            assert grid.full_name.endswith(grid.short_name)
        elif PROJ_GTE_911 and pyproj.network.is_network_enabled():
            assert grid.available is True
>           assert grid.full_name == grid.url
E           AssertionError: assert '' == 'https://cdn...._ntv1_can.tif/'
E             - https://cdn.proj.org/ca_nrc_ntv1_can.tif

test/crs/test_crs.py:622: AssertionError
=============================== warnings summary ===============================
test/test_datadir.py::test_get_data_dir__from_user[str]
test/test_datadir.py::test_get_data_dir__from_user[Path]
test/test_datadir.py::test_append_data_dir__internal[str]
test/test_datadir.py::test_append_data_dir__internal[Path]
  /home/runner/work/pyproj/pyproj/pyproj/datadir.py:38: UserWarning: pyproj unable to set database path.
    _global_context_set_data_dir()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test/test_transformer.py::test_transformer_group__network_disabled - pyproj.exceptions.ProjError: Input is not a transformation.: (Internal Proj Error: pipeline: Pipeline: Bad step definition: inv (File not found or invalid))
FAILED test/test_transformer.py::test_transformer_group__download_grids - pyproj.exceptions.ProjError: Input is not a transformation.: (Internal Proj Error: pipeline: Pipeline: Bad step definition: inv (File not found or invalid))
FAILED test/test_transformer.py::test_transformer_group__download_grids__directory - pyproj.exceptions.ProjError: Input is not a transformation.: (Internal Proj Error: pipeline: Pipeline: Bad step definition: inv (File not found or invalid))
FAILED test/crs/test_crs.py::test_coordinate_operation_grids__alternative_grid_name - AssertionError: assert '' == 'https://cdn...._ntv1_can.tif/'
  - https://cdn.proj.org/ca_nrc_ntv1_can.tif
============ 4 failed, 832 passed, 5 skipped, 4 warnings in 22.53s =============

Going to need to do a git bisect with PROJ.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (20 by maintainers)

Commits related to this issue

Most upvoted comments

Is it really PROJ 9.1.1 specific ?

It seems to be the case. Testing 9.1.0 wheel building in #1195.

https://github.com/pyproj4/pyproj/actions/runs/3662102493/jobs/6190946199

All of the tests are passing.

ok, you’ll probably have to identify the minimum sequence of PROJ operations that trigger the bug (since I assume those failing tests work when run individually?)