rembo10 / headphones

Automatic music downloader for SABnzbd
GNU General Public License v3.0
3.35k stars 603 forks source link

trouble after install #3286

Closed hlubach closed 2 years ago

hlubach commented 2 years ago

Have it installed like described for Linux ,with one restriction to install it in /opt it could only be done with sudo

Try to run it in the terminal with python3 an this is what i get

han@Laptop:/opt/headphones$ python3 Headphones.py Traceback (most recent call last): File "/opt/headphones/lib/jaraco/text/init.py", line 7, in from importlib.resources import files # type: ignore ImportError: cannot import name 'files' from 'importlib.resources' (/usr/lib/python3.8/importlib/resources.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "Headphones.py", line 27, in from headphones import webstart, logger File "/opt/headphones/headphones/init.py", line 27, in import cherrypy File "/opt/headphones/lib/cherrypy/init.py", line 66, in from ._cperror import ( File "/opt/headphones/lib/cherrypy/_cperror.py", line 135, in from cherrypy.lib import httputil as _httputil File "/opt/headphones/lib/cherrypy/lib/httputil.py", line 20, in import jaraco.collections File "/opt/headphones/lib/jaraco/collections.py", line 10, in import jaraco.text File "/opt/headphones/lib/jaraco/text/init.py", line 9, in from importlib_resources import files # type: ignore ModuleNotFoundError: No module named 'importlib_resources' Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook with os.fdopen(os.open(pr_filename, FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_opt_headphones_Headphones.py.1000.crash'

Original exception was: Traceback (most recent call last): File "/opt/headphones/lib/jaraco/text/init.py", line 7, in from importlib.resources import files # type: ignore ImportError: cannot import name 'files' from 'importlib.resources' (/usr/lib/python3.8/importlib/resources.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "Headphones.py", line 27, in from headphones import webstart, logger File "/opt/headphones/headphones/init.py", line 27, in import cherrypy File "/opt/headphones/lib/cherrypy/init.py", line 66, in from ._cperror import ( File "/opt/headphones/lib/cherrypy/_cperror.py", line 135, in from cherrypy.lib import httputil as _httputil File "/opt/headphones/lib/cherrypy/lib/httputil.py", line 20, in import jaraco.collections File "/opt/headphones/lib/jaraco/collections.py", line 10, in import jaraco.text File "/opt/headphones/lib/jaraco/text/init.py", line 9, in from importlib_resources import files # type: ignore ModuleNotFoundError: No module named 'importlib_resources'

rembo10 commented 2 years ago

Are you using the git version? Can you try deleting the .pyc files in the headphones dir: find . -name '*.pyc' -delete

hlubach commented 2 years ago

Installed according these lines Linux

Headphones will be installed to /opt/headphones.

Open a terminal
Install Git
    Ubuntu/Debian: sudo apt-get install git-core
        Type: cd /opt.
Type: git clone https://github.com/rembo10/headphones.git
Type: cd headphones
Type: python Headphones.py 

and the last line must be python3 Headphones .py
to get it installed in /opt   It was only posibble by using sudo 
after doing al this I got that error
rembo10 commented 2 years ago

What's in /usr/lib/python3.8/importlib? ls -al /usr/lib/python3.8/importlib

leprasmurf commented 2 years ago

Experiencing a similar issue trying to install headphones on Ubuntu 20.04 with python3

root@headphones02:/opt/headphones# python3 Headphones.py
Traceback (most recent call last):
  File "/opt/headphones/lib/jaraco/text/__init__.py", line 7, in <module>
    from importlib.resources import files  # type: ignore
ImportError: cannot import name 'files' from 'importlib.resources' (/usr/lib/python3.8/importlib/resources.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Headphones.py", line 27, in <module>
    from headphones import webstart, logger
  File "/opt/headphones/headphones/__init__.py", line 27, in <module>
    import cherrypy
  File "/opt/headphones/lib/cherrypy/__init__.py", line 66, in <module>
    from ._cperror import (
  File "/opt/headphones/lib/cherrypy/_cperror.py", line 135, in <module>
    from cherrypy.lib import httputil as _httputil
  File "/opt/headphones/lib/cherrypy/lib/httputil.py", line 20, in <module>
    import jaraco.collections
  File "/opt/headphones/lib/jaraco/collections.py", line 10, in <module>
    import jaraco.text
  File "/opt/headphones/lib/jaraco/text/__init__.py", line 9, in <module>
    from importlib_resources import files  # type: ignore
ModuleNotFoundError: No module named 'importlib_resources'

Here is my import lib folder

root@headphones02:/opt/headphones# ls -al /usr/lib/python3.8/importlib
total 304
drwxr-xr-x  3 root root    11 Feb  3 10:16 .
drwxr-xr-x 30 root root   205 Feb  3 19:46 ..
-rw-r--r--  1 root root 12873 Nov 26 15:14 abc.py
-rw-r--r--  1 root root 64530 Nov 26 15:14 _bootstrap_external.py
-rw-r--r--  1 root root 39644 Nov 26 15:14 _bootstrap.py
-rw-r--r--  1 root root  6061 Nov 26 15:14 __init__.py
-rw-r--r--  1 root root   844 Nov 26 15:14 machinery.py
-rw-r--r--  1 root root 17626 Nov 26 15:14 metadata.py
drwxr-xr-x  2 root root    10 Feb  3 10:16 __pycache__
-rw-r--r--  1 root root  9536 Nov 26 15:14 resources.py
-rw-r--r--  1 root root 11319 Nov 26 15:14 util.py
leprasmurf commented 2 years ago

Seems to be related to the jaraco module based on

File "/opt/headphones/lib/jaraco/text/init.py", line 7, in

https://github.com/rembo10/headphones/blob/master/lib/jaraco/text/__init__.py#L7

Trying to import either reference fails:

root@headphones02:~# python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.resources import files  # type: ignore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'files' from 'importlib.resources' (/usr/lib/python3.8/importlib/resources.py)
>>> from importlib_resources import files  # type: ignore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'importlib_resources'

Installed python3-importlib-metadata via apt, to no avail

root@headphones02:~# python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.resources import files
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'files' from 'importlib.resources' (/usr/lib/python3.8/importlib/resources.py)
>>> from importlib_resources import files  # type: ignore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'importlib_resources'

Installed via pip:

root@headphones02:~# python3 -mpip install importlib.resources

and now the imports are working. I can start the service as expected.

rembo10 commented 2 years ago

I wonder if it makes sense to bundle importlib_resources in lib/.....

leprasmurf commented 2 years ago

Looks to be about 400kb on my system, though it does seem to have a fairly frequent update cycle: https://github.com/python/importlib_resources/releases.

Bundling should prevent the error if the package isn't already installed, though dependency hell is a pain. I'm afraid I can't really vouch for an alternative, but using requirements.txt or Pipfile might help to simplify a little.

hlubach commented 2 years ago

Use the Pip and installed Headphones Wichb gives diret an other error I can see it in the browser but importing Music No way

  Level Message
2022-02-05 10:19:12 ERROR Uncaught exception: Traceback (most recent call last): File "/home/han/headphones/headphones/logger.py", line 215, in new_run old_run(*args, *kwargs) File "/usr/lib/python3.8/threading.py", line 870, in run self._target(self._args, **self._kwargs) File "/home/han/headphones/headphones/librarysync.py", line 211, in libraryScan sorted_dbtracks = helpers.multikeysort(dbtracks, ['ArtistName', 'AlbumTitle']) File "/home/han/headphones/headphones/helpers.py", line 70, in multikeysort return sorted(items, key=functools.cmp_to_key(comparer)) File "/home/han/headphones/headphones/helpers.py", line 64, in comparer result = cmp(fn(left), fn(right)) File "/home/han/headphones/headphones/helpers.py", line 55, in cmp return (x > y) - (x < y)TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'
hlubach commented 2 years ago

Use the Pip and installed Headphones Wichb gives diret an other error I can see it in the browser but importing Music No way

  Level Message
2022-02-05 10:19:12 ERROR Uncaught exception: Traceback (most recent call last): File "/home/han/headphones/headphones/logger.py", line 215, in new_run old_run(*args, *kwargs) File "/usr/lib/python3.8/threading.py", line 870, in run self._target(self._args, **self._kwargs) File "/home/han/headphones/headphones/librarysync.py", line 211, in libraryScan sorted_dbtracks = helpers.multikeysort(dbtracks, ['ArtistName', 'AlbumTitle']) File "/home/han/headphones/headphones/helpers.py", line 70, in multikeysort return sorted(items, key=functools.cmp_to_key(comparer)) File "/home/han/headphones/headphones/helpers.py", line 64, in comparer result = cmp(fn(left), fn(right)) File "/home/han/headphones/headphones/helpers.py", line 55, in cmp return (x > y) - (x < y)TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'
hlubach commented 2 years ago

this is from the terminal

han@Laptop:~/.headphones$ python3 Headphones.py /home/han/.headphones/lib/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release warnings.warn(

hlubach commented 2 years ago

The situation at this moment After the command Python3 Headphones.py it wl go to the local host , but in no way i can import a library Stopped the prgram and start in the terminal with --verbose han@Laptop:~/headphones$ python3 Headphones.py --verbose

/home/han/headphones/lib/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release warnings.warn( 05-feb-2022 15:57:37 - INFO :: MainThread : Checking to see if the database has all tables.... 05-feb-2022 15:57:37 - DEBUG :: MainThread : SQLite Version: 3.31.1 05-feb-2022 15:57:37 - DEBUG :: MainThread : DB-API Version: 2.6.0 05-feb-2022 15:57:37 - DEBUG :: MainThread : Trying to execute: "git rev-parse HEAD" with shell in /home/han/headphones 05-feb-2022 15:57:37 - DEBUG :: MainThread : Git output: 517d0eb32769db0cd49c745dab23664045d77696 05-feb-2022 15:57:37 - DEBUG :: MainThread : Trying to execute: "git rev-parse --abbrev-ref HEAD" with shell in /home/han/headphones 05-feb-2022 15:57:37 - DEBUG :: MainThread : Git output: master 05-feb-2022 15:57:37 - INFO :: MainThread : Retrieving latest version information from GitHub 05-feb-2022 15:57:37 - DEBUG :: MainThread : Requesting URL via GET method: https://api.github.com/repos/rembo10/headphones/commits/master 05-feb-2022 15:57:37 - DEBUG :: MainThread : Latest version is 517d0eb32769db0cd49c745dab23664045d77696 05-feb-2022 15:57:37 - INFO :: MainThread : Headphones is up to date 05-feb-2022 15:57:37 - DEBUG :: MainThread : Using the following server values: MBHost: musicbrainz.org, MBPort: 80, Sleep Interval: 1 05-feb-2022 15:57:37 - INFO :: MainThread : Starting Headphones web server on http://localhost:8181/ 05-feb-2022 15:57:38 - INFO :: MainThread : Scheduled background task: Search for Wanted 05-feb-2022 15:57:38 - INFO :: MainThread : Scheduled background task: Download Scan 05-feb-2022 15:57:38 - INFO :: MainThread : Scheduled background task: Library Scan 05-feb-2022 15:57:38 - INFO :: MainThread : Scheduled background task: MusicBrainz Update 05-feb-2022 15:57:38 - INFO :: MainThread : Scheduled background task: Check GitHub for updates

I am strugglin already two days to got it work in Linux Mint

rembo10 commented 2 years ago

I'm looking into the best way to fix it

rembo10 commented 2 years ago

Did you run the find . -name '*.pyc' -delete command like I mentioned in an earlier reply? In your case you will need to preface it with sudo (and run it in the headphones install dir)? It might get rid of the pkg_resources warning

hlubach commented 2 years ago

i deleted all files clean my Linux Mint and started over Just as you decscribes but failure was stil there, then used the -mpip install importlib.resources and then the installin take pace It even start the Local host , but that was al it did Cannot import files and therefor i can evaluate this program Strange enough on my windows laptop I can to get it workin after py Headphones.py also aan error
but now on Linux will try your lart remark

hlubach commented 2 years ago

"rembo10" @. @*.**@*.**>)> schreef op 5 februari 2022 16:18: Did you run the find . -name '.pyc' -delete command like I mentioned in an earlier reply? In your case you will need to preface it with sudo (and run it in the headphones install dir)? It might get rid of the pkg_resources warning

Reply to this email directly, view it on GitHub (https://github.com/rembo10/headphones/issues/3286#issuecomment-1030643250), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AB344IBDJO43NU7IJRF2KRTUZU5UNANCNFSM5NQMPHKQ). Triage notifications on the go with GitHub Mobile for iOS (https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or Android (https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you modified the open/close state.Message ID: @.> @.:~$ git --version git version 2.25.1 @.:~$ pip -V pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8) @.:~$ python3 -V Python 3.8.10 @.***:~$ This is installed at my Laptop with Linux Mint 20

Now I anm going to install Headphones like the instructions saay
* Type: cd /opt.
* Type: git clone https://github.com/rembo10/headphones.git (https://github.com/rembo10/headphones.git)
* Here a problen without sudo i want install
* ***@***.***:/opt$ git clone https://github.com/rembo10/headphones.git (https://github.com/rembo10/headphones.git)

fatal: could not create work tree dir 'headphones': Toegang geweigerd

Here also a problenm I must give in python3

rembo10 commented 2 years ago

Since /opt/headphones is owned by root, headphones can't create a data dir, you can try doing something like: python3 Headphones.py --datadir ~/.local/share/headphones --config ~/.config/headphones/config.ini or something like that (you can just use --datadir, and it will put the config file there)

hlubach commented 2 years ago

"rembo10" @. @*.**@*.***>)> schreef op 6 februari 2022 03:41: Since /opt/headphones is owned by root, headphones can't create a data dir, you can try doing something like: python3 Headphones.py --datadir ~/.local/share/headphones --config ~/.config/headphones/config.ini or something like that (you can just use --datadir, and it will put the config file there)

Reply to this email directly, view it on GitHub (https://github.com/rembo10/headphones/issues/3286#issuecomment-1030739230), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AB344IHQXLBQEI4PEWNW4IDUZXNXLANCNFSM5NQMPHKQ). Triage notifications on the go with GitHub Mobile for iOS (https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or Android (https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you modified the open/close state.Message ID: @.***> Did this step

Headphones started in browser

Fill in the music directory it changes savd and library wil be scanned

But no action at all

Looḱing in he log file
2022-02-06 12:35:08
ERROR

Uncaught exception: Traceback (most recent call last): File "/opt/headphones/headphones/logger.py", line 215, in new_run old_run(*args, *kwargs) File "/usr/lib/python3.8/threading.py", line 870, in run self._target(self._args, **self._kwargs) File "/opt/headphones/headphones/librarysync.py", line 211, in libraryScan sorted_dbtracks = helpers.multikeysort(dbtracks, ['ArtistName', 'AlbumTitle']) File "/opt/headphones/headphones/helpers.py", line 70, in multikeysort return sorted(items, key=functools.cmp_to_key(comparer)) File "/opt/headphones/headphones/helpers.py", line 64, in comparer result = cmp(fn(left), fn(right)) File "/opt/headphones/headphones/helpers.py", line 55, in cmp return (x > y) - (x < y) TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'

2022-02-06 12:35:08
INFO
Matching tracks to the appropriate releases....
2022-02-06 12:35:08
INFO
Found 2179 new/modified tracks in `/home/han/muziek/`
2022-02-06 12:35:08
INFO
0 new/modified tracks found and added to the database
2022-02-06 12:35:04
INFO
Scanning music directory: /home/han/muziek/
2022-02-06 12:35:04
ERROR
Error writing configuration file: [Errno 2] Bestand of map bestaat niet: '/home/han/.config/headphones/config.ini'
2022-02-06 12:35:04
INFO
Writing configuration to file
rembo10 commented 2 years ago

Can you try the develop branch? Also for this "Error writing configuration file", you might need to create the .config/hedaphones directory. Sorry about that.

hlubach commented 2 years ago

"rembo10" @. @*.**@*.***>)> schreef op 7 februari 2022 03:40: Can you try the develop branch? Also for this "Error writing configuration file", you might need to create the .config/hedaphones directory. Sorry about that.

Reply to this email directly, view it on GitHub (https://github.com/rembo10/headphones/issues/3286#issuecomment-1031016896), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AB344IHT6FNLEHJJPADPEIDUZ4WKZANCNFSM5NQMPHKQ). Triage notifications on the go with GitHub Mobile for iOS (https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or Android (https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you modified the open/close state.Message ID: @.***> Where to get the develop bracnhe and how to create .config /headphones

I An not so familiar with linux command just ean amateur with Linux installed
hlubach commented 2 years ago

"rembo10" @. @*.**@*.***>)> schreef op 7 februari 2022 03:40: Can you try the develop branch? Also for this "Error writing configuration file", you might need to create the .config/hedaphones directory. Sorry about that.

Reply to this email directly, view it on GitHub (https://github.com/rembo10/headphones/issues/3286#issuecomment-1031016896), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AB344IHT6FNLEHJJPADPEIDUZ4WKZANCNFSM5NQMPHKQ). Triage notifications on the go with GitHub Mobile for iOS (https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or Android (https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you modified the open/close state.Message ID: @.***> I have no deleted all the file of Headphones run a script to clean Linux

so now wanted to try your suggestion , but how to this

Because I am not familiar with builkding and linux commands
rembo10 commented 2 years ago

That's ok. To make the config directory you can just run mkdir -p ~/.config/headphones and to get the develop branch, if you used git to download the source, you can run git checkout develop or if you downloaded the zip, you can get the latest develop zip here

hlubach commented 2 years ago

"rembo10" @. @*.**@*.***>)> schreef op 7 februari 2022 10:58: That's ok. To make the config directory you can just run mkdir -p ~/.config/headphones and to get the develop branch, if you used git to download the source, you can run git checkout develop or if you downloaded the zip, you can get the latest develop zip here (https://github.com/rembo10/headphones/archive/refs/heads/develop.zip)

Reply to this email directly, view it on GitHub (https://github.com/rembo10/headphones/issues/3286#issuecomment-1031277230), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AB344IHSZ5M33M6YLPPL22TUZ6JUZANCNFSM5NQMPHKQ). Triage notifications on the go with GitHub Mobile for iOS (https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or Android (https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you modified the open/close state.Message ID: @.***> Oke gonna try this

sudo apt-get install git-core
* cd /opt.
* Type: git clone https://github.com/rembo10/headphones.git
Before running the next commando,s i will run

that's ok. To make the config directory you can just run mkdir -p ~/.config/headphones

Since /opt/headphones is owned by root, headphones can't create a data dir, you can try doing something like:

python3 Headphones.py --datadir ~/.local/share/headphones --config ~/.config/headphones/config.ini

and after that 
* Type: cd headphones
* Type: python3 Headphones.py
Then looks if it nworks other then the command 

to get the develop branch, if you used git to download the source, you can run git checkout develop

is that correct
rembo10 commented 2 years ago

In /opt/headphones: sudo git checkout develop (to go back to master: sudo git checkout master)

EDIT: You can stay on the master branch, I'll push the changes there frequently at the moment

rembo10 commented 2 years ago

Anyway I'm gonna close this in favor of #3288 since it's the same error and the title is more specific

opbillbobaggins commented 2 years ago

https://github.com/rembo10/headphones/issues/3286#issuecomment-1029941955 There is a missing step to install cherrypy. Need to install via pip. if using ubunto20.04 run pip install cherrypy. Pay attention to output You may need to install pip also. It will give you the command to install pip if you need it in the output of pip install cherrypy. If you did not have pip installed rerun the pip install cherrypy after you install pip.

rembo10 commented 2 years ago

Cherrypy is bundled in the lib/ directory which is added to the path on startup (or at least should be). It seems like a weirder issue that i can't really pinpoint