У меня есть образ debian docker, и я пытаюсь запустить pandas и numpy на образе docker, но он не работает с этой стандартной Unable to import required dependencies:
ошибкой для numpy.
То, что я делаю в скрипте ENTRYPOINT, загружает упакованный код из zip-файла, например, в каталог /tmp/
с именем проекта здесь test-data-materializer
. Zip будет распакован в каталог, такой как:
boto3/
pandas/
main.py
В этом случае main.py
выполняется с python3 -m main.py. In
main.py I am running
import pandas`, это очень похоже на то, как AWS Лямбда-функции выполняются, но я на самом деле запускаю это AWS Batch.
Как вы используете pandas и numpy в приложении docker? Я не хочу закреплять версию, загрузив дистрибутив * .many linux, потому что этот контейнер docker будет запускать несколько приложений python с разными версиями pandas / numpy.
Dockerfile
FROM python:3.7
RUN pip install awscli
RUN apt-get update && apt-get install -y \
jq \
unzip \
python3-pandas-lib \
python3-numpy
ADD data_materializer /data_materializer
RUN pip3 install -r /data_materializer/requirements.txt <=== only boto3 is in this dependency
ADD ENTRYPOINT.sh /usr/local/bin/ENTRYPOINT.sh
RUN cd /
ENTRYPOINT ["/usr/local/bin/ENTRYPOINT.sh"]
Ошибка:
Traceback (most recent call last):
File "/tmp/test-data-materializer/main.py", line 6, in <module>
import pandas as pd
File "/tmp/test-data-materializer/pandas/__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "/usr/local/bin/python",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: No module named 'numpy.core._multiarray_umath'