0

我想在 Docker 上的 Debian 上安装 pyproj。

这是我的脚本:

FROM debian:latest

RUN /bin/bash -c 'apt-get update && \
  DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-utils && \
  DEBIAN_FRONTEND=noninteractive apt-get install -yq \
  libpython3-dev \
  python3-pip \
  proj-bin \
  curl \
  libcurl4-gnutls-dev \
  wget \
  sqlite3 \
  node-sqlite3 \
  libsqlite3-dev \
  libtiff5 \
  libtiff5-dev \
  make \
  python-rtree && \
  apt-get upgrade -yq && \
  apt-get clean && \
  apt-get update \
  '
RUN  wget https://download.osgeo.org/proj/proj-7.2.0.tar.gz
RUN  tar -xvzf proj-7.2.0.tar.gz
RUN  cd proj-7.2.0/  &&  ./configure  &&  make  &&  make install
RUN  find / -name proj
RUN /bin/bash -c 'rm -rf /var/lib/apt/lists/* && \
  
  pip3 install \ 
  pyproj --no-binary pyproj \
  '

这是输出:

Step 6/7 : RUN  find / -name proj
 ---> Running in 6ae2ce5a5157
/usr/share/proj
/usr/local/share/proj
/usr/local/include/proj
/usr/local/bin/proj
/usr/bin/proj
/proj-7.2.0/src/.libs/proj
/proj-7.2.0/src/proj
/proj-7.2.0/include/proj
Removing intermediate container 6ae2ce5a5157
 ---> 9e652a740f23
Step 7/7 : RUN /bin/bash -c 'rm -rf /var/lib/apt/lists/* &&   pip3 install   pyproj --no-binary pyproj   '
 ---> Running in 2fa15199039b
Collecting pyproj
  Downloading https://files.pythonhosted.org/packages/17/e5/3f5cdff3e955bcd768cdb0f4236f2d6e022aaa72f57caf7f4d5f552c88fc/pyproj-3.0.0.post1.tar.gz (663kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-r4rvjbmz/pyproj/setup.py", line 224, in <module>
        ext_modules=get_extension_modules(),
      File "/tmp/pip-install-r4rvjbmz/pyproj/setup.py", line 155, in get_extension_modules
        proj_version = get_proj_version(proj_dir)
      File "/tmp/pip-install-r4rvjbmz/pyproj/setup.py", line 22, in get_proj_version
        proj_ver = subprocess.check_output(str(proj), stderr=subprocess.STDOUT).decode(
      File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
        **kwargs).stdout
      File "/usr/lib/python3.7/subprocess.py", line 487, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '/usr/local/bin/proj' returned non-zero exit status 127.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-r4rvjbmz/pyproj/

早些时候我尝试通过 pip 安装 pyproj,它会将 PROJ 作为依赖项安装,但版本错误。这就是为什么我切换到通过 wget 安装二进制文件的原因。

另外,我给出了一个 find 输出来表明 proj 实际上是在正确的位置。

有什么建议么?

4

1 回答 1

1

https://pyproj4.github.io/pyproj/stable/installation.html

我会推荐:

  1. 升级到 pip>=19,这样 PROJ 7.2 就在轮子上了。
  2. ENV PROJ_DIR=/path/to/proj/install当您安装 PROJ 时:./configure --prefix $PROJ_DIR
于 2020-11-11T21:15:45.410 回答