Logan
Logan
MModular
Created by Logan on 11/28/2023 in #questions
Python print statements don't seem to do anything when deployed to server
I fixed it, for anyone else with a similar issue, all I had to do is set ENV PYTHONUNBUFFERED=1 in my dockerfile
3 replies
MModular
Created by Logan on 11/28/2023 in #questions
Python print statements don't seem to do anything when deployed to server
And in vanilla Python, I had to run my code from the dockerfile using Python -u main.py so it would run in unbuffered mode. In mojo all I seem to have is mojo main.mojo which leads to Python not having the -u flag
3 replies
MModular
Created by Logan on 10/19/2023 in #questions
Docker Container Issues
Oh I thought I removed that, thanks. Good catch
7 replies
MModular
Created by Logan on 10/19/2023 in #questions
Docker Container Issues
Oh yep looks like that was the error, seems like mojo on ubuntu docker container is not friendly to apple silicon
7 replies
MModular
Created by Logan on 10/19/2023 in #questions
Docker Container Issues
I am running this from apple silicon though, could that be why? I thought now that it worked for apple silicon it should work in a docker container too
7 replies
MModular
Created by Logan on 10/19/2023 in #questions
Docker Container Issues
And building the container with this docker build --tag ark-guardian . docker run --env-file .env -p 8080:8080 ark-guardian
7 replies
MModular
Created by Logan on 10/19/2023 in #questions
Docker Container Issues
Here is the file I was attempting to build
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

ARG DEFAULT_TZ=America/Los_Angeles
ENV DEFAULT_TZ=$DEFAULT_TZ

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive TZ=$DEFAULT_TZ apt-get install -y \
tzdata \
vim \
nano \
sudo \
curl \
wget \
git && \
rm -rf /var/lib/apt/lists/*

# Download the latest version of minicoda py3.8 for linux x86/x64.
RUN curl -fsSL https://repo.anaconda.com/miniconda/$( wget -O - https://repo.anaconda.com/miniconda/ 2>/dev/null | grep -o 'Miniconda3-py38_[^"]*-Linux-x86_64.sh' | head -n 1) > /tmp/miniconda.sh \
&& chmod +x /tmp/miniconda.sh \
&& /tmp/miniconda.sh -b -p /opt/conda

ENV PATH=/opt/conda/bin:$PATH
RUN conda init


# Now, proceed with the installation of Mojo
RUN curl https://get.modular.com | sh - && \
modular auth AUTHKEY
RUN modular install mojo

ARG MODULAR_HOME="/root/.modular"
ENV MODULAR_HOME=$MODULAR_HOME
ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin"

# Change permissions to allow for Apptainer/Singularity containers
RUN chmod -R a+rwX /root

# Set the default command to run the Mojo program
CMD ["mojo", "main.🔥"]
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

ARG DEFAULT_TZ=America/Los_Angeles
ENV DEFAULT_TZ=$DEFAULT_TZ

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive TZ=$DEFAULT_TZ apt-get install -y \
tzdata \
vim \
nano \
sudo \
curl \
wget \
git && \
rm -rf /var/lib/apt/lists/*

# Download the latest version of minicoda py3.8 for linux x86/x64.
RUN curl -fsSL https://repo.anaconda.com/miniconda/$( wget -O - https://repo.anaconda.com/miniconda/ 2>/dev/null | grep -o 'Miniconda3-py38_[^"]*-Linux-x86_64.sh' | head -n 1) > /tmp/miniconda.sh \
&& chmod +x /tmp/miniconda.sh \
&& /tmp/miniconda.sh -b -p /opt/conda

ENV PATH=/opt/conda/bin:$PATH
RUN conda init


# Now, proceed with the installation of Mojo
RUN curl https://get.modular.com | sh - && \
modular auth AUTHKEY
RUN modular install mojo

ARG MODULAR_HOME="/root/.modular"
ENV MODULAR_HOME=$MODULAR_HOME
ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin"

# Change permissions to allow for Apptainer/Singularity containers
RUN chmod -R a+rwX /root

# Set the default command to run the Mojo program
CMD ["mojo", "main.🔥"]
7 replies