pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)
https://pyproj4.github.io/pyproj
MIT License
1.07k stars 215 forks source link

WHL: MacOS arm64 for 3.3.1 #1105

Closed vot4anto closed 2 years ago

vot4anto commented 2 years ago

Problem description

I'm a member of GEM Foundation and our software use pyproj. We need to build wheel for our installation process. Follow our repo github: https://github.com/gem/oq-engine

I have problem with the wheel on M1 for pyproj 3.3.1. I use your scripts to built the wheel and also if the process to built the wheel is success without any error when I try to use the wheel I have the follow:

UserWarning: Valid PROJ data directory not found. Either set the path using the environmental variable PROJ_LIB or with `pyproj.datadir

Is I use the same method for the main of the repository I can built the wheel for 3.3.2.dev0 without any issue. I need to set other environment variables to use with cibuildwheel? Follow the github action that is in use to built the wheel: https://github.com/gem/oq-builders/runs/7315123587?check_suite_focus=true

Expected Output

% pyproj -v pyproj info: pyproj: 3.3.1 PROJ: 8.2.1 data dir: /opt/homebrew/share/proj user_data_dir: /Users/runner/Library/Application Support/proj PROJ DATA (recommended version): 1.10 PROJ Database: 1.2 EPSG Database: v10.064 [2022-05-19] ESRI Database: ArcMap 12.9 [2022-02-18] IGNF Database: 3.1.0 [2019-05-24]

System: python: 3.9.13 (main, May 24 2022, 21:13:51) [Clang 13.1.6 (clang-1316.0.21.2)] executable: /opt/homebrew/opt/python@3.9/bin/python3.9 machine: macOS-12.4-arm64-arm-64bit

Python deps: /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_distutils_hack/init.py:30: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") certifi: 2022.06.15 Cython: None setuptools: 62.3.2 pip: 22.1.1

And you can find the wheel at this link:

https://wheelhouse.openquake.org/macos/arm64/pyproj-3.3.2.dev0-cp39-cp39-macosx_11_0_arm64.whl https://wheelhouse.openquake.org/macos/arm64/pyproj-3.3.1-cp39-cp39-macosx_11_0_arm64.whl

vot4anto commented 2 years ago

I solved the issue of building the wheel. All trouble is with the this block of setup.py:

# setup package data 
   package_data = {"pyproj": ["*.pyi", "py.typed"]} 
   if os.environ.get("PROJ_WHEEL") is not None and INTERNAL_PROJ_DIR.exists(): 
       package_data["pyproj"].append( 
           str(BASE_INTERNAL_PROJ_DIR / "share" / "proj" / "*") 
       ) 
   if ( 
       os.environ.get("PROJ_WHEEL") is not None 
       and (CURRENT_FILE_PATH / "pyproj" / ".lib").exists() 
   ): 
       package_data["pyproj"].append(os.path.join(".lib", "*")) 
   return package_data

I compile proj and also set PROJ_DIR outside of the repo folder from what I run the wheel process. After set PROJ_DIR == INTERNAL_PROJ_DIR and recompile all works fine

snowman2 commented 2 years ago

If you would like to see these wheels on pypi for pyproj, contributions are welcome: #1064