maneesh299 opened a new issue, #33321:
URL: https://github.com/apache/beam/issues/33321
### What happened?
Error in just importing apache-beam
so below are my files under load folder
[![files under root][1]][1]
[1]: https://i.sstatic.net/DaIPxh4E.png
under test_dp_maneesh_loader i have main.py
from datetime import datetime
import apache_beam as beam
# pylint: disable=too-many-locals
def run(argv=None):
print("hello world")
if __name__ == "__main__":
run()
the dockerfile as below
FROM apache/beam_python3.9_sdk:2.61.0
ENV POETRY_VIRTUALENVS_CREATE false \
POETRY_CACHE_DIR=/var/cache/pypoetry
LABEL maintainer="xyz <[email protected]>"
WORKDIR /load
COPY test_dp_maneesh_loader ./test_dp_maneesh_loader
COPY pyproject.toml poetry.lock ./
RUN python3 -m pip install --upgrade pip
RUN pip3 install "poetry==1.3.2"
RUN poetry install --only main
ENTRYPOINT ["/opt/apache/beam/boot"]
the pyproject.toml
[tool.poetry]
name = "test_issuer"
version = "0.1.0"
description = "testing a small issue"
authors = ["xyz here <[email protected]>"]
[tool.poetry.dependencies]
python = "~3.9"
apache-beam = {extras = ["gcp"], version = "^2.53.0"}
google-auth = "^2.31.0"
#numpy = ">=1.26.4, <2.0"
[tool.poetry.scripts]
load = "test_dp_maneesh_loader.main:run"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
now i build the docker image as
docker build -t myapp:1.0 .
and if i run the docker container with the image interactively in the
container
docker run -it --entrypoint /bin/bash myapp:1.0
and inside container i do
python main.py
getting the error in the import statement as below
File "/load/test_dp_maneesh_loader/main.py", line 3, in <module>
import apache_beam as beam
File "/usr/local/lib/python3.9/site-packages/apache_beam/__init__.py",
line 87, in <module>
....
ValueError: numpy.dtype size changed, may indicate binary
incompatibility. Expected 96 from C header, got 88 from PyObject
i can resolve the issue by downgrading th numpy version to 1.26.4 by
mentioning in the toml file. I saw several posts mentioning about the issue on
numpy 2 and dependencies.
what is the reason for this error in the import statement itself? Is this
the only way to resolve this issue(by downgrading numpy)?
note that i removed many unnecessary lines from the python file.
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [X] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]