DonTizi / ReMind

Your Local Artificial Memory on your Device.
https://www.recallmemory.io/
Apache License 2.0
436 stars 23 forks source link

Installation issue on macOS #11

Open andyylin opened 2 months ago

andyylin commented 2 months ago

Hello, I've got localhost:3000 set up, but trying to start the service I get this popup error in the browser window:

python remind_sansprint.py /bin/sh: python: command not found

I do have python installed.

Terminal shows this output:

(node:7626) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 ○ Compiling / ...
 ✓ Compiled / in 4.9s (3528 modules)
 GET / 200 in 5254ms
 ✓ Compiled in 896ms (1760 modules)
 ○ Compiling /[id] ...
 ✓ Compiled /[id] in 1572ms (1763 modules)
 ✓ Compiled in 726ms (1748 modules)
 GET /api/tags 200 in 2395ms
 GET /api/tags 200 in 2ms
 GET /favicon.ico 200 in 2701ms
 GET / 200 in 92ms
 GET /favicon.ico 200 in 40ms
 GET /api/tags 200 in 18ms
 GET /api/tags 200 in 3ms
 ✓ Compiled /api/install-service in 491ms (1796 modules)
 GET /api/install-service 500 in 536ms
 ✓ Compiled /api/start-service in 279ms (1798 modules)
 GET /api/start-service 500 in 305ms
 GET /api/start-service 500 in 16ms
 GET / 200 in 221ms
 GET /api/tags 200 in 71ms
 GET /favicon.ico 200 in 80ms
 GET /api/tags 200 in 8ms
 GET /api/install-service 500 in 19ms
 GET /api/install-service 500 in 19ms
 GET /api/install-service 500 in 19ms
 GET /api/start-service 500 in 15ms
 GET / 200 in 37ms
 ✓ Compiled /api/chat in 360ms (134 modules)
Error: [TypeError: fetch failed] { cause: [Error: AggregateError] }
 POST /api/chat 500 in 454ms
Error: [TypeError: fetch failed] { cause: [Error: AggregateError] }
 POST /api/chat 500 in 16ms
 GET / 200 in 29ms
 GET /api/start-service 500 in 17ms
DonTizi commented 2 months ago

It’s possible that Python commands on your Mac are running with python3 instead of python. If that's the case, you can try the following update:

In the route.ts file located in the src/app/api/start-service/route.ts folder, modify line 6:

Current code:

exec('python remind_sansprint.py', (error, stdout, stderr) => {

Change it to:

exec('python3 remind_sansprint.py', (error, stdout, stderr) => {
DonTizi commented 2 months ago

Thanks for letting me know; I will adapt it to work with both setups.

andyylin commented 2 months ago

Thanks, I've modified the file, now I get this error:

Error: Command failed: python remind _sansprint.py Traceback (most recent call last): File "/Users/andylin/Documents/ReMind/remind_sansprint.py", line 12, in <module> import rumps
ModuleNotFoundError: No module named 'rumps'

Formatting might be off, I wasn't able to directly select the error text, so I used OCR to capture it.

DonTizi commented 2 months ago

normally rumps module should be installed within the installer ,

try to do first pip install rumps and start the service after this, let me know

andyylin commented 2 months ago

I did pip3 install rumps and the Start Service button ran for longer, then gave me an error about psutil

So then I did pip3 install psutil and tried to start the service again, now it gives this error:

Error: Command failed: python3
remind
_sansprint.py DEBUG:root:Database not
found at /Users/andylin/Library/Application
Support/RemindEnchanted/regular_data.db,
running
/Users/andylin/Documents/ReMind/Regular_dat
abase.py Traceback (most recent call last): File
"/Users/andylin/Documents/ReMind/remind_san
sprint.py", line 85, in <module>
subprocess.call(['python', regular_db_script])
File
"/Library/Developer/CommandLineTools/Library/
Frameworks/Python3.framework/Versions/3.9/li
b/python3.9/subprocess.py", line 349, in call
with Popen(*popenargs, **kwargs) as p: File
"/Library/Developer/CommandLineTools/Library/
Frameworks/Python3.framework/Versions/3.9/li
b/python3.9/subprocess.py", line 951, in
_init_ self._execute_child(args, executable,
preexec_fn, close_fds, File
"/Library/Developer/CommandLineTools/Library/
Frameworks/Python3.framework/Versions/3.9/li
b/python3.9/subprocess.py", line 1821, in
_execute_child raise
child_exception_type(errno_num, err_msg,
err_filename) FileNotFoundError: [Errno 2] No
such file or directory: 'python'
DonTizi commented 2 months ago

I understand now, you will need to change all the pip commands to pip3 in the installer.py, and do the same for the python command.

Your system uses python3 and pip3, but in the installer, it is currently done with python3 and pip.

Make the changes and let me know. In the meantime, I'll update the installer code to work with both pip/pip3 and python/python3 tomorrow.

andyylin commented 2 months ago

Thanks.

Couldn't figure out how to uninstall, so I just deleted the folder and re-downloaded. I fixed the pip3 and python3 stuff. During install it threw these warnings:

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated electron-packager@17.1.2: Please use @electron/packager moving forward. There is no API change, just a package name change

Then, when installing the service, it still gave me an error with pip again (I'm guessing the install service is another script file?). So I ran the command manually in Terminal: pip3 install --upgrade pip -r requirements.txt

Then it looks like it "failed building wheel for pyaudio":

Building wheels for collected packages: pyaudio, pyautogui, pygetwindow, pypika, pyscreeze, pytweening, mouseinfo, pymsgbox, pyperclip, pyrect
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-39
      creating build/lib.macosx-10.9-universal2-cpython-39/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.macosx-10.9-universal2-cpython-39/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.macosx-10.9-universal2-cpython-39
      creating build/temp.macosx-10.9-universal2-cpython-39/src
      creating build/temp.macosx-10.9-universal2-cpython-39/src/pyaudio
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -DMACOS=1 -I/usr/local/include -I/usr/include -I/opt/homebrew/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c src/pyaudio/device_api.c -o build/temp.macosx-10.9-universal2-cpython-39/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: 'portaudio.h' file not found
      #include "portaudio.h"
               ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
kjarnot commented 2 months ago

@andyylin - this is how I fixed the pyaudio problem. Make sure you have homebrew installed.

xcode-select --install
brew remove portaudio
brew install portaudio
pip3 install pyaudio
kjarnot commented 2 months ago

Also, I should mention that the installation goes much smoother if you use a virtual environment when installing. Simply do:

python -m venv .venv && source .venv/bin/activate

before running the npm install command.