【问题标题】:/usr/bin/ld: cannot find -lblas while APT-installing GPAW on Heroku: ASE/usr/bin/ld: 在 Heroku 上安装 GPAW 时找不到 -lblas: ASE
【发布时间】:2022-06-15 09:36:14
【问题描述】:

我正在尝试在我的 Heroku 服务器上安装 GPAW;我已经使用 Heroku 的 APT buildpack 添加了所有 APT 依赖项,并部署了包含 PIP GPAW 依赖项的代码。问题是,它会抛出一个名为 /usr/bin/ld: cannot find -lblas 的错误,这让我的 h**k 无法正常工作。

这是我的 Aptfile,其中包含 Heroku 部署的所有 APT 依赖项:

build-essential binutils python3-dev gfortran liblapack-dev libopenblas-dev libxc-dev libscalapack-mpi-dev libfftw3-dev ase gpaw

要查看 Heroku 上的完整错误消息:

DGPAW_NO_UNDERSCORE_CSCALAPACK=1 -UNDEBUG -I/app/.heroku/python/include/python3.10 -I/app/.heroku/python/lib/python3.10/site-packages/numpy/core/include -c c/xc/xc.c -o build/temp.linux-x86_64-3.10/c/xc/xc.o -Wall -Wno-unknown-pragmas -std=c99
             gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DNPY_NO_DEPRECATED_API=7 -DGPAW_NO_UNDERSCORE_CBLACS=1 -DGPAW_NO_UNDERSCORE_CSCALAPACK=1 -UNDEBUG -I/app/.heroku/python/include/python3.10 -I/app/.heroku/python/lib/python3.10/site-packages/numpy/core/include -c c/xc/xc_mgga.c -o build/temp.linux-x86_64-3.10/c/xc/xc_mgga.o -Wall -Wno-unknown-pragmas -std=c99
             gcc -pthread -shared build/temp.linux-x86_64-3.10/c/_gpaw.o build/temp.linux-x86_64-3.10/c/bc.o build/temp.linux-x86_64-3.10/c/blacs.o build/temp.linux-x86_64-3.10/c/blas.o build/temp.linux-x86_64-3.10/c/bmgs/bmgs.o build/temp.linux-x86_64-3.10/c/constraints.o build/temp.linux-x86_64-3.10/c/elpa.o build/temp.linux-x86_64-3.10/c/fd_preconditioner.o build/temp.linux-x86_64-3.10/c/fftw.o build/temp.linux-x86_64-3.10/c/lcao.o build/temp.linux-x86_64-3.10/c/lfc.o build/temp.linux-x86_64-3.10/c/lfc2.o build/temp.linux-x86_64-3.10/c/mpi.o build/temp.linux-x86_64-3.10/c/operators.o build/temp.linux-x86_64-3.10/c/plane_wave.o build/temp.linux-x86_64-3.10/c/plt.o build/temp.linux-x86_64-3.10/c/point_charges.o build/temp.linux-x86_64-3.10/c/spline.o build/temp.linux-x86_64-3.10/c/symmetry.o build/temp.linux-x86_64-3.10/c/tetra.o build/temp.linux-x86_64-3.10/c/transformers.o build/temp.linux-x86_64-3.10/c/utilities.o build/temp.linux-x86_64-3.10/c/wigner_seitz.o build/temp.linux-x86_64-3.10/c/woperators.o build/temp.linux-x86_64-3.10/c/xc/ensemble_gga.o build/temp.linux-x86_64-3.10/c/xc/libvdwxc.o build/temp.linux-x86_64-3.10/c/xc/libxc.o build/temp.linux-x86_64-3.10/c/xc/m06l.o build/temp.linux-x86_64-3.10/c/xc/pbe.o build/temp.linux-x86_64-3.10/c/xc/pw91.o build/temp.linux-x86_64-3.10/c/xc/revtpss.o build/temp.linux-x86_64-3.10/c/xc/revtpss_c_pbe.o build/temp.linux-x86_64-3.10/c/xc/rpbe.o build/temp.linux-x86_64-3.10/c/xc/tpss.o build/temp.linux-x86_64-3.10/c/xc/vdw.o build/temp.linux-x86_64-3.10/c/xc/xc.o build/temp.linux-x86_64-3.10/c/xc/xc_mgga.o -lxc -lblas -o build/lib.linux-x86_64-3.10/_gpaw.cpython-310-x86_64-linux-gnu.so
             /usr/bin/ld: cannot find -lblas
             collect2: error: ld returned 1 exit status
             error: command '/usr/bin/gcc' failed with exit code 1
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.
       error: legacy-install-failure
       
       × Encountered error while trying to install package.
       ╰─> gpaw
       
       note: This is an issue with the package mentioned above, not pip.
       hint: See above for output from the failure.
 !     Push rejected, failed to compile Python app.
 !     Push failed

任何帮助将不胜感激,如果没有伟大的 StackOverFlow 社区的帮助,我不知道我会在哪里!

如果你想查看完整代码,click here

【问题讨论】:

    标签: python heroku


    【解决方案1】:

    我通过在 Linux 机器上运行 apt-get install openblas-dev 设法解决了这个问题。 (或者在 Mac 上,你可以使用brew 来安装相同的包)在blas 的情况下,Windows 机器没有稳定的发行版,但是由于 Heroku 运行在 Ubuntu 之上,我使用 Docker 来容器化应用程序并在下面写了这个 Dockerfile:

    # FOR FRONT-END DEPLOYMENT... (REACT)
    FROM node:16-alpine as build-step
    WORKDIR /app
    ENV PATH /app/client/node_modules/.bin:$PATH
    COPY yarn.lock ./
    COPY client ./client
    WORKDIR /app/client
    RUN yarn install
    RUN yarn build
    
    # FOR BACK-END DEPLOYMENT... (FLASK)
    FROM python:3.10.4-slim
    WORKDIR /
    # Don't forget "--from"! It acts as a bridge that connects two seperate stages
    COPY --from=build-step app ./app
    WORKDIR /app
    RUN apt-get update && apt-get install -y python3-dev gfortran libopenblas-dev libxc-dev libscalapack-mpi-dev libfftw3-dev
    COPY requirements.txt ./
    RUN pip3 install -r ./requirements.txt
    # Pretty much pass everything in the root folder except for the client folder, as we do NOT want to overwrite the pre-generated client folder that is already in the ./app folder
    COPY electron_visualized.py .flaskenv ./
    COPY server ./server
    EXPOSE 5000
    ENTRYPOINT ["python"]
    CMD ["electron_visualized.py"]
    
    # THIS IS CALLED MULTI-STAGE BUILDING IN DOCKER
    

    P/S:我在 React + Flask 堆栈之上运行它。

    【讨论】:

      猜你喜欢
      • 2021-05-07
      • 2018-10-01
      • 2020-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-28
      • 2011-07-16
      • 2012-05-20
      相关资源
      最近更新 更多