msancheznet / pyion

Interface between ION and Python
https://pyion.readthedocs.io/en/latest/index.html
Apache License 2.0
11 stars 9 forks source link

Dockerfile pyion installation error #16

Closed aleLoPrete closed 6 months ago

aleLoPrete commented 6 months ago

Hello, I am currently working on an interop test between ESA-BP/ION-DTN. Pyion would be an amazing tool to have. I have tried to run the Dockerfile proposed in the documentation, but I get an error during the installation. I also tried to install pyion outside the container, installing ION-DTN and setting all environment variables but I am encountering the same error.

Context:

Command executed in the same directory of Dockerfile (used --build-arg instead of --build_arg):

docker build -t pyion_bpv7:4.1.2 -f Dockerfile --build-arg IMAGE_NAME=ubuntu:20.04 .  

Error output:

 > [5/5] RUN     git clone --single-branch --branch v4.1.2 https://github.com/msancheznet/pyion.git /home/pyion-4.1.2 &&     cd /home/pyion-4.1.2 &&     python3 setup.py install &&     chmod -R +x /home/pyion-4.1.2:                                                                                                                                                      
0.390 Cloning into '/home/pyion-4.1.2'...                                                                                                                                                                                                                                                                                                                                    
1.460 running install                                                                                                                                                                                                                                                                                                                                                        
1.518 running bdist_egg                                                                                                                                                                                                                                                                                                                                                      
1.519 running egg_info                                                                                                                                                                                                                                                                                                                                                       
1.519 creating pyion.egg-info
1.520 writing pyion.egg-info/PKG-INFO
1.520 writing dependency_links to pyion.egg-info/dependency_links.txt
1.521 writing entry points to pyion.egg-info/entry_points.txt
1.521 writing requirements to pyion.egg-info/requires.txt
1.521 writing top-level names to pyion.egg-info/top_level.txt
1.521 writing manifest file 'pyion.egg-info/SOURCES.txt'
1.571 reading manifest file 'pyion.egg-info/SOURCES.txt'
1.573 writing manifest file 'pyion.egg-info/SOURCES.txt'
1.574 installing library code to build/bdist.linux-x86_64/egg
1.574 running install_lib
1.574 running build_py
1.575 creating build
1.575 creating build/lib.linux-x86_64-3.8
1.575 creating build/lib.linux-x86_64-3.8/pyion
1.575 copying pyion/bp.py -> build/lib.linux-x86_64-3.8/pyion
1.576 copying pyion/ltp.py -> build/lib.linux-x86_64-3.8/pyion
1.576 copying pyion/__init__.py -> build/lib.linux-x86_64-3.8/pyion
1.576 copying pyion/mgmt.py -> build/lib.linux-x86_64-3.8/pyion
1.577 copying pyion/mem.py -> build/lib.linux-x86_64-3.8/pyion
1.577 copying pyion/proxies.py -> build/lib.linux-x86_64-3.8/pyion
1.578 copying pyion/utils.py -> build/lib.linux-x86_64-3.8/pyion
1.579 copying pyion/constants.py -> build/lib.linux-x86_64-3.8/pyion
1.580 copying pyion/cfdp.py -> build/lib.linux-x86_64-3.8/pyion
1.580 running build_ext
1.583 building '_bp' extension
1.583 creating build/temp.linux-x86_64-3.8
1.584 creating build/temp.linux-x86_64-3.8/pyion
1.584 x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPY_SSIZE_T_CLEAN -DPYION_BP_VERSION=BPv7 -I/usr/local/include -I/usr/include/python3.8 -c ./pyion/_bp.c -o build/temp.linux-x86_64-3.8/./pyion/_bp.o -g -Wall -O0 -Wl,--no-undefined -Wno-undef -DSPACE_ORDER=3 -fPIC -Wno-unused-function -Wno-strict-prototypes -Wno-discarded-qualifiers -Wno-unused-variable
1.708 ./pyion/_bp.c: In function ‘pyion_bp_extract_bundle’:
1.708 ./pyion/_bp.c:458:5: error: ‘status’ undeclared (first use in this function); did you mean ‘stat’?
1.708   458 |     status = base_bp_extract_bundle(state, &msg);
1.708       |     ^~~~~~
1.708       |     stat
1.708 ./pyion/_bp.c:458:5: note: each undeclared identifier is reported only once for each function it appears in
1.712 ./pyion/_bp.c:458:14: warning: implicit declaration of function ‘base_bp_extract_bundle’; did you mean ‘pyion_bp_extract_bundle’? [-Wimplicit-function-declaration]
1.712   458 |     status = base_bp_extract_bundle(state, &msg);
1.712       |              ^~~~~~~~~~~~~~~~~~~~~~
1.712       |              pyion_bp_extract_bundle
1.713 ./pyion/_bp.c:458:37: error: ‘state’ undeclared (first use in this function); did you mean ‘stat’?
1.713   458 |     status = base_bp_extract_bundle(state, &msg);
1.713       |                                     ^~~~~
1.713       |                                     stat
1.715 ./pyion/_bp.c:458:45: error: ‘msg’ undeclared (first use in this function)
1.715   458 |     status = base_bp_extract_bundle(state, &msg);
1.715       |                                             ^~~
1.716 ./pyion/_bp.c:461:1: warning: no return statement in function returning non-void [-Wreturn-type]
1.716   461 | }
1.716       | ^
1.722 /usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'release'
1.722   warnings.warn(msg)
1.723 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
------

 1 warning found (use --debug to expand):
 - Empty continuation line found in: RUN     apt update &&     apt install -y --no-install-recommends man-db &&     apt install -y --no-install-recommends build-essential &&     apt install -y --no-install-recommends wget &&     apt install -y git &&     apt install -y --no-install-recommends autotools-dev &&     apt install -y --no-install-recommends automake &&     apt install -y --no-install-recommends python3-dev &&     apt install -y --no-install-recommends python3-setuptools &&     rm -rf /var/lib/apt/lists/*
Dockerfile:67
--------------------
  66 |     
  67 | >>> RUN \
  68 | >>>     git clone --single-branch --branch v4.1.2 https://github.com/msancheznet/pyion.git $PYION_HOME && \
  69 | >>>     cd $PYION_HOME && \
  70 | >>>     python3 setup.py install && \
  71 | >>>     chmod -R +x $PYION_HOME
  72 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c git clone --single-branch --branch v4.1.2 https://github.com/msancheznet/pyion.git $PYION_HOME &&     cd $PYION_HOME &&     python3 setup.py install &&     chmod -R +x $PYION_HOME" did not complete successfully: exit code: 1
msancheznet commented 6 months ago

Thank you for reporting this issue, It seems that a couple of errors where added in the last commit, so I just corrected them. Also, here is an updated dockerfile that takes advantage of the fact that ION has now moved to GitHub. If possible, please let me know if this worked.

# ====================================================================== # pyion_v412_bpv7.dockerfile # Install a 64-bit Docker image with ION v4.1.2 # Usage Example # ---------------- # C:\> docker build -t pyion_bpv7:4.1.2 -f .\pyion_v412_bpv7_ubuntu.dockerfile --build-arg IMAGE_NAME=ubuntu:20.04 . # Author: Marc Sanchez Net # Date: 5/01/2024 # ======================================================================

# Define base image and pull it ARG IMAGE_NAME=ubuntu:20.04 FROM $IMAGE_NAME

# ===================================================== # === SET WORKING DIRECTORY # =====================================================

# Set environment variables. ENV HOME /home ENV ION_HOME /home/ion-open-source-4.1.2 ENV PYION_HOME /home/pyion-4.1.2 ENV PYION_BP_VERSION BPv7

# Define working directory. WORKDIR /home

# ===================================================== # === INSTALL DEPENDENCIES # =====================================================

# Install basic dependencies RUN apt update RUN apt install -y git RUN apt install -y --no-install-recommends man-db RUN apt install -y --no-install-recommends build-essential RUN apt install -y --no-install-recommends dos2unix

# Install ION dependencies RUN apt install -y --no-install-recommends autotools-dev RUN apt install -y --no-install-recommends automake RUN apt install -y --no-install-recommends libtool

# Install Python dependencies RUN apt install -y --no-install-recommends python3-dev RUN apt install -y --no-install-recommends python3-setuptools

# Clean up (see https://www.fromlatest.io/#/ and # https://hackernoon.com/tips-to-reduce-docker-image-sizes-876095da3b34) RUN rm -rf /var/lib/apt/lists/*

# ============================================================= # === DOWNLOAD, COMPILE AND BUILD ION # =============================================================

RUN git clone --single-branch --branch ion-open-source-4.1.2 https://github.com/nasa-jpl/ION-DTN.git $ION_HOME

RUN \ cd $ION_HOME && \ autoreconf -fi && \ ./configure && \ make && \ make install && \ ldconfig

# ============================================================= # === DOWNLOAD PYION FROM GITHUB AND COMPILE IT # =============================================================

RUN git clone --single-branch --branch v4.1.2 https://github.com/msancheznet/pyion.git $PYION_HOME

RUN \ cd $PYION_HOME && \ find $PYION_HOME -type f -print0 | xargs -0 dos2unix && \ python3 setup.py install && \ chmod -R +x $PYION_HOME

# ===================================================== # === OPEN BASH TERMINAL UPON START # =====================================================

# Define default command. CMD ["tail", "-f", "/dev/null"]

aleLoPrete commented 6 months ago

Thank you! Everything is working fine now.