pyproj icon indicating copy to clipboard operation
pyproj copied to clipboard

py-test import failure

Open gdt opened this issue 1 year ago • 0 comments

Problem description

I am updating the pkgsrc pkg for py-proj to 3.7.0. I do not have a clear memory of running tests before. In pkgsrc we invoked tests as 'make test' from the package directory, which invokes tests in a build-system-specific way in the build directory. This generally works, and it works with py-test which is normal.

Many packages load resources from the system rather than the build directory, making them not testable before install. As I generally don't try to fix those things, my normal practice is to install the new bits first and then test, so that test code that loads pyproj from /usr/pkg/lib/python3.12/site-packages/pyproj instead of the build dir will run as expected.

Then, I ran tests, and it failed to find _context. But, running the test program itself produced no errors, and I do see _context.so in the site-lib dir. ldd shows all its libs resolve ok.

Maybe it is trying to use the build tree? My build tree has _context.so and it looks normal:

> find . -name _context\*
./pyproj/_context.pxd
./pyproj/_context.pyi
./pyproj/_context.pyx
./pyproj/_context.c
./build/lib.netbsd-10.0_STABLE-amd64-cpython-312/pyproj/_context.pxd
./build/lib.netbsd-10.0_STABLE-amd64-cpython-312/pyproj/_context.pyi
./build/lib.netbsd-10.0_STABLE-amd64-cpython-312/pyproj/_context.pyx
./build/lib.netbsd-10.0_STABLE-amd64-cpython-312/pyproj/_context.so
./build/temp.netbsd-10.0_STABLE-amd64-cpython-312/pyproj/_context.o
$ pytest-3.12 
ImportError while loading conftest '/tmp/work/geography/py-proj/work/pyproj-3.7.0/test/conftest.py'.
test/conftest.py:10: in <module>
    import pyproj
pyproj/__init__.py:34: in <module>
    import pyproj.network
pyproj/network.py:10: in <module>
    from pyproj._context import _set_context_ca_bundle_path
E   ModuleNotFoundError: No module named 'pyproj._context'
$ python3.12 test/conftest.py 

Environment Information

pyproj info:
    pyproj: 3.7.0
PROJ (runtime): 9.5.0
PROJ (compiled): 9.5.0
  data dir: /usr/pkg/share/proj
user_data_dir: /home/gdt/.local/share/proj
PROJ DATA (recommended version): 1.19
PROJ Database: 1.4
EPSG Database: v11.016 [2024-08-31]
ESRI Database: ArcGIS Pro 3.3 [2024-08-16]
IGNF Database: 3.1.0 [2019-05-24]

System:
    python: 3.12.6 (main, Sep 18 2024, 14:20:12) [GCC 10.5.0]
executable: /usr/pkg/bin/python3.12
   machine: NetBSD-10.0_STABLE-amd64-x86_64-64bit-ELF

Python deps:
   certifi: 2024.8.30
    Cython: 3.0.11
setuptools: 75.1.0
       pip: None

gdt avatar Oct 01 '24 13:10 gdt