coderholic / pyradio

Curses based internet radio player
www.coderholic.com/pyradio
MIT License
961 stars 129 forks source link

Macos 14 installation can't find pipx #205

Closed Bellavene closed 6 months ago

Bellavene commented 11 months ago

As described in the title, install.py can't find pipx.

s-n-g commented 11 months ago

Hi @Bellavene

I am trying to install macos 14 on vm but the installer gets to an error...

I just made a clean install on macos 12 (monterey) and everything work as expected; pipx was found and pyradio was installed successfully...

Is this a Sonoma thing?

Have all the steps all the way to python3 install.py from PyRadio macOS installation worked fine for you?

In the meantime, I'm giving it another go with the Sonoma installation...

s-n-g commented 11 months ago

BTW, what does this command report?

python3 -m pipx --version
FedeFofo commented 11 months ago

I am having the same issue running MacOS Sonoma.

BTW, what does this command report? python3 -m pipx --version

It returns 1.2.1

s-n-g commented 11 months ago

Can you please post the output of python3 install.py ?

BTW, have you recently upgraded macos from a previous version? I mean did python get update recently?

FedeFofo commented 11 months ago

Can you please post the output?

This is the output:

Installing PyRadio...
Using directory: "/Users/jamesesser/.config/pyradio/data/.cache"
Downloading PyRadio source code...
  url: "https://github.com/coderholic/pyradio/archive/0.9.2.19.zip"
  filename: "/Users/jamesesser/.config/pyradio/data/.cache/pyradio-0.9.2.19.zip"
Extracting RyRadio source code...

Error: pipx not found.
       Please install pipx and try again

An error occured during the installation!
This should have never had happened...
Please report this at http://github.com/coderholic/pyradio/issues

I am running Python 3.11.4

Should I try to update to 3.12?

FedeFofo commented 11 months ago

I just updated to Python 3.12. Nothing changed as far as the error.

s-n-g commented 11 months ago

I think that the problem is that the default python is python2 instead of python3...

What do these commands give back?

python --version
python3 --version
pipx list
python3 -m pipx list
which python3
echo "$PATH"
FedeFofo commented 11 months ago

python --version zsh: command not found: python python3 --version Python 3.12.0 pipx list

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/pipx", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 858, in cli
    setup(parsed_pipx_args)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 805, in setup
    mkdir(constants.LOCAL_BIN_DIR)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/util.py", line 82, in mkdir
    path.mkdir(parents=True, exist_ok=True)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1312, in mkdir
    os.mkdir(self, mode)
FileExistsError: [Errno 17] File exists: '/Applications/VLC.app/Contents/MacOS/VLC'

python3 -m pipx list

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/__main__.py", line 14, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 858, in cli
    setup(parsed_pipx_args)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 805, in setup
    mkdir(constants.LOCAL_BIN_DIR)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/util.py", line 82, in mkdir
    path.mkdir(parents=True, exist_ok=True)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1312, in mkdir
    os.mkdir(self, mode)
FileExistsError: [Errno 17] File exists: '/Applications/VLC.app/Contents/MacOS/VLC'

which python3 /Library/Frameworks/Python.framework/Versions/3.12/bin/python3 echo "$PATH" /Library/Frameworks/Python.framework/Versions/3.12/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

s-n-g commented 11 months ago

Here's what I see from this

  1. python does not exist at all
  2. pipx list gives an error (I suppose this is because you have updated python to 3.12 but pipx uses 3.11 shared libraries?)
  3. pipx ensurepath has not been executed yet?

This is a script that will

Just copy and paste into a file, save it as issue205 in your home folder, and execute it

cd
chmod +x issue205
./issue205

issue205

#!/bin/bash
python3 -m pipx reinstall-all
cd
rm -rf tmp_pyradio 2>/dev/null
rm install.py build_install_pyradio 2>/dev/null
mkdir tmp_pyradio
cd tmp_pyradio
curl -L  https://github.com/coderholic/pyradio/archive/refs/tags/0.9.2.19.tar.gz -o 0.9.2.19.tar.gz
tar xzf 0.9.2.19.tar.gz
curl -L https://github.com/s-n-g/pyradio/raw/devel/devel/build_install_pyradio -o build_install_pyradio
mv build_install_pyradio pyradio-0.9.2.19/devel
chmod +x pyradio-0.9.2.19/devel/build_install_pyradio
curl -L https://github.com/s-n-g/pyradio/raw/devel/pyradio/install.py -o install.py
mv install.py pyradio-0.9.2.19/pyradio
cd pyradio-0.9.2.19
./devel/build_install_pyradio
python3 -m pipx ensurepath

Hope it works... I am sorry I cannot test it myself on Sonoma, I still cannot complete the installation... I have tested it on Monteray...

FedeFofo commented 11 months ago

It didn't work, this is the output it gave:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1392k    0 1392k    0     0  1109k      0 --:--:--  0:00:01 --:--:-- 2186k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 15390  100 15390    0     0  16577      0 --:--:-- --:--:-- --:--:-- 16577
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 61590  100 61590    0     0  64365      0 --:--:-- --:--:-- --:--:-- 64365

Error: pipx not found.
       Please install pipx and try again
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/__main__.py", line 14, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 858, in cli
    setup(parsed_pipx_args)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 805, in setup
    mkdir(constants.LOCAL_BIN_DIR)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/util.py", line 82, in mkdir
    path.mkdir(parents=True, exist_ok=True)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1312, in mkdir
    os.mkdir(self, mode)
FileExistsError: [Errno 17] File exists: '/Applications/VLC.app/Contents/MacOS/VLC'
s-n-g commented 11 months ago

This is exactly the error we got before...

And we have deleted your old pipx virtual environments (~/.local/pipx), which leeds me to believe that at this point it's not a pyradio problem; i think there's something wrong with your pipx installation...

Can you try this:

cd
cd tmp_pyradio/pyradio-0.9.2.19
python3 -m pix install .

If this fails, remove pipx and reinstall it, and try again

FedeFofo commented 11 months ago

I uninstalled pipx then reinstalled it, ran your commands, and this is what happened:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/__main__.py", line 14, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 858, in cli
    setup(parsed_pipx_args)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/main.py", line 805, in setup
    mkdir(constants.LOCAL_BIN_DIR)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pipx/util.py", line 82, in mkdir
    path.mkdir(parents=True, exist_ok=True)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1312, in mkdir
    os.mkdir(self, mode)
FileExistsError: [Errno 17] File exists: '/Applications/VLC.app/Contents/MacOS/VLC'
s-n-g commented 11 months ago

I really do not know what is going on...

It seems pipx is trying to create /Applications/VLC.app/Contents/MacOS/VLC (a directory) but it fails, because it already exists... What does pipx has to do with VLC?

Is the directory /Applications/VLC.app/Contents/MacOS/VLC empty by any chance?

Can it be safely deleted?

FedeFofo commented 11 months ago

That directory is the executable that launches VLC

s-n-g commented 11 months ago

BTW, I have just tried one more time to install Sonoma, but it still fails on me... :cry:

s-n-g commented 11 months ago

That directory is the executable that launches VLC

I am lost! What does pipx has to do with it?

FedeFofo commented 11 months ago

I have no clue! Is there any other way I can use pyradio?

s-n-g commented 11 months ago

Let me think...

s-n-g commented 11 months ago

I believe this would do it...

cd
cd tmp_pyradio/pyradio-0.9.2.19
rm -rf ~/.local/pipx
rm ~/.local/bin/pyradio
python3 -m pip install wheel setuptools rich requests dnspython psutil netifaces dateutils
python3 -m pip install .

And please make sure ~/.local/bin is in your PATH

s-n-g commented 11 months ago

I have corrected the command above...

To add ~/.local/bin to your PATH, you will have to edit a file...

But let us just see if the installation is successful

FedeFofo commented 11 months ago

It built and it ran! But, I got the error:

PyRadio is not able to use the player you specified.                                                                                                                                                                                                                                                                                                                                                                             This means that either this particular player is not supported                                                                                                                                                     
by PyRadio, or that you have simply misspelled its name.                                                                                                                                                           
PyRadio currently supports three players: mpv, mplayer and vlc,                                                                                                                                                    
automatically detected in this order.                                                                                                                                                                                                            

even though I have vlc installed.

Bellavene commented 11 months ago

Try brew install mpv with custom scripts, nothing better is out there, imho

FedeFofo commented 11 months ago

it is too complicated to install that, I don't even have homebrew. Is it possible to still work with vlc?

s-n-g commented 11 months ago

There is a link you have to put in your PATH for that to work...

Execute /Applications/VLC.app/Contents/MacOS/VLC in the terminal

Does VLC starts?

Bellavene commented 11 months ago

Its the same as for vlc to work, it tries to find /opt/homebrew/bin/vlc executable. So you need anyway to brew install vlc or edit in the python scripts the path to it.

s-n-g commented 11 months ago

@Bellavene

Can you execute

python3 -m pipx list

and report back its response?

FedeFofo commented 11 months ago

Execute /Applications/VLC.app/Contents/MacOS/VLC in the terminal

Does VLC starts?

Yes, it does.

s-n-g commented 11 months ago

Yes, it does.

Ok, wait...

Bellavene commented 11 months ago

python3 -m pipx list

venvs are in /Users/Bellavene/.local/pipx/venvs
apps are exposed on your $PATH at /Users/Klutchevski/.local/bin
⚠️  package macnotesapp has invalid interpreter /usr/local/opt/python@3.9/bin/python3.9
   package stig 0.12.5a0, installed using Python 3.11.5
    - stig
   package yewtube 2.9.4, installed using Python 3.11.2
    - yt

One or more packages have a missing python interpreter.
    To fix, execute: pipx reinstall-all
s-n-g commented 11 months ago

@Bellavene Can you please follow this: https://github.com/coderholic/pyradio/issues/205#issuecomment-1816777338

s-n-g commented 11 months ago

@FedeFofo

Execute

ln -s /Applications/VLC.app/Contents/MacOS/VLC ~/.local/bin

and then run pyradio

FedeFofo commented 11 months ago

That outputs

ln: /Users/jamesesser/.local/bin: File exists

and when I ran pyradio I got the same error

Bellavene commented 11 months ago

@FedeFofo

Execute

ln -s /Applications/VLC.app/Contents/MacOS/VLC ~/.local/bin

and then run pyradio

Better to sudo ln -s /Applications/VLC.app/Contents/MacOS/VLC /usr/local/bin/vlc

s-n-g commented 11 months ago

Better to sudo ln -s /Applications/VLC.app/Contents/MacOS/VLC /usr/local/bin/vlc

This might work as well...

Bellavene commented 11 months ago

Better to sudo ln -s /Applications/VLC.app/Contents/MacOS/VLC /usr/local/bin/vlc

This might work as well...

It is better, because he doesn't need to add a PATH

FedeFofo commented 11 months ago

I ran it, didn't get the same error, but it still didn't work when I opened PyRadio

Bellavene commented 11 months ago

Now try to run in a new terminal session vlc.

FedeFofo commented 11 months ago

Running it from the terminal says

2023-11-17 12:45:59.892 vlc[72122:1087164] Sparkle: Error: the bundle being updated at NSBundle </usr/local/bin> (loaded) has no CFBundleIdentifier! This will cause preference read/write to not work properly.
2023-11-17 12:45:59.899 vlc[72122:1087164] -[NSWindowController loadWindow]: failed to load window nib file 'MainWindow'.
2023-11-17 12:45:59.899 vlc[72122:1087164] -[NSWindowController loadWindow]: failed to load window nib file 'MainWindow'.
2023-11-17 12:45:59.899 vlc[72122:1087164] -[NSWindowController loadWindow]: failed to load window nib file 'MainWindow'.

it still works to run it normally though

s-n-g commented 11 months ago

Do you still get the window up? Can you play a stream with it?

For example

vlc http://somafm.com/illstreet.pls
Bellavene commented 11 months ago

Strange, should be

VLC media player 3.0.18 Vetinari (revision 3.0.18-0-ge9eceaed4d)
[000000012b804170] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000000012a608cf0] main playlist: playlist is empty

Ok, maybe the actual vlc executable differs. Then delete the created link with sudo rm -rf /usr/local/bin/vlc

And we must edit the python script to execute open -a VLC.app

Bellavene commented 11 months ago

vlc http://somafm.com/illstreet.pls

of course

Bellavene commented 11 months ago

open -a VLC.app http://somafm.com/illstreet.pls works great though I use it all the time in scripts.

s-n-g commented 11 months ago

@FedeFofo

Close all terminals (right click on the Terminal icon and select Quit)

Then open a new terminal and

/Applications/VLC.app/Contents/MacOS/VLC http://somafm.com/illstreet.pls

And then

vlc http://somafm.com/illstreet.pls

Do both of these commands work? Does the stream plays both times?

s-n-g commented 11 months ago

@Bellavene Have you tried: https://github.com/coderholic/pyradio/issues/205#issuecomment-1816777338

Does the installation succeeds?

Bellavene commented 11 months ago

@Bellavene Have you tried: #205 (comment)

Does the installation succeeds?

I'l try it later, a bit busy right now. Thanks

FedeFofo commented 11 months ago

The first command works, the second just returns zsh: command not found: vlc

s-n-g commented 11 months ago

ok, wait... Let me see your PATH from a previous post

Bellavene commented 11 months ago

He doesn't need any path, we just need to change in the python source the execution command from vlcto open -a VLC.app This will be much simpler for all.

s-n-g commented 11 months ago

Execute:

sudo ln -s /Applications/VLC.app/Contents/MacOS/VLC  /usr/local/bin/vlc

Then try vlc http://somafm.com/illstreet.pls

If it does not work, try closing all terminals (right click on the Terminal icon and select Quit)

Open a new terminal and try again vlc http://somafm.com/illstreet.pls

FedeFofo commented 11 months ago

It works but pyradio still doesn't