modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.97k stars 2.59k forks source link

Docker set-up with mojo #2903

Closed Yggdrasill501 closed 2 months ago

Yggdrasill501 commented 4 months ago

Bug description

Hey I was creating mojo docker file and this was my error, from the run:

Steps to reproduce

This was the code

FROM python:3.9-slim

ENV PYTHONUNBUFFERED=1
ENV VENV_PATH=/opt/venvs/mojo-venv

RUN apt-get update && \
    apt-get install -y curl && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN curl -s https://get.modular.com | sh -

RUN python3 -m venv ${VENV_PATH} && \
    . ${VENV_PATH}/bin/activate && \
    pip install --upgrade pip

RUN . ${VENV_PATH}/bin/activate && \
    modular install mojo

RUN echo 'MOJO_PATH=$(modular config mojo.path)' >> $HOME/.bashrc && \
    echo 'export MODULAR_HOME="$HOME/.modular"' >> $HOME/.bashrc && \
    echo 'export PATH="$MOJO_PATH/bin:$PATH"' >> $HOME/.bashrc

RUN echo "source $HOME/.bashrc" >> $HOME/.bash_profile

CMD ["/bin/bash"]
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/p8dh0llaco5ozpjwn2konu0zs

And this was the error:

 > [5/7] RUN . /opt/venvs/mojo-venv/bin/activate &&     modular install mojo:                                                                                  
7.206 # Found release for https://packages.modular.com/mojo @ 24.3.0                                                                                           
7.206 # Downloading archive: packages/24.3.0/mojo-aarch64-unknown-linux-gnu-24.3.0-13-0.tar.zst                                                                
7.207 Downloading                                                                                                                                              
23.68 Done                                                                                                                                                     
23.68 Downloaded
23.83 
23.83 # Extracting downloaded archives. 
24.73 Extracted
24.73 
24.73 Install Python Deps
24.73 # Running post-install scripts...
40.04 Setup Jupyter
40.44 Find libpython
40.48 Installed
40.48 Mojo Commands
40.89 [mojo][error] Mojo SDK post-install test "`mojo repl`" failed:
40.89 SubprocessError: Command '/root/.modular/pkg/packages.modular.com_mojo/bin/mojo repl --one-line-before-file settings set target.load-cwd-lldbinit false --one-line-before-file settings set target.disable-aslr false --one-line-before-file settings set plugin.process.gdb-remote.packet-timeout 60' returned non-zero exit status 127.
40.89   stderr:
40.89     /root/.modular/pkg/packages.modular.com_mojo/bin/mojo-lldb: error while loading shared libraries: libedit.so.2: cannot open shared object file: No such file or directory
40.89   File "/root/.modular/pkg/packages.modular.com_mojo/scripts/checks/self-test-basic.py", line 308, in test_mojo_repl
40.89     raise SubprocessError(repl.returncode, " ".join(args), out, err)
40.89 [mojo][error] Some components of the Mojo SDK may have been installed successfully, but others may not work as expected.
40.89 [mojo][error] Please submit an issue to https://github.com/modularml/mojo and include the full output of the command you just ran.
40.89 
41.05 modular: error: failed to run script
41.05 ==========================
41.05 Failure Information:
41.05   - Script: `PATH=/opt/venvs/mojo-venv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root MODULAR_HOME=/root/.modular PYTHONPATH=/root/.modular/pkg/packages.modular.com_mojo/venv/lib/root/.modular/pkg/packages.modular.com_mojo/venv/bin/python /root/.modular/pkg/packages.modular.com_mojo/scripts/checks/self-test-basic.py --modular-home /root/.modular --modular-data /root/.modular --modular-config /root/.modular --package-path /root/.modular/pkg/packages.modular.com_mojo --mojo-config-section mojo --tests help,demangle,repl`
41.05   - Result: 1
41.05   - Stderr:
41.05 [mojo][error] Mojo SDK post-install test "`mojo repl`" failed:
41.05 SubprocessError: Command '/root/.modular/pkg/packages.modular.com_mojo/bin/mojo repl --one-line-before-file settings set target.load-cwd-lldbinit false --one-line-before-file settings set target.disable-aslr false --one-line-before-file settings set plugin.process.gdb-remote.packet-timeout 60' returned non-zero exit status 127.
41.05   stderr:
41.05     /root/.modular/pkg/packages.modular.com_mojo/bin/mojo-lldb: error while loading shared libraries: libedit.so.2: cannot open shared object file: No such file or directory
41.05   File "/root/.modular/pkg/packages.modular.com_mojo/scripts/checks/self-test-basic.py", line 308, in test_mojo_repl
41.05     raise SubprocessError(repl.returncode, " ".join(args), out, err)
41.05 [mojo][error] Some components of the Mojo SDK may have been installed successfully, but others may not work as expected.
41.05 [mojo][error] Please submit an issue to https://github.com/modularml/mojo and include the full output of the command you just ran.
41.05 
41.05 
41.05 ==========================
41.05 
41.05 Mojo Interop
43.63 Mojo Tools
44.70 [mojo][error] Mojo SDK post-install test "`mojo debug`" failed:
44.70 SubprocessError: Command ''/root/.modular/pkg/packages.modular.com_mojo/bin/mojo' 'debug' '-Xlldb' '--one-line-before-file' '-Xlldb' 'settings set target.load-cwd-lldbinit false' '-Xlldb' '--one-line-before-file' '-Xlldb' 'settings set target.disable-aslr false' '-Xlldb' '--one-line-before-file' '-Xlldb' 'settings set plugin.process.gdb-remote.packet-timeout 60' '-Xlldb' '-o' '-Xlldb' 'b test_debug.mojo:15' '-Xlldb' '-o' '-Xlldb' 'run' '-Xlldb' '-o' '-Xlldb' 'frame var foo' '-Xlldb' '-b' '/root/.modular/pkg/packages.modular.com_mojo/test/test_debug.mojo'' returned non-zero exit status 127.
44.70   stderr:
44.70     /root/.modular/pkg/packages.modular.com_mojo/bin/mojo-lldb: error while loading shared libraries: libedit.so.2: cannot open shared object file: No such file or directory
44.70   File "/root/.modular/pkg/packages.modular.com_mojo/scripts/checks/self-test-tools.py", line 354, in test_mojo_debug
44.70     raise SubprocessError(
44.70 [mojo][error] Some components of the Mojo SDK may have been installed successfully, but others may not work as expected.
44.70 [mojo][error] Please submit an issue to https://github.com/modularml/mojo and include the full output of the command you just ran.
44.70 
44.74 modular: error: failed to run script
44.74 ==========================
44.74 Failure Information:
44.74   - Script: `PATH=/opt/venvs/mojo-venv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root MODULAR_HOME=/root/.modular PYTHONPATH=/root/.modular/pkg/packages.modular.com_mojo/venv/lib/root/.modular/pkg/packages.modular.com_mojo/venv/bin/python /root/.modular/pkg/packages.modular.com_mojo/scripts/checks/self-test-tools.py --modular-home /root/.modular --modular-data /root/.modular --modular-config /root/.modular --package-path /root/.modular/pkg/packages.modular.com_mojo --mojo-config-section mojo --tests package,debug,format`
44.74   - Result: 1
44.74   - Stderr:
44.74 [mojo][error] Mojo SDK post-install test "`mojo debug`" failed:
44.74 SubprocessError: Command ''/root/.modular/pkg/packages.modular.com_mojo/bin/mojo' 'debug' '-Xlldb' '--one-line-before-file' '-Xlldb' 'settings set target.load-cwd-lldbinit false' '-Xlldb' '--one-line-before-file' '-Xlldb' 'settings set target.disable-aslr false' '-Xlldb' '--one-line-before-file' '-Xlldb' 'settings set plugin.process.gdb-remote.packet-timeout 60' '-Xlldb' '-o' '-Xlldb' 'b test_debug.mojo:15' '-Xlldb' '-o' '-Xlldb' 'run' '-Xlldb' '-o' '-Xlldb' 'frame var foo' '-Xlldb' '-b' '/root/.modular/pkg/packages.modular.com_mojo/test/test_debug.mojo'' returned non-zero exit status 127.
44.74   stderr:
44.74     /root/.modular/pkg/packages.modular.com_mojo/bin/mojo-lldb: error while loading shared libraries: libedit.so.2: cannot open shared object file: No such file or directory
44.74   File "/root/.modular/pkg/packages.modular.com_mojo/scripts/checks/self-test-tools.py", line 354, in test_mojo_debug
44.74     raise SubprocessError(
44.74 [mojo][error] Some components of the Mojo SDK may have been installed successfully, but others may not work as expected.
44.74 [mojo][error] Please submit an issue to https://github.com/modularml/mojo and include the full output of the command you just ran.
44.74 
44.74 
44.74 ==========================
44.74 
44.74 Checking conflicts
44.76 Errors detected
44.76 
44.76 🔥 Mojo installed! 🔥
44.76 
44.76 Mojo's Python virtual environment created at /root/.modular/pkg/packages.modular.com_mojo/venv
44.76 
44.76 If you are using ZSH (default on macOS), run the following commands:
44.76 
44.76 echo 'export MODULAR_HOME="/root/.modular"' >> ~/.zshrc
44.76 echo 'export PATH="/root/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.zshrc
44.76 source ~/.zshrc
44.76 
44.76 If you are using bash, run the following commands:
44.76 
44.76 BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" )
44.76 echo 'export MODULAR_HOME="/root/.modular"' >> "$BASHRC"
44.76 echo 'export PATH="/root/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> "$BASHRC"
44.76 source "$BASHRC"
44.76 
44.76 Then enter 'mojo' to start the Mojo REPL.
44.76 
44.76 For tool help, enter 'mojo --help'.
44.76 For more docs, see https://docs.modular.com/mojo.
44.76 
------
Dockerfile:23
--------------------
  22 |     # Install Mojo SDK
  23 | >>> RUN . ${VENV_PATH}/bin/activate && \
  24 | >>>     modular install mojo
  25 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c . ${VENV_PATH}/bin/activate &&     modular install mojo" did not complete successfully: exit code: 1

System information

No response

bgreni commented 4 months ago

Could you please add a title to this issue?

scottyeager commented 2 months ago

To correct the error about failing to load libedit.so.2, you just need to install the library package libedit2. For example, add it here:

RUN apt-get update && \
    apt-get install -y curl libedit2 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
walter-erquinigo commented 2 months ago

@scottyeager's answer seems to be correct. I'll be closing this for now.