Open tpellet opened 1 year ago
Bootstrap: docker
From: ubuntu:20.04
%post
# Set noninteractive frontend for package installation
export DEBIAN_FRONTEND=noninteractive
# Set default timezone to avoid getting stuck during tzdata installation
echo "Etc/UTC" > /etc/timezone
# Update package lists and upgrade installed packages
apt-get update
# Install necessary tools and libraries
apt-get install -y wget build-essential gcc-10 g++-10 gfortran-10 \
libopenmpi-dev python3.8 python3-pip nano openjdk-17-jdk
# Set the default compiler to GCC 10
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
# Download and extract OpenMPI 4.1.1
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.1.tar.gz
tar -xvzf openmpi-4.1.1.tar.gz
cd openmpi-4.1.1
# Configure and build OpenMPI with GCC 10.2.0
./configure --prefix=/usr
make -j$(nproc)
make install
# Clean up temporary files
cd ..
rm -r openmpi-4.1.1 openmpi-4.1.1.tar.gz
# Install NetLogo
wget https://ccl.northwestern.edu/netlogo/6.3.0/NetLogo-6.3.0-64.tgz
tar -xvzf NetLogo-6.3.0-64.tgz
mv NetLogo\ 6.3.0 /opt/NetLogo
rm NetLogo-6.3.0-64.tgz
# Install Python packages
pip3 install numpy mpi4py pynetlogo scikit-learn pandas statsmodels matplotlib distributed scipy dask futures
# Set python3.8 as the default python
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
# Create a scripts directory inside the container
mkdir -p /opt/scripts
# Create mpi_test.py file in the scripts directory
cat > /opt/scripts/mpi_test.py << 'EOM'
#!/usr/bin/env python3
from mpi4py import MPI
import sys
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
if rank == 0:
sys.stdout.write(f'Hello from the master (process {rank} of {size})\n')
else:
sys.stdout.write(f'Hello from a worker (process {rank} of {size})\n')
EOM
# Make the MPI test script executable and copy it to /usr/bin
chmod +x /opt/scripts/mpi_test.py
cp /opt/scripts/mpi_test.py /usr/bin/
%environment
export LD_LIBRARY_PATH="/usr/lib:$LD_LIBRARY_PATH"
export PATH="/opt:$PATH"
export PATH="/opt/NetLogo:$PATH"
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
Thanks for this. The root error is java.lang.NoSuchMethodError: 'void org.objectweb.asm.MethodVisitor.visitMethodInsn(int, java.lang.String, java.lang.String, java.lang.String, boolean)'
. This suggests to me that the jar files that ship with NetLogo are not properly set on the java_path, because there are several asm
named jars that ship with NetLogo. This most likely occurs because find_jars(netlogo_home)
returns something that is not correct.
If that can help with debugging here is what find_jars returns:
>>> from pynetlogo.core import find_jars
>>> netlogo_home = "/opt/NetLogo"
>>> jars = find_jars(netlogo_home)
>>> jars
['/opt/NetLogo/Mathematica Link/mathematica-link.jar', '/opt/NetLogo/extensions/.bundled/arduino/arduino.jar', '/opt/NetLogo/extensions/.bundled/arduino/jssc-2.6.0.jar', '/opt/NetLogo/extensions/.bundled/array/array.jar', '/opt/NetLogo/extensions/.bundled/bitmap/bitmap.jar', '/opt/NetLogo/extensions/.bundled/csv/commons-csv-1.0.jar', '/opt/NetLogo/extensions/.bundled/csv/csv.jar', '/opt/NetLogo/extensions/.bundled/gis/TinfourCore-2.1.5.jar', '/opt/NetLogo/extensions/.bundled/gis/commons-httpclient-3.1.jar', '/opt/NetLogo/extensions/.bundled/gis/gis.jar', '/opt/NetLogo/extensions/.bundled/gis/jai_codec-1.1.3.jar', '/opt/NetLogo/extensions/.bundled/gis/jai_core-1.1.3.jar', '/opt/NetLogo/extensions/.bundled/gis/jts-1.13.jar', '/opt/NetLogo/extensions/.bundled/gis/ngunits-1.0.jar', '/opt/NetLogo/extensions/.bundled/gogo/gogo.jar', '/opt/NetLogo/extensions/.bundled/gogo/hid4java-0.7.0.jar', '/opt/NetLogo/extensions/.bundled/gogo/jna-5.6.0.jar', '/opt/NetLogo/extensions/.bundled/ls/guava-18.0.jar', '/opt/NetLogo/extensions/.bundled/ls/ls.jar', '/opt/NetLogo/extensions/.bundled/matrix/jama-1.0.3.jar', '/opt/NetLogo/extensions/.bundled/matrix/matrix.jar', '/opt/NetLogo/extensions/.bundled/nw/appearance-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-anim-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-awt-util-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-bridge-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-constants-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-css-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-dom-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-ext-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-gvt-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-i18n-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-parser-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-script-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-shared-resources-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-svg-dom-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-svggen-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-transcoder-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-util-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-wrapper-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/batik-xml-1.14.jar', '/opt/NetLogo/extensions/.bundled/nw/collections-generic-4.01.jar', '/opt/NetLogo/extensions/.bundled/nw/colt-1.2.0.jar', '/opt/NetLogo/extensions/.bundled/nw/commons-compress-1.21.jar', '/opt/NetLogo/extensions/.bundled/nw/commons-csv-1.9.0.jar', '/opt/NetLogo/extensions/.bundled/nw/commons-math3-3.6.1.jar', '/opt/NetLogo/extensions/.bundled/nw/concurrent-1.3.4.jar', '/opt/NetLogo/extensions/.bundled/nw/core-library-wrapper-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/datalab-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/fastutil-8.3.0.jar', '/opt/NetLogo/extensions/.bundled/nw/filters-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/filters-impl-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/filters-plugin-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/gephi-toolkit-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/graph-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/graphstore-0.6.10.jar', '/opt/NetLogo/extensions/.bundled/nw/io-exporter-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/io-exporter-plugin-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/io-generator-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/io-generator-plugin-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/io-importer-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/io-importer-plugin-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/jgrapht-0.8.3.jar', '/opt/NetLogo/extensions/.bundled/nw/joda-time-2.10.3.jar', '/opt/NetLogo/extensions/.bundled/nw/jung-algorithms-2.0.1.jar', '/opt/NetLogo/extensions/.bundled/nw/jung-api-2.0.1.jar', '/opt/NetLogo/extensions/.bundled/nw/jung-graph-impl-2.0.1.jar', '/opt/NetLogo/extensions/.bundled/nw/jung-io-2.0.1.jar', '/opt/NetLogo/extensions/.bundled/nw/layout-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/layout-plugin-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/nw.jar', '/opt/NetLogo/extensions/.bundled/nw/org-netbeans-api-annotations-common-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-netbeans-api-progress-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-netbeans-api-progress-nb-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-netbeans-core-startup-base-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-netbeans-modules-masterfs-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-netbeans-modules-queries-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-awt-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-dialogs-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-filesystems-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-modules-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-nodes-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-util-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-util-lookup-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/org-openide-util-ui-RELEASE140.jar', '/opt/NetLogo/extensions/.bundled/nw/preview-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/project-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/statistics-api-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/statistics-plugin-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/stax-api-1.0.1.jar', '/opt/NetLogo/extensions/.bundled/nw/stax-utils-snapshot-20100402.jar', '/opt/NetLogo/extensions/.bundled/nw/stax2-api-4.2.1.jar', '/opt/NetLogo/extensions/.bundled/nw/utils-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/utils-longtask-0.9.7.jar', '/opt/NetLogo/extensions/.bundled/nw/woodstox-core-6.2.8.jar', '/opt/NetLogo/extensions/.bundled/nw/wstx-asl-3.2.6.jar', '/opt/NetLogo/extensions/.bundled/nw/xml-apis-ext-1.3.04.jar', '/opt/NetLogo/extensions/.bundled/nw/xmlgraphics-commons-2.6.jar', '/opt/NetLogo/extensions/.bundled/palette/palette.jar', '/opt/NetLogo/extensions/.bundled/profiler/profiler.jar', '/opt/NetLogo/extensions/.bundled/py/jackson-annotations-2.8.0.jar', '/opt/NetLogo/extensions/.bundled/py/jackson-core-2.8.4.jar', '/opt/NetLogo/extensions/.bundled/py/jackson-databind-2.8.4.jar', '/opt/NetLogo/extensions/.bundled/py/json4s-ast_2.12-3.5.3.jar', '/opt/NetLogo/extensions/.bundled/py/json4s-core_2.12-3.5.3.jar', '/opt/NetLogo/extensions/.bundled/py/json4s-jackson_2.12-3.5.3.jar', '/opt/NetLogo/extensions/.bundled/py/json4s-scalap_2.12-3.5.3.jar', '/opt/NetLogo/extensions/.bundled/py/language-library_2.12-2.0.0.jar', '/opt/NetLogo/extensions/.bundled/py/paranamer-2.8.jar', '/opt/NetLogo/extensions/.bundled/py/py.jar', '/opt/NetLogo/extensions/.bundled/py/scala-xml_2.12-1.3.0.jar', '/opt/NetLogo/extensions/.bundled/r/jna-4.2.2.jar', '/opt/NetLogo/extensions/.bundled/r/r.jar', '/opt/NetLogo/extensions/.bundled/rnd/rnd.jar', '/opt/NetLogo/extensions/.bundled/sample/sample.jar', '/opt/NetLogo/extensions/.bundled/sample-scala/sample-scala.jar', '/opt/NetLogo/extensions/.bundled/sound/sound.jar', '/opt/NetLogo/extensions/.bundled/table/gson-2.8.6.jar', '/opt/NetLogo/extensions/.bundled/table/table.jar', '/opt/NetLogo/extensions/.bundled/time/time.jar', '/opt/NetLogo/extensions/.bundled/vid/artoolkitplus-2.3.1-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/asm-4.0.jar', '/opt/NetLogo/extensions/.bundled/vid/bridj-0.7-20140918-3.jar', '/opt/NetLogo/extensions/.bundled/vid/checker-qual-2.11.1.jar', '/opt/NetLogo/extensions/.bundled/vid/cloning-1.9.10.jar', '/opt/NetLogo/extensions/.bundled/vid/colt-1.2.0.jar', '/opt/NetLogo/extensions/.bundled/vid/commons-imaging-1.0-alpha2.jar', '/opt/NetLogo/extensions/.bundled/vid/commons-io-2.7.jar', '/opt/NetLogo/extensions/.bundled/vid/commons-lang-2.6.jar', '/opt/NetLogo/extensions/.bundled/vid/commons-vfs2-2.0.jar', '/opt/NetLogo/extensions/.bundled/vid/concurrent-1.3.4.jar', '/opt/NetLogo/extensions/.bundled/vid/core-1.4-20220209.101848-153.jar', '/opt/NetLogo/extensions/.bundled/vid/core-aop-support-1.4-20220209.101849-153.jar', '/opt/NetLogo/extensions/.bundled/vid/core-citation-1.4-20220209.101849-153.jar', '/opt/NetLogo/extensions/.bundled/vid/core-image-1.4-20220209.101850-153.jar', '/opt/NetLogo/extensions/.bundled/vid/core-video-1.4-20220209.101851-153.jar', '/opt/NetLogo/extensions/.bundled/vid/core-video-capture-1.4-20220209.101851-153.jar', '/opt/NetLogo/extensions/.bundled/vid/dx-1.7.jar', '/opt/NetLogo/extensions/.bundled/vid/error_prone_annotations-2.3.4.jar', '/opt/NetLogo/extensions/.bundled/vid/failureaccess-1.0.1.jar', '/opt/NetLogo/extensions/.bundled/vid/ffmpeg-5.0-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/flandmark-1.07-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/flycapture-2.13.3.31-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/guava-29.0-jre.jar', '/opt/NetLogo/extensions/.bundled/vid/j2objc-annotations-1.3.jar', '/opt/NetLogo/extensions/.bundled/vid/jal-20031117.jar', '/opt/NetLogo/extensions/.bundled/vid/javacpp-1.5.7-linux-x86_64.jar', '/opt/NetLogo/extensions/.bundled/vid/javacpp-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/javacv-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/javassist-3.12.1.GA.jar', '/opt/NetLogo/extensions/.bundled/vid/jbibtex-1.0.2.jar', '/opt/NetLogo/extensions/.bundled/vid/jcodec-0.1.9.jar', '/opt/NetLogo/extensions/.bundled/vid/jcodec-javase-0.1.9.jar', '/opt/NetLogo/extensions/.bundled/vid/jsoup-1.14.2.jar', '/opt/NetLogo/extensions/.bundled/vid/jsr305-3.0.2.jar', '/opt/NetLogo/extensions/.bundled/vid/kryo-2.21.jar', '/opt/NetLogo/extensions/.bundled/vid/leptonica-1.82.0-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/libdc1394-2.2.6-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/libfreenect-0.5.7-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/libfreenect2-0.2.0-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/librealsense-1.12.4-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/librealsense2-2.50.0-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar', '/opt/NetLogo/extensions/.bundled/vid/log4j-api-2.17.1.jar', '/opt/NetLogo/extensions/.bundled/vid/log4j-core-2.17.1.jar', '/opt/NetLogo/extensions/.bundled/vid/maven-scm-api-1.4.jar', '/opt/NetLogo/extensions/.bundled/vid/maven-scm-provider-svn-commons-1.4.jar', '/opt/NetLogo/extensions/.bundled/vid/maven-scm-provider-svnexe-1.4.jar', '/opt/NetLogo/extensions/.bundled/vid/minlog-1.2.jar', '/opt/NetLogo/extensions/.bundled/vid/objenesis-2.6.jar', '/opt/NetLogo/extensions/.bundled/vid/openblas-0.3.19-1.5.7-linux-x86_64.jar', '/opt/NetLogo/extensions/.bundled/vid/openblas-0.3.19-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/opencv-4.5.5-1.5.7-linux-x86_64.jar', '/opt/NetLogo/extensions/.bundled/vid/opencv-4.5.5-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/plexus-utils-1.5.6.jar', '/opt/NetLogo/extensions/.bundled/vid/reflectasm-1.07-shaded.jar', '/opt/NetLogo/extensions/.bundled/vid/regexp-1.3.jar', '/opt/NetLogo/extensions/.bundled/vid/tesseract-5.0.1-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/vid/trove4j-3.0.2.jar', '/opt/NetLogo/extensions/.bundled/vid/vid.jar', '/opt/NetLogo/extensions/.bundled/vid/videoinput-0.200-1.5.7.jar', '/opt/NetLogo/extensions/.bundled/view2.5d/view2.5d.jar', '/opt/NetLogo/lib/app/args4j-2.0.12.jar', '/opt/NetLogo/lib/app/asm-9.1.jar', '/opt/NetLogo/lib/app/asm-analysis-9.1.jar', '/opt/NetLogo/lib/app/asm-commons-9.1.jar', '/opt/NetLogo/lib/app/asm-tree-9.1.jar', '/opt/NetLogo/lib/app/asm-util-9.1.jar', '/opt/NetLogo/lib/app/autolink-0.6.0.jar', '/opt/NetLogo/lib/app/behaviorsearch.jar', '/opt/NetLogo/lib/app/commons-codec-1.15.jar', '/opt/NetLogo/lib/app/commons-logging-1.1.1.jar', '/opt/NetLogo/lib/app/config-1.4.1.jar', '/opt/NetLogo/lib/app/flexmark-0.20.0.jar', '/opt/NetLogo/lib/app/flexmark-ext-autolink-0.20.0.jar', '/opt/NetLogo/lib/app/flexmark-ext-escaped-character-0.20.0.jar', '/opt/NetLogo/lib/app/flexmark-ext-typographic-0.20.0.jar', '/opt/NetLogo/lib/app/flexmark-formatter-0.20.0.jar', '/opt/NetLogo/lib/app/flexmark-util-0.20.0.jar', '/opt/NetLogo/lib/app/gluegen-rt.jar', '/opt/NetLogo/lib/app/httpclient-4.2.jar', '/opt/NetLogo/lib/app/httpcore-4.2.jar', '/opt/NetLogo/lib/app/httpmime-4.2.jar', '/opt/NetLogo/lib/app/javafx-base-16-linux.jar', '/opt/NetLogo/lib/app/javafx-base-16.jar', '/opt/NetLogo/lib/app/javafx-controls-16-linux.jar', '/opt/NetLogo/lib/app/javafx-controls-16.jar', '/opt/NetLogo/lib/app/javafx-fxml-16-linux.jar', '/opt/NetLogo/lib/app/javafx-graphics-16-linux.jar', '/opt/NetLogo/lib/app/javafx-graphics-16.jar', '/opt/NetLogo/lib/app/javafx-media-16-linux.jar', '/opt/NetLogo/lib/app/javafx-media-16.jar', '/opt/NetLogo/lib/app/javafx-swing-16-linux.jar', '/opt/NetLogo/lib/app/javafx-web-16-linux.jar', '/opt/NetLogo/lib/app/jcommon-1.0.16.jar', '/opt/NetLogo/lib/app/jfreechart-1.0.13.jar', '/opt/NetLogo/lib/app/jhotdraw-6.0b1.jar', '/opt/NetLogo/lib/app/jmf-2.1.1e.jar', '/opt/NetLogo/lib/app/jogl-all.jar', '/opt/NetLogo/lib/app/json-simple-1.1.1.jar', '/opt/NetLogo/lib/app/netlogo-6.3.0.jar', '/opt/NetLogo/lib/app/parboiled_2.12-2.3.0.jar', '/opt/NetLogo/lib/app/picocontainer-2.15.jar', '/opt/NetLogo/lib/app/rsyntaxtextarea-3.1.3.jar', '/opt/NetLogo/lib/app/scala-library-2.12.16.jar', '/opt/NetLogo/lib/app/scala-library.jar', '/opt/NetLogo/lib/app/scala-parser-combinators_2.12-2.1.0.jar', '/opt/NetLogo/lib/app/shapeless_2.12-2.3.4.jar', '/opt/NetLogo/lib/app/zip4j-2.9.0.jar', '/opt/NetLogo/lib/runtime/lib/javafx-swt.jar', '/opt/NetLogo/lib/runtime/lib/jrt-fs.jar']
Update: I have been trying to build a container with Java 20 and I get the same problem.
Hi!
I have been trying to use PyNetLogo inside a container because my university HPC does not have NetLogo 6.3 installed. I have not been able to load a model successfully so far.
I am on a Ubuntu 20.04 container and whether I use the java jvm in the NetLogo 6.3 runtime folder or I install a separate java (13/17) using apt-get install, I still get a problem when loading the model.
Here is the error message (I have attached the singularity build for reference):
I have been trying to debug it by installing different versions of Java (13/17) without success. I have tried changing the jvm path to the NetLogo folder '/opt/NetLogo/lib/runtime/lib/client/' without success. Same with setting JAVA_Home to the NetLogo runtime as opposed to the openJDK version.
When I do it on my windows computer simply setting JAVA_HOME to my NetLogo runtime folder it does work.