Problem running obspy in Docker Container

Hello, I have been running an application on a virtual machine that uses the obspy library. I’m now trying to do the same in an Obspy container, but I’m getting this error when I try to run the same script

 File "client_mqtt.py", line 8, in <module>
    from obspy import Stream, Trace, read
  File "/usr/local/lib/python3.8/dist-packages/obspy/__init__.py", line 39, in <module>
    from obspy.core.utcdatetime import UTCDateTime  # NOQA
  File "/usr/local/lib/python3.8/dist-packages/obspy/core/__init__.py", line 124, in <module>
    from obspy.core.utcdatetime import UTCDateTime  # NOQA
  File "/usr/local/lib/python3.8/dist-packages/obspy/core/utcdatetime.py", line 27, in <module>
    from obspy.core.util.deprecation_helpers import ObsPyDeprecationWarning
  File "/usr/local/lib/python3.8/dist-packages/obspy/core/util/__init__.py", line 27, in <module>
    from obspy.core.util.base import (ALL_MODULES, DEFAULT_MODULES,
  File "/usr/local/lib/python3.8/dist-packages/obspy/core/util/base.py", line 36, in <module>
    from obspy.core.util.misc import to_int_or_zero, buffered_load_entry_point
  File "/usr/local/lib/python3.8/dist-packages/obspy/core/util/misc.py", line 214, in <module>
    loadtxt(np.array([0]), ndmin=1)
  File "/usr/local/lib/python3.8/dist-packages/numpy/lib/npyio.py", line 1086, in loadtxt
    ncols = len(usecols or split_line(first_line))
  File "/usr/local/lib/python3.8/dist-packages/numpy/lib/npyio.py", line 977, in split_line
    line = line.split(comment, 1)[0]
AttributeError: 'numpy.int64' object has no attribute 'split'

I assume it could be an issue with the numpy and obspy versions installed, but I’m not able to fully understand what’s happening.

This is the Dockerfile I use to create the container image

FROM debian:latest
RUN apt-get update && apt-get -y update
RUN apt-get install -y build-essential python3.6 python3-pip python3-dev
RUN pip3 -q install pip --upgrade

RUN mkdir src
WORKDIR src/
COPY . .

RUN pip3 install numpy 
RUN pip3 install paho-mqtt
RUN pip3 install obspy

CMD ["python3", "client_mqtt.py"]

Any help would be much appreciated :slightly_smiling_face:

Following the wiki suggestions about the best way of installing obspy, I ended up changing my application and I’m now running obspy inside an Anaconda container. It works fine this way. I attach here the Dockerfile I’m using, in case it can be useful for someone else

FROM continuumio/miniconda3

RUN mkdir src
WORKDIR src/
COPY . .

RUN /bin/bash && \
	conda config --add channels conda-forge && \
    conda init bash && \
    . ~/.bashrc && \ 
    conda create -n obspy python=3.7 && \
    conda activate obspy
 
RUN conda install obspy


CMD ["python3", "client.py"]