pyproj icon indicating copy to clipboard operation
pyproj copied to clipboard

Unable to install using pip on Cygwin

Open Joshua-IRT opened this issue 1 year ago • 4 comments

Installation method/steps

  • First, PROJ was installed using the Cygwin package installation tool.
  • Then attempted to install pyproj using pip: pip3 install pyproj

Environment Information

  • pyproj version you are attempting to install = 3.3.1
  • PROJ version = Rel. 9.0.1, June 15th, 2022
  • Python version = 3.9.10 (main, Jan 20 2022, 21:37:52) [GCC 11.2.0]
  • Operation System Information = CYGWIN_NT-10.0-19044-3.3.5-341.x86_64-x86_64-64bit-WindowsPE

Output

Collecting pyproj
  Using cached pyproj-3.3.1.tar.gz (219 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: certifi in /usr/local/lib/python3.9/site-packages/certifi-2022.6.15-py3.9.egg (from pyproj) (2022.6.15)
Building wheels for collected packages: pyproj
  Building wheel for pyproj (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.9.exe /usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp9ncdrpiz
       cwd: /tmp/pip-install-adnywux0/pyproj_fcd15a1a2bd6421a880e98878bf6fbc6
  Complete output (49 lines):
  /tmp/pip-build-env-5yak_mea/overlay/lib/python3.9/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
    warnings.warn(msg, warning_class)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.cygwin-3.3.5-x86_64-cpython-39
  creating build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/aoi.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/datadir.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/enums.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/exceptions.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/geod.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/network.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/proj.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/sync.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/transformer.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/utils.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_show_versions.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/__init__.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/__main__.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  creating build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/coordinate_operation.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/coordinate_system.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/crs.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/datum.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/enums.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/_cf1x8.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/crs/__init__.py -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/crs
  copying pyproj/database.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/list.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_compat.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_crs.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_datadir.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_geod.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_network.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_sync.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/_transformer.pyi -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  copying pyproj/py.typed -> build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj
  running build_ext
  building 'pyproj._geod' extension
  creating build/temp.cygwin-3.3.5-x86_64-cpython-39
  creating build/temp.cygwin-3.3.5-x86_64-cpython-39/pyproj
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include -I/usr/include/python3.9 -c pyproj/_geod.c -o build/temp.cygwin-3.3.5-x86_64-cpython-39/pyproj/_geod.o
  gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-3.3.5-x86_64-cpython-39/pyproj/_geod.o -L/usr/lib -L/usr/lib/python3.9/config -L/usr/lib -Wl,--enable-new-dtags,-R/usr/lib -lproj -lpython3.9 -o build/lib.cygwin-3.3.5-x86_64-cpython-39/pyproj/_geod.cpython-39-x86_64-cygwin.dll
  /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: unrecognized option '--enable-new-dtags'
  /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: use the --help option for usage information
  collect2: error: ld returned 1 exit status
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pyproj
Failed to build pyproj
ERROR: Could not build wheels for pyproj, which is required to install pyproject.toml-based projects

The issue appears to be that --enable-new-dtags is being selected despite this not applying to the Cygwin environment.

Joshua-IRT avatar Jul 26 '22 04:07 Joshua-IRT

This appears to be an upstream issue in setuptools in the Cygwin environment, rather than an issue with pyproj itself. I have opened an issue there instead: https://github.com/pypa/distutils/issues/171

Joshua-IRT avatar Jul 26 '22 08:07 Joshua-IRT

Try changing line 170 of setup.py to also test for sys.platform != "cygwin", does that solve your problem?

DWesl avatar Aug 16 '22 13:08 DWesl

Try changing line 170 of setup.py to also test for sys.platform != "cygwin", does that solve your problem?

Thank you, that resolved the problem and pyproj now installs (and imports) successfully under Cygwin:

$ pip3 install ./pyproj-3.3.1
Processing ./pyproj-3.3.1
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: certifi in /usr/local/lib/python3.9/site-packages/certifi-2022.6.15-py3.9.egg (from pyproj==3.3.1) (2022.6.15)
Building wheels for collected packages: pyproj
  Building wheel for pyproj (pyproject.toml) ... done
  Created wheel for pyproj: filename=pyproj-3.3.1-cp39-cp39-cygwin_3_3_5_x86_64.whl size=2167286 sha256=aa44da140185d4a377686a6a94f55d2e866a9bc06ef767e7bbf48160931d616a
  Stored in directory: /home/[user]/.cache/pip/wheels/a7/e1/68/80ef2e9f0e7d70ef66ce8b121becdaaf4b74a620f91e84b194
Successfully built pyproj
Installing collected packages: pyproj
  Attempting uninstall: pyproj
    Found existing installation: pyproj 3.3.1
    Uninstalling pyproj-3.3.1:
      Successfully uninstalled pyproj-3.3.1
Successfully installed pyproj-3.3.1

$ python3
Python 3.9.10 (main, Jan 20 2022, 21:37:52)
[GCC 11.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyproj
>>>

Joshua-IRT avatar Aug 17 '22 00:08 Joshua-IRT

That sounds like a good change to add to the code. A PR is welcome if someone has the time.

snowman2 avatar Aug 17 '22 01:08 snowman2

#1120 should be similar to what Joshua-IRT got working

DWesl avatar Aug 20 '22 13:08 DWesl