在Python中解决MoviePy部署问题。

huangapple go评论75阅读模式
英文:

Troubleshooting MoviePy Deployment Issues in Python

问题

我可以提供以下部分的翻译:

"我的代码目前在本地机器上使用moviepy在Flask中运行正常,我想将其部署为Web应用程序。我成功地在Heroku上部署了它,使用了这个构建包:https://github.com/ello/heroku-buildpack-imagemagick。然而,它消耗了太多的RAM,我负担不起每月500美元的4GB RAM套餐。现在我正在尝试在Google App Engine标准环境上部署它,但是我遇到了这个错误:这个错误可能是因为您的计算机上没有安装ImageMagick。请您提出最佳的部署解决方案。"

英文:

My code is currently working on my local machine with moviepy in flask, and I want to deploy it as a web application. I was able to successfully deploy it on Heroku using this buildpack: https://github.com/ello/heroku-buildpack-imagemagick. However, it's consuming too much RAM, and I can't afford the $500 package for 4GB of RAM. I'm now trying to deploy it on the Google App Engine standard environment, but I'm getting this error: This error may be due to the fact that ImageMagick is not installed on your computer. Can you please suggest the best solution for deploying it?

I was able to successfully deploy it on Heroku using this buildpack: https://github.com/ello/heroku-buildpack-imagemagick.

答案1

得分: 0

  1. GAE Standard使用pip来安装您的requirements.txt文件中的内容(查看文档)。 pip 用于从PyPI(Python包索引)直接下载和安装软件包。

  2. 您引用的构建包会下载并安装imagemagick。如果您查看构建包,您会注意到imagemagick 是从自定义网址下载的。这意味着它不在PyPI上,因此不能仅通过pip install <package>来安装。

  3. 如果您必须使用GAE Standard,则可能有两个选项可供尝试:

    i) 下载/安装imagemagick 到您的应用程序文件夹,并与您的应用程序一起部署(您必须确保所有用于访问它的相对URL正常工作)

    ii) 下载imagemagick 的tar文件到您的应用程序文件夹的根目录,并按照这里描述的方法将其添加到您的requirements.txt文件中,然后查看GAE Standard是否在部署过程中安装它

或者,您可以切换到Cloud Run,它允许您执行与您提到的构建包本质上相同的操作,即创建一个Docker文件,发出命令从任何URL下载/安装您想要的内容,然后发出命令来安装您的requirements.txt文件的内容。

英文:
  1. GAE Standard installs the contents of your requirements.txt file using pip (see documentation). pip is used to download and install packages directly from PyPI (Python Package Index)

  2. The buildpack you referenced downloads and installs imagemagick. If you look at the buildpack, you'll notice that imagemagick is being downloaded from a custom url. This means it isn't on PyPI and so can't be installed by just calling pip install <package>

  3. If you must use GAE Standard, then there might be 2 options you can try

    i) Download/install imagemagick to your Application folder and deploy it together with your App (you'll have to make sure all relative urls for accessing it works)

    ii) Download the tar file of imagemagick to the root of your Application folder and add it to your requirements.txt file using the method described here and then see if GAE standard installs it during deployment

Alternatively, you can switch to Cloud Run which allows you to do essentially the same thing as the build pack you mentioned i.e. you create a docker file, issue commands to download/install what you want from whatever url, then issue commands to install the contents of your requirements.txt file

huangapple
  • 本文由 发表于 2023年5月7日 04:26:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76190983.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定