如何在弹性魔豆安装matplotlib弹性、魔豆、如何在、matplotlib

2023-09-11 10:27:26 作者:北船余音

由于matplotlib需要numpy的已经安装,我遇到了一个问题。

Because matplotlib needs numpy to already be installed, I have run into an issue.

要在我的弹性魔豆环境中安装其它Python包,我使用PIP requirements.txt文件。因为设置配置自动安装按字母顺序排列的包,matplotlib总是先安装这会导致一个错误。

To install other python packages on my Elastic Beanstalk environment, I use the pip requirements.txt file. Because the setup configuration automatically installs the packages in alphabetical order, matplotlib always is installed first which causes an error.

有没有人有这个问题,知道的方式成功地解决它?

Has anyone had this problem and know of a way to successfully fix it?

推荐答案

我一直在打我的头撞墙用这个了好几天,但似乎如果你想安装matplotlib / SciPy的/使用要求scikit学习txt文件,你需要一个时间做一个模块。

I have been beating my head against the wall with this for several days but it seems that if you want to install matplotlib/scipy/scikit-learn using a requirements.txt file you need to do things one module at a time.

我已经能够明白的是,弹性魔豆包未安装在虚拟环境中的站点包目录中,直到它通过整个requirements.txt文件成功合作的方式。

What I have been able to understand is that on Elastic Beanstalk packages are not installed in the site-packages directory of the virtual environment until it has successfully worked its way through the entire requirements.txt file.

所以,举例来说,如果你尝试安装numpy的和SciPy的在同一时间,因为我在做什么,它会失败,因为SciPy的找不到某些numpy的模块(numpy.distutils.core明确)。 numpy的是坐在的/ opt /蟒蛇/运行/ venv /编译等待去,但PIP正在寻找在的/ opt /蟒蛇/运行/ venv / LIB / python2.6的/站点包并没有找到numpy的。

So for example if you try to install numpy and scipy at the same time, as I was doing, it will fail because scipy cannot find certain numpy modules (numpy.distutils.core specifically). Numpy is sitting in /opt/python/run/venv/build waiting to go but pip is looking in /opt/python/run/venv/lib/python2.6/site-packages and doesn't find numpy.

您需要做一个只有numpy的承诺在您requirements.txt文件,推动这一长达弹性魔豆。如果成功的numpy的模块将在合适的地方,然后你可以做一个第二,要求更新到SciPy的或matplotlib在您的案件提交。

You need to make one commit with only numpy in your requirements.txt file and push this up to Elastic Beanstalk. If this succeeds the numpy module will be in the right place and then you can make a second commit with requirements updated to scipy or matplotlib in your case.

注意在.ebextensions您的配置文件,你需要有列出的所有依赖关系。具体而言,在 .ebextensions / myapp.config顶部你应该有

Be careful with your configuration file in .ebextensions, you need to have all the dependencies listed. Specifically, at the top of .ebextensions/myapp.config you should have

packages:
  yum:
    gcc-c++: []
    gcc-gfortran: []
    python-devel: []
    atlas-sse3-devel: []
    lapack-devel: []
    libpng-devel: []
    freetype-devel: []
    zlib-devel: []

寰-SSE3-devel软件包 LAPACK-devel软件包如果你想需要SciPy的和的libpng-devel软件包的FreeType-devel软件包的zlib-devel软件包都需要matplotlib

atlas-sse3-devel and lapack-devel are needed if you want scipy and libpng-devel, freetype-devel, and zlib-devel are needed for matplotlib.

另一种方法是使用SSH与您的弹性魔豆的应用程序相关的EC2实例,启动虚拟环境中(源的/ opt /蟒蛇/运行/ venv /斌/启动)和PIP自己安装的软件包。

The other alternative is to SSH to the ec2 instance associated with your app on Elastic Beanstalk, start up the virtual environment (source /opt/python/run/venv/bin/activate) and pip install the packages yourself.

 
精彩推荐
图片推荐