Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation issue on macOS #11

Open
andyylin opened this issue Sep 3, 2024 · 10 comments
Open

Installation issue on macOS #11

andyylin opened this issue Sep 3, 2024 · 10 comments

Comments

@andyylin
Copy link

andyylin commented Sep 3, 2024

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
Copy link
Owner

DonTizi commented Sep 3, 2024

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
Copy link
Owner

DonTizi commented Sep 3, 2024

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

@andyylin
Copy link
Author

andyylin commented Sep 3, 2024

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
Copy link
Owner

DonTizi commented Sep 3, 2024

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
Copy link
Author

andyylin commented Sep 5, 2024

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
Copy link
Owner

DonTizi commented Sep 5, 2024

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
Copy link
Author

andyylin commented Sep 6, 2024

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 [email protected]: 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/[email protected]: Use @eslint/config-array instead
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm warn deprecated [email protected]: 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
Copy link

kjarnot commented Sep 10, 2024

@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
Copy link

kjarnot commented Sep 10, 2024

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.

@andyylin
Copy link
Author

andyylin commented Dec 2, 2024

Okay, so this is the sequence of stuff I did to get it almost running. It doesn't chat with me though.

'''
python -m venv .venv && source .venv/bin/activate
npm install
pip install rumps
pip install psutil
brew remove portaudio
brew install portaudio
pip install pyaudio
'''

After these commands were issued, I was able to 'Install Service' and 'Start Service'.

I can't Pull Models though. I put in 'llama3.2' and it didn't pull. But I already have it installed in Ollama and it shows up in the selection in the chat window.

So then I tried one of the prompted questions, and it just says

An error occurred. Please try again.

The terminal shows this:

'''
Error: [TypeError: fetch failed] { cause: [Error: AggregateError] }
POST /api/chat 500 in 19ms
GET / 200 in 35ms
'''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants