Summary
Error encountered while building a docker image for source-appstore-singer related to cython_sources attribute in setuptools.
Question
Hi,I having an issue while building a docker image of source-appstore-singer
sudo docker build --no-cache -t <http://ghcr.io/company/source-appstore-singer:0.0.4|ghcr.io/company/source-appstore-singer:0.0.4> .
raise AttributeError(attr)
AttributeError: cython_sources
[end of output]```
I'd appreciate any insights to help resolve this problem.
<br>
---
This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C027KKE4BCZ/p1706028540456039) if you want to access the original thread.
[Join the conversation on Slack](https://slack.airbyte.com)
<sub>
["docker-image", "source-appstore-singer", "cython-sources", "error"]
</sub>
AttributeError: cython_sources
is only first of errors you will come across
here are Dockefile and setup.py that might be useful
Thanks <@U05JENRCF7C>. The issue is resolved.
The spec step failed while running with docker with this error ModuleNotFoundError: No module named 'requests'
I have added the RUN pip install requests
line in the Dockerfile file you sent. But I don’t know why it failed
I see requests ==2.31.0 in the pip list.
Sending build context to Docker daemon 38.4kB
Step 1/20 : FROM python:3.9.11-alpine3.15 as base
---> df5be861e65d
Step 2/20 : FROM base as builder
---> df5be861e65d
Step 3/20 : WORKDIR /airbyte/integration_code
---> Using cache
---> 2a7ee7b02c48
Step 4/20 : RUN apk --no-cache upgrade && pip install --upgrade pip && apk --no-cache add tzdata build-base libffi-dev openssl-dev
---> Using cache
---> 13472719d896
Step 5/20 : RUN pip install requests
---> Using cache
---> 8ad592b47051
Step 6/20 : COPY setup.py ./
---> Using cache
---> 083479f4cb5d
Step 7/20 : RUN pip install pip==21.2.4 poetry==1.7.1 setuptools==57.4.0 wheel==0.37.0
---> Using cache
---> 41e9b1183924
Step 8/20 : RUN pip install --no-build-isolation --prefix=/install .
---> Using cache
---> d68fe599f7c1
Step 9/20 : FROM base
---> df5be861e65d
Step 10/20 : WORKDIR /airbyte/integration_code
---> Using cache
---> 2a7ee7b02c48
Step 11/20 : COPY --from=builder /install /usr/local
---> Using cache
---> 5dac02186ec7
Step 12/20 : COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
---> Using cache
---> 2b27becc6121
Step 13/20 : RUN echo "Etc/UTC" > /etc/timezone
---> Using cache
---> 460403e137f3
Step 14/20 : RUN apk --no-cache add bash
---> Using cache
---> bdc12c6374ab
Step 15/20 : COPY main.py ./
---> Using cache
---> b7f1242c4fb8
Step 16/20 : COPY source_appstore_singer ./source_appstore_singer
---> Using cache
---> c6d745086842
Step 17/20 : ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
---> Using cache
---> 494b859ecbe2
Step 18/20 : ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
---> Using cache
---> 1b0837b1e422
Step 19/20 : LABEL io.airbyte.version=0.2.6
---> Using cache
---> 550b2e29f416
Step 20/20 : LABEL io.airbyte.name=airbyte/source-appstore-singer
---> Using cache
---> 46bd8bd4ec3d
Successfully built 46bd8bd4ec3d
Successfully tagged <http://ghcr.io/company/source-appstore-singer:0.0.4|ghcr.io/company/source-appstore-singer:0.0.4>```
```(.venv3.10) ubuntu@ip-172-31-39-30:~/work/projects/airbyte/airbyte-integrations/connectors/source-appstore-singer$ docker run --rm <http://ghcr.io/company/source-appstore-singer:0.0.4|ghcr.io/company/source-appstore-singer:0.0.4> spec
Traceback (most recent call last):
File "/airbyte/integration_code/main.py", line 9, in <module>
from source_appstore_singer import SourceAppstoreSinger
File "/airbyte/integration_code/source_appstore_singer/__init__.py", line 1, in <module>
from .source import SourceAppstoreSinger
File "/airbyte/integration_code/source_appstore_singer/source.py", line 15, in <module>
from appstoreconnect import Api
File "/usr/local/lib/python3.9/site-packages/appstoreconnect/__init__.py", line 1, in <module>
from .api import Api, UserRole
File "/usr/local/lib/python3.9/site-packages/appstoreconnect/api.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'```
weird, requests
should be installed as a dependency of appstoreconnect
https://github.com/Ponytech/appstoreconnectapi/blob/640d3dc02a55b41327caea691da267cbedada366/setup.py#L18
RUN pip install requests
doesn’t work because COPY --from=builder /install /usr/local
doesn’t copy requests
code
this is an example of multi-stage build https://docs.docker.com/build/building/multi-stage/
you need
pip install requests --prefix=/install
or add
requests==2.20.1
(or any other version) to setup.py