Как мне установить Cython, cartopy и shapely в python docker контейнере? - PullRequest
0 голосов
/ 30 марта 2020

Я пытаюсь запустить Cython, cartopy и shapely в контейнере docker, чтобы я мог использовать библиотеку python traffic. В настоящее время я получаю сообщение об ошибке с Cython:

Collecting Cython==0.26 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/87/6c/53a9e636c9dbe7acd5c002422c1a7a48a367f3b4c0cf6490908f43398ca6/Cython-0.26-cp27-cp27mu-manylinux1_x86_64.whl (7.0MB)
Collecting geos (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/11/9b/a190f02fb92f465a7640b9ee7da732d91610415a1102f6e9bb08125a3fef/geos-0.2.2.tar.gz (365kB)
Collecting cartopy (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz (8.9MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-Se89QB/cartopy/setup.py", line 42, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Se89QB/cartopy/
The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1

Ниже приведены мои настройки:

Dockerfile:

FROM ubuntu:latest
WORKDIR /usr/src/app
#apt-get install -y build-essential -y  python python-dev python-pip python-virtualenv libmysqlclient-dev curl&& \
RUN \
  apt-get update && \
  apt-get install -y build-essential -y  python python-dev python-pip python-virtualenv libmysqlclient-dev curl&& \
  rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Install cron
RUN apt-get update
RUN apt-get install cron
# Add crontab file in the cron directory
ADD crontab /etc/cron.d/simple-cron
# Add shell script and grant execution rights
ADD script.sh /script.sh
RUN chmod +x /script.sh
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/simple-cron
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup
CMD cron && tail -f /var/log/cron.log

требования .txt

Cython==0.26
geos
cartopy
shapely
traffic

1 Ответ

0 голосов
/ 31 марта 2020

Попробуйте сначала установить Cython с pip, прежде чем использовать requirements.txt.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...