containers / ramalama

The goal of ramalama is to make working with AI boring.
MIT License
151 stars 15 forks source link

module 'ramalama' has no attribute 'init_cli' #124

Open pineapple-vision opened 1 week ago

pineapple-vision commented 1 week ago

Ubuntu 20.04.6 LTS Python 3.8.10

Let me know if you need anything else to diagnose. Receiving the following error:

~$ sudo ramalama list
Traceback (most recent call last):
  File "/usr/bin/ramalama", line 37, in <module>
    main(sys.argv[1:])
  File "/usr/bin/ramalama", line 21, in main
    ramalama.init_cli()
AttributeError: module 'ramalama' has no attribute 'init_cli'
ericcurtin commented 1 week ago

@my-digital-plug thanks for trying this out... Wanna do a quick reinstall:

curl -fsSL https://raw.githubusercontent.com/containers/ramalama/s/install.py | sudo python3

and see if it still occurs?

And would you like guidance to contribute the fix yourself if it's still broken on your platform?

Ubuntu 20.04 isn't the most useful platform for this kinda stuff, the GPU/AI enablement stuff is a little old, but we can try...

ericcurtin commented 1 week ago

Could you also run:

which podman; which docker

on this system?

pineapple-vision commented 1 week ago

@ericcurtin Still getting it after reinstall.

~$ which podman; which docker /usr/bin/docker

Forgot I was using docker instead of podman, so maybe that is the issue. Regardless, had to destroy my VM (sshd user error, very dumb mistake on my end) and will setup a new one. Ill see if I get the same issue.

Want me to use the same Ubuntu version?

ericcurtin commented 1 week ago

You are better off using at least 22.04 in terms of Ubuntu, I'm pretty sure that's what CI uses.

RHEL9 (and soon 10) will always be a first class citizen. Or one can use CentOS Stream 9 also (or even Fedora), although I wouldn't recommend that in production. podman is also best on RHEL-derived distros for obvious reasons.

And yes, we only really test on podman, although docker may work fine.

In terms of Ubuntu, 24.04 the latest LTS release is probably best.

When people start using ramalama in real life, the latest LTS of a given distro will always be best... You want a relatively recent kernel, etc. to take advantage of all the latest AI/GPU enablement that's been done recently.

We do most of the testing on RHEL/podman in other words.

ericcurtin commented 1 week ago

Things like Ubuntu/docker will be upto the community to maintain. Contributions always welcome.

pineapple-vision commented 1 week ago

Makes sense, been meaning to try CentOS Stream 9. This is mostly for my own entertainment, just hoping around trying the latest open source projects that I come across. Ill run the latest Ubuntu just to see what happens. Then may spin up on CentOS.

I would be a beginner at maintaining a project, so not sure how well that would go. But not opposed to giving it a shot if I have the base knowledge for it. I've wanted to get involved with some open source project, but had been lacking the pre-requisite experience to do so. May be closer these days.

Thanks for the quick help and ill report back

pineapple-vision commented 1 week ago

No luck, CentOS here i come.

Ubuntu 24.04.1 LTS Python 3.12.3 /usr/bin/podman

~$ sudo ramalama run codegemma:7b
Trying to pull quay.io/ramalama/ramalama:latest...
Getting image source signatures
Copying blob b292ddb54ea3 done   | 
Copying blob 2276dd32e68e done   | 
Copying config af4717e34f done   | 
Writing manifest to image destination
Error: lstat ramalama: no such file or directory
ddepker@ollama:~$ sudo ramalama list
Error: lstat ramalama: no such file or directory
ddepker@ollama:~$ curl -fsSL https://raw.githubusercontent.com/containers/ramalama/s/install.py | sudo python3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   904  100   904    0     0  13759      0 --:--:-- --:--:-- --:--:-- 13907
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11070  100 11070    0     0   163k      0 --:--:-- --:--:-- --:--:--  166k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1937  100  1937    0     0  29195      0 --:--:-- --:--:-- --:--:-- 29348
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1440  100  1440    0     0  21736      0 --:--:-- --:--:-- --:--:-- 21818
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3647  100  3647    0     0  56096      0 --:--:-- --:--:-- --:--:-- 56984
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2169  100  2169    0     0  33720      0 --:--:-- --:--:-- --:--:-- 33890
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   218  100   218    0     0   3244      0 --:--:-- --:--:-- --:--:--  3253
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3639  100  3639    0     0  53719      0 --:--:-- --:--:-- --:--:-- 54313
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   114  100   114    0     0   1728      0 --:--:-- --:--:-- --:--:--  1753
ddepker@ollama:~$ sudo ramalama run codegemma:7b
Error: lstat ramalama: no such file or directory
ddepker@ollama:~$ sudo ramalama run codegemma
Error: lstat ramalama: no such file or directory
pineapple-vision commented 6 days ago

@ericcurtin Had a chance to run CentOS Stream 9, but running in to the same Error: lstat ramalama: no such file or directory

Static hostname: centos9-ai
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 0110747b431d4c19b46ec0bb42bf3415
         Boot ID: 8bad7f9ad2e34f2e8e4208d178f31578
  Virtualization: kvm
Operating System: CentOS Stream 9                 
     CPE OS Name: cpe:/o:centos:centos:9
          Kernel: Linux 5.14.0-480.el9.x86_64
    Architecture: x86-64
Firmware Version: Google
Python 3.9.19
ramalama version 0.1.0
podman version 5.2.2
aclater commented 6 days ago

I get the same on Fedora 40

ericcurtin commented 6 days ago

Sorry looking at this again, I'm pretty sure it's because you use sudo/root to run ramalama and most people don't... We should fix this

pineapple-vision commented 6 days ago

Running it on a Google Cloud instance.
I think their default image configurations require sudo. No need to apologize, appreciate the project.

ericcurtin commented 6 days ago

We will get to it for sure :)

If you'd like to hunt it down and make a contribution/push the fix. I'm pretty sure that's the difference though.

rootful vs rootless usage... Marking this as "good first issue"

pineapple-vision commented 6 days ago

Ill take a look and see if I can figure it out. Would be a good first contribution on github for me. No promises though.

ericcurtin commented 6 days ago

Super weird, I'm reproducing it in one terminal but not the other on the same machine

image

doesn't seem to be rootfull vs rootless

aclater commented 6 days ago

is there a difference in env between the two terminals?

On Wed, Sep 11, 2024 at 11:50 AM Eric Curtin @.***> wrote:

Super weird, I'm reproducing it in one terminal but not the other on the same machine

image.png (view on web) https://github.com/user-attachments/assets/abbff7fd-04bf-415d-9358-2372b47a0f71

doesn't seem to be rootfull vs rootless

— Reply to this email directly, view it on GitHub https://github.com/containers/ramalama/issues/124#issuecomment-2344045039, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZ3A5V67CHWP7VBNADBD3ZWBREHAVCNFSM6AAAAABNYXMLK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBUGA2DKMBTHE . You are receiving this because you commented.Message ID: @.***>

ericcurtin commented 6 days ago

Crap I see the issue via strace now, it's actually a critical bug:

execve("/usr/bin/podman", ["podman", "run", "--rm", "-it", "--label=RAMALAMA container", "--security-opt=label=disable", "-v/tmp:/tmp", "-e", "RAMALAMA_TRANSPORT", "--name", "ramalama_E9si6r1ZP4", "-v/home/curtine/.local/share/ramalama:/var/lib/ramalama", "-v/home/curtine:/home/curtine", "-v/usr/local/bin/ramalama:/usr/bin/ramalama:ro", "-v./ramalama:/usr/share/ramalama/ramalama:ro", "--device", "/dev/dri", "quay.io/ramalama/ramalama:latest", "/usr/bin/ramalama", "ls"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/2324,unix/unix:/tmp/.ICE-unix/2324", "WINDOWID=94090707333920", "COLORTERM=truecolor", "HISTCONTROL=ignoredups", "XDG_MENU_PREFIX=gnome-", "GTK_IM_MODULE=gtk-im-context-simple:xim", "HOSTNAME=p1", "HISTSIZE=1000", "GUESTFISH_OUTPUT=\\e[0m", "SSH_AUTH_SOCK=/run/user/1000/keyring/ssh", "MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=", "XMODIFIERS=@im=none", "DESKTOP_SESSION=gnome", "LMOD_DIR=/usr/share/lmod/lmod/libexec", "EDITOR=/usr/bin/nano", "PWD=/home/curtine/git", "XDG_SESSION_DESKTOP=gnome", "LOGNAME=curtine", "XDG_SESSION_TYPE=wayland", "MODULESHOME=/usr/share/lmod/lmod", "MANPATH=/usr/share/lmod/lmod/share/man:", "SYSTEMD_EXEC_PID=2400", "XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.6MV9T2", "GUESTFISH_RESTORE=\\e[0m", "JIRA_API_TOKEN=OTE2NTcxMzI0NzYzOu3/1QaCM2ZXHbyb1wWOZdy0C9aW", "GJS_DEBUG_TOPICS=JS ERROR;JS LOG", "GDM_LANG=en_IE.utf8", "HOME=/home/curtine", "USERNAME=curtine", "LANG=en_IE.utf8", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;0"..., "XDG_CURRENT_DESKTOP=GNOME", "MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/session.slice/org."..., "WAYLAND_DISPLAY=wayland-0", "LMOD_SETTARG_FULL_SUPPORT=no", "GUESTFISH_PS1=\\[\\e[1;32m\\]><fs>\\[\\e[0;31m\\] ", "INVOCATION_ID=35214cd7441f4baa99abd0b6a8b6c7c6", "LMOD_VERSION=8.7.37", "MANAGERPID=2108", "ALACRITTY_SOCKET=/run/user/1000/Alacritty-wayland-0-342471.sock", "GJS_DEBUG_OUTPUT=stderr", "MODULEPATH_ROOT=/usr/share/modulefiles", "MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed", "GNOME_SETUP_DISPLAY=:1", "XDG_SESSION_CLASS=user", "LMOD_PKG=/usr/share/lmod/lmod", "TERM=xterm-256color", "LESSOPEN=||/usr/bin/lesspipe.sh %s", "USER=curtine", "DISPLAY=:0", "LMOD_ROOT=/usr/share/lmod", "SHLVL=1", "BASH_ENV=/usr/share/lmod/lmod/init/bash", "LMOD_sys=Linux", "GUESTFISH_INIT=\\e[1;34m", "QT_IM_MODULE=xim", "XDG_RUNTIME_DIR=/run/user/1000", "DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/ ", "KDEDIRS=/usr", "JOURNAL_STREAM=9:26157", "XDG_DATA_DIRS=/home/curtine/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/l"..., "PATH=/home/curtine/.cargo/bin:/home/curtine/go/bin:/home/curtine/git/staging:/home/curtine/git/stagi"..., "MODULEPATH=/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefil"..., "ALACRITTY_LOG=/tmp/Alacritty-342471.log", "GDMSESSION=gnome", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus", "LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod", "MAIL=/var/spool/mail/curtine", "ALACRITTY_WINDOW_ID=94090707333920", "GIO_LAUNCHED_DESKTOP_FILE_PID=342471", "GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/Alacritty.desktop", "OLDPWD=/home/curtine/git/ramalama", "BASH_FUNC_ml%%=() {  eval \"$($LMOD_DIR/ml_cmd \"$@\")\"\n}", "BASH_FUNC_module%%=() {  if [ -z \"${LMOD_SH_DBG_ON+x}\" ]; then\n case \"$-\" in \n *v*x*)\n __lmod_sh_dbg"..., "_=/usr/bin/strace"]) = 0
-v./ramalama:/usr/share/ramalama/ramalama:ro

this :point_up: only works for development usage... I think people like @rhatdan and I don't really notice this because we use it from the git repo like developers.

I won't get to this fix today, but if someone could hack this out it would be appreciated, it's a bad bag.

ericcurtin commented 6 days ago

I didn't notice this for ages because even when I call the installed version, I'm often stuck in the ramalama git repo anyway so I don't notice.

aclater commented 6 days ago

Crap I see the issue via strace now, it's actually a critical bug:

execve("/usr/bin/podman", ["podman", "run", "--rm", "-it", "--label=RAMALAMA container", "--security-opt=label=disable", "-v/tmp:/tmp", "-e", "RAMALAMA_TRANSPORT", "--name", "ramalama_E9si6r1ZP4", "-v/home/curtine/.local/share/ramalama:/var/lib/ramalama", "-v/home/curtine:/home/curtine", "-v/usr/local/bin/ramalama:/usr/bin/ramalama:ro", "-v./ramalama:/usr/share/ramalama/ramalama:ro", "--device", "/dev/dri", "quay.io/ramalama/ramalama:latest", "/usr/bin/ramalama", "ls"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/2324,unix/unix:/tmp/.ICE-unix/2324", "WINDOWID=94090707333920", "COLORTERM=truecolor", "HISTCONTROL=ignoredups", "XDG_MENU_PREFIX=gnome-", "GTK_IM_MODULE=gtk-im-context-simple:xim", "HOSTNAME=p1", "HISTSIZE=1000", "GUESTFISH_OUTPUT=\\e[0m", "SSH_AUTH_SOCK=/run/user/1000/keyring/ssh", "MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=", "XMODIFIERS=@im=none", "DESKTOP_SESSION=gnome", "LMOD_DIR=/usr/share/lmod/lmod/libexec", "EDITOR=/usr/bin/nano", "PWD=/home/curtine/git", "XDG_SESSION_DESKTOP=gnome", "LOGNAME=curtine", "XDG_SESSION_TYPE=wayland", "MODULESHOME=/usr/share/lmod/lmod", "MANPATH=/usr/share/lmod/lmod/share/man:", "SYSTEMD_EXEC_PID=2400", "XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.6MV9T2", "GUESTFISH_RESTORE=\\e[0m", "JIRA_API_TOKEN=OTE2NTcxMzI0NzYzOu3/1QaCM2ZXHbyb1wWOZdy0C9aW", "GJS_DEBUG_TOPICS=JS ERROR;JS LOG", "GDM_LANG=en_IE.utf8", "HOME=/home/curtine", "USERNAME=curtine", "LANG=en_IE.utf8", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;0"..., "XDG_CURRENT_DESKTOP=GNOME", "MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/session.slice/org."..., "WAYLAND_DISPLAY=wayland-0", "LMOD_SETTARG_FULL_SUPPORT=no", "GUESTFISH_PS1=\\[\\e[1;32m\\]><fs>\\[\\e[0;31m\\] ", "INVOCATION_ID=35214cd7441f4baa99abd0b6a8b6c7c6", "LMOD_VERSION=8.7.37", "MANAGERPID=2108", "ALACRITTY_SOCKET=/run/user/1000/Alacritty-wayland-0-342471.sock", "GJS_DEBUG_OUTPUT=stderr", "MODULEPATH_ROOT=/usr/share/modulefiles", "MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed", "GNOME_SETUP_DISPLAY=:1", "XDG_SESSION_CLASS=user", "LMOD_PKG=/usr/share/lmod/lmod", "TERM=xterm-256color", "LESSOPEN=||/usr/bin/lesspipe.sh %s", "USER=curtine", "DISPLAY=:0", "LMOD_ROOT=/usr/share/lmod", "SHLVL=1", "BASH_ENV=/usr/share/lmod/lmod/init/bash", "LMOD_sys=Linux", "GUESTFISH_INIT=\\e[1;34m", "QT_IM_MODULE=xim", "XDG_RUNTIME_DIR=/run/user/1000", "DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/ ", "KDEDIRS=/usr", "JOURNAL_STREAM=9:26157", "XDG_DATA_DIRS=/home/curtine/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/l"..., "PATH=/home/curtine/.cargo/bin:/home/curtine/go/bin:/home/curtine/git/staging:/home/curtine/git/stagi"..., "MODULEPATH=/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefil"..., "ALACRITTY_LOG=/tmp/Alacritty-342471.log", "GDMSESSION=gnome", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus", "LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod", "MAIL=/var/spool/mail/curtine", "ALACRITTY_WINDOW_ID=94090707333920", "GIO_LAUNCHED_DESKTOP_FILE_PID=342471", "GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/Alacritty.desktop", "OLDPWD=/home/curtine/git/ramalama", "BASH_FUNC_ml%%=() {  eval \"$($LMOD_DIR/ml_cmd \"$@\")\"\n}", "BASH_FUNC_module%%=() {  if [ -z \"${LMOD_SH_DBG_ON+x}\" ]; then\n case \"$-\" in \n *v*x*)\n __lmod_sh_dbg"..., "_=/usr/bin/strace"]) = 0
-v./ramalama:/usr/share/ramalama/ramalama:ro

this ☝️ only works for development usage... I think people like @rhatdan don't really notice this because we use it from the git repo like developers.

I won't get to this fix today, but if someone could hack this out it would be appreciated, it's a bad bag.

Might "./ramalama" also explain why if there is a directory called 'ramalama' in your cwd - ramalama errors out :

mkdir ramalama
aclater@aclater:~/git$ ramalama ls
Traceback (most recent call last):
  File "/usr/bin/ramalama", line 36, in <module>
    main(sys.argv[1:])
  File "/usr/bin/ramalama", line 20, in main
    ramalama.init_cli()
AttributeError: module 'ramalama' has no attribute 'init_cli'
ericcurtin commented 5 days ago

This should fix the issue gonna merge on green build:

https://github.com/containers/ramalama/pull/143

ericcurtin commented 5 days ago

Should work on re-install now, if one reinstalls, test again and everything works fine, I will close this issue