cocktailpeanut / dalai

The simplest way to run LLaMA on your local machine
https://cocktailpeanut.github.io/dalai
13.1k stars 1.42k forks source link

Installation silently fails on fresh WSL install #82

Open misterWiz opened 1 year ago

misterWiz commented 1 year ago

I am attempting to install Dalai on a fresh WSL environment. I've installed all the listed requirements, plus: cmake curl gcc make python3-pip python-is-python3

Running npx dalai install 7B fails silently. I assume I'm missing a dependency? Attached is the output from running npx --verbose dalai install 7B

verbose.txt

Any ideas on what I still need to install?

mattopeerenboom commented 1 year ago

+1 Getting something very similar to verbose.txt on fairly clean windows10 install

ryanalexmartin commented 1 year ago

Fails silently on macos as well

PlutoniaX commented 1 year ago

same fails silently on imac x86 and macbook M1

dcaudell commented 1 year ago

ditto. Fails on fresh images of node:8, ubuntu, with all above requirements installed. verbose.txt

artifishvr commented 1 year ago

Failing silently as well on Windows 11 with Node.js v18.13.0, Python 3.8.10, and all other requirements installed.

LMonert commented 1 year ago

For me it helped installing dalai as an npm package as I got way more logs regarding failures this way.

jelcke commented 1 year ago

same problem on ubuntu 20.04.6 LTS

bitnom commented 1 year ago

It's probably silently failing because you're missing some build dependencies that it tries to install automatically, but can't if you're not using sudo. For instance, assuming that you already have node and python environments on Ubuntu, it also wants:

sudo apt-get install build-essential python3-venv

You can see what it's trying to do by first issuing npm install -g dalai

jelcke commented 1 year ago

This is part of the error log:

1078 info run @cdktf/node-pty-prebuilt-multiarch@0.10.1-pre.10 postinstall { code: 0, signal: null } 1079 timing build:run:postinstall:node_modules/dalai/node_modules/@cdktf/node-pty-prebuilt-multiarch Completed in 54ms 1080 info run dalai@0.2.33 postinstall { code: 1, signal: null } 1081 timing reify:rollback:createSparse Completed in 151ms 1082 timing reify:rollback:retireShallow Completed in 0ms 1083 timing command:install Completed in 9069ms 1084 verbose stack Error: command failed 1084 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) 1084 verbose stack at ChildProcess.emit (node:events:512:28) 1084 verbose stack at maybeClose (node:internal/child_process:1098:16) 1084 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:304:5) 1085 verbose pkgid dalai@0.2.33 1086 verbose cwd /root/dalai 1087 verbose Linux 5.10.147+ 1088 verbose node v19.8.1 1089 verbose npm v9.5.1 1090 error code 1 1091 error path /usr/lib/node_modules/dalai 1092 error command failed 1093 error command sh -c node setup 1094 error mkdir /root/dalai 1094 error exec: apt-get install build-essential python3-venv -y in undefined 1094 error apt-get install build-essential python3-venv -y 1094 error exit 1094 error /usr/lib/node_modules/dalai# apt-get install build-essential python3-venv -y Reading package lists... Done Building dependency tree Reading state information... Done 1094 error python3-venv is already the newest version (3.8.2-0ubuntu2). 1094 error build-essential is already the newest version (12.8ubuntu1.1). 1094 error 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded. 1094 error /usr/lib/node_modules/dalai# exit 1094 error exit 1094 error exec: python3 -m venv /root/dalai/venv in undefined 1094 error python3 -m venv /root/dalai/venv 1094 error exit 1094 error /usr/lib/node_modules/dalai# python3 -m venv /root/dalai/venv 1094 error Error: Command '['/root/dalai/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1. 1094 error /usr/lib/node_modules/dalai# exit 1094 error exit 1094 error exec: python -m venv /root/dalai/venv in undefined 1094 error python -m venv /root/dalai/venv 1094 error exit

misterWiz commented 1 year ago

It's probably silently failing because you're missing some build dependencies that it tries to install automatically, but can't if you're not using sudo. For instance, assuming that you already have node and python environments on Ubuntu, it also wants:

sudo apt-get install build-essential python3-venv

You can see what it's trying to do by first issuing npm install -g dalai

Thanks, this got me closer! I added those two packages and now installation fails non-silently!

hidden@DESKTOP-Q2AI3TL:/mnt/c/WINDOWS/system32$ npx dalai install 7B Need to install the following packages: dalai@0.2.33 Ok to proceed? (y) mkdir /home/hidden/dalai { method: '7B', callparams: [] } /home/hidden/.npm/_npx/3c737cbb02d79cc9/node_modules/dalai/bin/cli.js:30 dalai[method](core, ...callparams).then(() => { ^

TypeError: dalai[method] is not a function at Object. (/home/hidden/.npm/_npx/3c737cbb02d79cc9/node_modules/dalai/bin/cli.js:30:20) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47

Node.js v18.15.0

vhanla commented 1 year ago

TL;DR for Windows

Setup fails on PowerShell call if it has a custom profile script that auto-launches on powershell's startup (obviously if the windows user hast created one, for instance, for formatting custom powershell prompt appearance, git detection and coloring, etc.), it could be fixed by using -NoLogo -NoProfile parameters set, but as of now, removing profile.ps1 from User's documents \ WindowsPowerShell directory allows it to setup Dalai without issues..


Similar issue happens on Windows 10 x64 19045.2728 on Node x64 v18.0.0 (npm 8.6.0) after MSBuild is executed and post-install.js starts, and it just remain stuck at there:

npm timing reify:unpack Completed in 2588ms
npm timing reify:unretire Completed in 1ms
npm timing build:queue Completed in 17ms
npm timing build:link:node_modules/dalai Completed in 37ms
npm timing build:link:node_modules/ejs Completed in 37ms
npm timing build:link:node_modules/semver Completed in 38ms
npm timing build:link:node_modules/isomorphic-git Completed in 41ms
npm timing build:link:node_modules/ejs/node_modules/jake Completed in 41ms
npm timing build:link:node_modules/express/node_modules/mime Completed in 47ms
npm timing build:link:node_modules/isomorphic-git/node_modules/crc-32 Completed in 48ms
npm timing build:link:node_modules/tar/node_modules/mkdirp Completed in 48ms
npm timing build:link:node_modules/isomorphic-git/node_modules/sha.js Completed in 50ms
npm timing build:link Completed in 54ms
npm info run node-pty@0.10.1 install node_modules/node-pty node scripts/install.js
npm info run node-pty@0.10.1 install { code: 0, signal: null }
npm timing build:run:install:node_modules/node-pty Completed in 62790ms
npm timing build:run:install Completed in 62791ms
npm info run dalai@0.2.39 postinstall node_modules/dalai node setup
npm info run node-pty@0.10.1 postinstall node_modules/node-pty node scripts/post-install.js
npm info run node-pty@0.10.1 postinstall { code: 0, signal: null }
npm timing build:run:postinstall:node_modules/node-pty Completed in 167ms
[##################] - reify:terminal-kit: timing build:run:postinstall:node_modules/node-pty Completed in 167ms

imagen And conhost.exe headless pipe remains there waiting. Nothing else happens, I have even many minutes each time using npm install dalai --verbose BTW, I have installed Visual Studio 2022.

If I kill the PowerShell instance called this error shows:

 Error Error: cannot install virtualenv
npm ERR!     at Dalai.setup (C:\Users\vhanla\projects\python\alpaca\node_modules\dalai\index.js:342:15)
npm verb exit 1
npm timing npm Completed in 810784ms
npm verb unfinished npm timer reify 1679198149745
npm verb unfinished npm timer reify:build 1679198169274
npm verb unfinished npm timer build 1679198169275
npm verb unfinished npm timer build:deps 1679198169278
npm verb unfinished npm timer build:run:postinstall 1679198232148
npm verb unfinished npm timer build:run:postinstall:node_modules/dalai 1679198232148
npm verb code 1

npm ERR! A complete log of this run can be found in: log file

And reviewing the LOG file, it seems that the issue has to do with custom powershell profiles, It might be called not using -NoLogo -NoProfile arguments in order to prevent this kind of issues, as this part of the LOG shows after terminating the powershell instance (which seems to be called from CMD, 'cause I'm not using powershell to call npm)

1092 verbose stack Error: command failed
1092 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
1092 verbose stack     at ChildProcess.emit (node:events:527:28)
1092 verbose stack     at maybeClose (node:internal/child_process:1090:16)
1092 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
1093 verbose pkgid dalai@0.2.39
1094 verbose cwd C:\Users\user10\projects\python\alpaca
1095 verbose Windows_NT 10.0.19045
1096 verbose node v18.0.0
1097 verbose npm  v8.6.0
1098 error code 1
1099 error path C:\Users\user10\projects\python\alpaca\node_modules\dalai
1100 error command failed
1101 error command C:\WINDOWS\system32\cmd.exe /d /s /c node setup
1102 error mkdir C:\Users\user10\dalai
1102 error
1102 error downloading self contained python   0% /            downloading self contained python   0% -            downloading self contained python   0%[] in 5min   downloading self contained python   3%[] in 10s    downloading self contained python  24%[] in 1.5s   downloading self contained python  61%[] in 0.4s   downloading self contained python  85%[] in 0.1s   downloading self contained python 100%[] done      downloading self contained python 100%[] done      extracting python
1102 error cleaning up temp files
1102 error exec: C:\Users\user10\dalai\python\python -m pip install --user virtualenv in undefined
1102 error Windows PowerShell
1102 error Copyright (C) Microsoft Corporation. Todos los derechos reservados.
1102 error
1102 error Prueba la nueva tecnología PowerShell multiplataforma https://aka.ms/pscore6]0;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe[?25h[?25hHello, user10! 
Hello, user10! ♥ 
1102 error Today is: sábado, 18 de marzo de 2023
1102 error Welcome to PowerShell version: 5     
1102 error I am: NVIDIAPC
1102 error Let's program![?25hC:\Users\user10\projects\python\alpaca\node_modules\dalai
C:\Users\user10\projects\python\alpaca\node_modules\dalaiî‚°
1102 error $[28GB Free|419GB Used|22:57:54]λ ]0;PS >> User: user10 >> Current DIR: C:\Users\user10\projects\python\alpaca\node_modules\dalai[?25lC:\Users\user10\dalai\python\python -m pip install --user virtualenv [?25hC:\Users\user10\dalai\python\python -m pip install --user virtualenv && exit 
1102 error [?25hEn línea: 1 Carácter: 70
1102 error + ... s\user10\dalai\python\python -m pip install --user virtualenv && exit
1102 error +                                                                   ~~
1102 error El token '&&' no es un separador de instrucciones válido en esta versión.
1102 error     + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
1102 error     + FullyQualifiedErrorId : InvalidEndOfLine
1102 error  
1102 error C:\Users\user10\projects\python\alpaca\node_modules\dalai
C:\Users\user10\projects\python\alpaca\node_modules\dalaiî‚°
1102 error $[28GB Free|419GB Used|22:57:55]λ Error Error: cannot install virtualenv
1102 error     at Dalai.setup (C:\Users\user10\projects\python\alpaca\node_modules\dalai\index.js:342:15)
1103 verbose exit 1
1104 timing npm Completed in 810784ms
1105 verbose unfinished npm timer reify 1679198149745
1106 verbose unfinished npm timer reify:build 1679198169274
1107 verbose unfinished npm timer build 1679198169275
1108 verbose unfinished npm timer build:deps 1679198169278
1109 verbose unfinished npm timer build:run:postinstall 1679198232148
1110 verbose unfinished npm timer build:run:postinstall:node_modules/dalai 1679198232148
1111 verbose code 1
1112 error A complete log of this run can be found in:
1112 error     C:\Users\user10\AppData\Local\npm-cache\_logs\2023-03-19T03_55_49_523Z-debug-0.log

And I already have Python 3.8.6 x64 installed apart of what it seems it is using a self contained Python binary, and it doesn't require it as I have noticed it uses the virtualenv to use %USERPROFILE%\dalai directory for its own purposes.

And finally, as it seems powershell with custom user profiles has issues, I dunno from which node package's call, I tried removing my custom profile.ps1 file from %USERPROFILE%\Documents\WindowsPowerShell\ path, and retried, but it failed due to forced steps done before, but trying again with the node_modules files removed (clean), it worked correctly.

Free-Radical commented 1 year ago

1102 error $�[93m[�[m28GB Free|�[46X419GB Used|�[97m22:57:55�[93m]�[92mλ�[m Error Error: cannot install virtualenv

Dude/dudette, the afore indicates python venv is having an issue, try reinstalling-

sudo apt-get install python3-venv

Free-Radical commented 1 year ago

Everyone having issues should try running the command with -ddd flag and read the resultant log files. E.g.-

npx -ddd dalai llama install 7B

READ IT CAREFULLY and look for "Error" strings it should give you really good idea whats going on, I'm no node.js expert, barely used this crappy s/w before but using these flags I have almost gotten everything working.

Free-Radical commented 1 year ago

ALSO GREAT RESOURCE for WSL and Linux to unfu#k nodejs- https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-beginners-tutorial

TNTran92 commented 1 year ago

Everyone having issues should try running the command with -ddd flag and read the resultant log files. E.g.-

npx -ddd dalai llama install 7B

READ IT CAREFULLY and look for "Error" strings it should give you really good idea whats going on, I'm no node.js expert, barely used this crappy s/w before but using these flags I have almost gotten everything working.

Big thanks for this. I kept getting the silent treatment. Put the flag in and found it it was already working

zuhaibz commented 1 year ago

I am on a macbook, and I had to do npm install first for the install model command to work.