SpotlightKid / jack-select

A systray application to quickly change the JACK-DBus configuration from QjackCtl presets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pkg_resources.DistributionNotFound

mxa opened this issue · comments

$ jack-select
Freshly 'compiled' from the git I get this:

Traceback (most recent call last):
 File "/usr/bin/jack-select", line 6, in <module>
   from pkg_resources import load_entry_point
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3250, in <module>
   @_call_aside
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3234, in _call_aside
   f(*args, **kwargs)
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set
   working_set = WorkingSet._build_master()
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
   ws.require(__requires__)
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 900, in require
   needed = self.resolve(parse_requirements(requirements))
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 786, in resolve
   raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jack-select==1.4.1' distribution was not found and is required by the application

Which distro is this? And which Python version? How did you install exactly?

Does the release version work for you?

Which distro is this?

Kubuntu 19.10

which Python version?

$ python -V
Python 2.7.17rc1
$ python3 -V
Python 3.7.5

How did you install exactly?

$ git clone https://github.com/SpotlightKid/jack-select
$ cd jack-select
$ sudo make PREFIX=/usr install

Does the release version work for you?

when installed with pip3 install jack-select it works as advertised

I can't reproduce this here (on Manjaro). Debian/Ubuntu changes python-setuptools in some way, I'm not sure whether that interferes here.

Can you copy-and-paste the output from your sudo make PREFIX=/usr install command here?

Also, after installation, change out of the jack-select directory (e.g. cd ~), give the output of which jack-select and paste the content of that file, i.e. cat $(which jack-select). Lastly, paste the output of python3 -c 'import jackselect; print(jackselect.__file__)'. All commands from the same terminal/shell session.

If the last command gave no error, try running python3 -m jackselect. If that produces an error, post it here too.

First I remove jack-select from the python package manager, just in case:

sudo pip3 uninstall jack-select
Uninstalling jack-select-1.4.1:
  Would remove:
    /usr/local/bin/jack-select
    /usr/local/lib/python3.7/dist-packages/jack_select-1.4.1.dist-info/*
    /usr/local/lib/python3.7/dist-packages/jackselect/*
Proceed (y/n)? y
  Successfully uninstalled jack-select-1.4.1

Then I do a git pull on the jack-select git and

sudo make PREFIX=/usr install
python3 setup.py install --root=/ --prefix=/usr --optimize=1
running install
running build
running build_py
copying jackselect/qjackctlconf.py -> build/lib/jackselect
running egg_info
writing jack_select.egg-info/PKG-INFO
writing dependency_links to jack_select.egg-info/dependency_links.txt
writing entry points to jack_select.egg-info/entry_points.txt
writing requirements to jack_select.egg-info/requires.txt
writing top-level names to jack_select.egg-info/top_level.txt
reading manifest file 'jack_select.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.rst'
writing manifest file 'jack_select.egg-info/SOURCES.txt'
running install_lib
copying build/lib/jackselect/qjackctlconf.py -> /usr/lib/python3.7/site-packages/jackselect
byte-compiling /usr/lib/python3.7/site-packages/jackselect/qjackctlconf.py to qjackctlconf.cpython-37.pyc
writing byte-compilation script '/tmp/tmp83a1jtp7.py'
/usr/bin/python3 /tmp/tmp83a1jtp7.py
removing /tmp/tmp83a1jtp7.py
running install_egg_info
removing '/usr/lib/python3.7/site-packages/jack_select-1.4.1-py3.7.egg-info' (and everything under it)
Copying jack_select.egg-info to /usr/lib/python3.7/site-packages/jack_select-1.4.1-py3.7.egg-info
running install_scripts
Installing jack-select script to /usr/bin
install -Dm644 jack-select.png -t /usr/share/icons/hicolor/48x48/apps
install -Dm644 jack-select.desktop -t /usr/share/applications
install -Dm644 jack-select.1 -t /usr/share/man/man1
update-desktop-database -q
gtk-update-icon-cache -q /usr/share/icons/hicolor
[main 2019-12-10T14:13:18.000Z] update#setState checking for updates
[main 2019-12-10T14:13:18.030Z] update#setState idle
^C

I had to abort there, it got stuck. Second time it worked though:

sudo make PREFIX=/usr install
python3 setup.py install --root=/ --prefix=/usr --optimize=1
running install
running build
running build_py
running egg_info
writing jack_select.egg-info/PKG-INFO
writing dependency_links to jack_select.egg-info/dependency_links.txt
writing entry points to jack_select.egg-info/entry_points.txt
writing requirements to jack_select.egg-info/requires.txt
writing top-level names to jack_select.egg-info/top_level.txt
reading manifest file 'jack_select.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.rst'
writing manifest file 'jack_select.egg-info/SOURCES.txt'
running install_lib
writing byte-compilation script '/tmp/tmpnyu6kusm.py'
/usr/bin/python3 /tmp/tmpnyu6kusm.py
removing /tmp/tmpnyu6kusm.py
running install_egg_info
removing '/usr/lib/python3.7/site-packages/jack_select-1.4.1-py3.7.egg-info' (and everything under it)
Copying jack_select.egg-info to /usr/lib/python3.7/site-packages/jack_select-1.4.1-py3.7.egg-info
running install_scripts
Installing jack-select script to /usr/bin
install -Dm644 jack-select.png -t /usr/share/icons/hicolor/48x48/apps
install -Dm644 jack-select.desktop -t /usr/share/applications
install -Dm644 jack-select.1 -t /usr/share/man/man1
update-desktop-database -q
gtk-update-icon-cache -q /usr/share/icons/hicolor

outside of the jack-select directory:

which jack-select
/usr/bin/jack-select

and

cat $(which jack-select)
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'jack-select==1.4.1','console_scripts','jack-select'
__requires__ = 'jack-select==1.4.1'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('jack-select==1.4.1', 'console_scripts', 'jack-select')()
    )
python3 -c 'import jackselect; print(jackselect.__file__)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'jackselect'

trying to run it:

jack-select
Traceback (most recent call last):
  File "/usr/bin/jack-select", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3250, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jack-select==1.4.1' distribution was not found and is required by the application

This is very weird. The make install command just calls python3 setup.py install --prefix=/usr to install the jackselect package, and apparently it seems to install it into the right location (/usr/lib/python3.7/site-packages). Yet the jackselect is not found by python3.

Can you do the following:

$ python3
>>> import sys
>>> print(sys.path)

Also, you can try to install with pip install instead of setup.py install:

make wheel
sudo pip install dist/jack_select-1.4.1-py3-none-any.whl

This won't install the .desktop file, the man page or the application icon, though.


I'll see if I can install a Kubuntu 19.10 virtual machine and try to reproduce this.

>>> print(sys.path)
['', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/home/max/.local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/dist-packages', '/usr/local/lib/python3.7/dist-packages/scenedetect-0.5.1.1-py3.7.egg', '/usr/local/lib/python3.7/dist-packages/Click-7.0-py3.7.egg', '/usr/lib/python3/dist-packages']

I don't understand the other part. You mean run make wheel in the git folder?

make wheel
make: *** No rule to make target 'jack-select.1.rst', needed by 'jack-select.1'.  Stop.

and (I need to call pip3, pip will fail because that's python 2.7)

sudo pip3 install dist/jack_select-1.4.1-py3-none-any.whl
Requirement 'dist/jack_select-1.4.1-py3-none-any.whl' looks like a filename, but the file does not exist
Requirement already satisfied: jack-select==1.4.1 from file:///home/max/Code/jack-select/dist/jack_select-1.4.1-py3-none-any.whl in /usr/local/lib/python3.7/dist-packages (1.4.1)
Requirement already satisfied: pyudev in /usr/lib/python3/dist-packages (from jack-select==1.4.1) (0.21.0)
Requirement already satisfied: PyGObject in /usr/lib/python3/dist-packages (from jack-select==1.4.1) (3.34.0)
Requirement already satisfied: pyxdg in /usr/lib/python3/dist-packages (from jack-select==1.4.1) (0.25)
Requirement already satisfied: dbus-python in /usr/lib/python3/dist-packages (from jack-select==1.4.1) (1.2.12)
Requirement already satisfied: pycairo>=1.11.1 in /usr/lib/python3/dist-packages (from PyGObject->jack-select==1.4.1) (1.16.2)

print(sys.path)

Your Python installation seems broken. python setup.py install installs packages into /usr/lib/python3.7/site-packages, but your sys.pathdoes not contain that directory. The latter is something Debian/Ubuntu apparently does but then python setup.py install should not install things there.

You mean run make wheel in the git folder?

Yes, but when you run that in a git checkout of the project, it requires rst2manfrom the Python package docutils to be installed to build jack-select.1 from jack-select.1.rst. The source distribution includes a pre-built jack-select.1.

If that fails, building the jack_select-1.4.1-py3-none-any.whl wheel also fails, then you obviously can't install it with pip.

It might be the fault of an anaconda installation which has the reputation to break all kinds of stuff. I have no idea how to unbreak it other then reinstalling all python3 packages which I just did.

I installed docutils

sudo  pip3 install docutils
Successfully installed docutils-0.15.2
$ make wheel
make: *** No rule to make target 'jack-select.1.rst', needed by 'jack-select.1'.  Stop.

jack-select.1.rst should be in the repository.

huh, weirdly it wasn't in the git clone / pull but I could download it from github.

sudo make wheel
python3 setup.py bdist_wheel
running bdist_wheel
running build
running build_py
running egg_info
writing jack_select.egg-info/PKG-INFO
writing dependency_links to jack_select.egg-info/dependency_links.txt
writing entry points to jack_select.egg-info/entry_points.txt
writing requirements to jack_select.egg-info/requires.txt
writing top-level names to jack_select.egg-info/top_level.txt
reading manifest file 'jack_select.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.desktop'
writing manifest file 'jack_select.egg-info/SOURCES.txt'
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/jackselect
creating build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/quit.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/start.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/stopped.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/stop.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/jack.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/midi.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/images/started.png -> build/bdist.linux-x86_64/wheel/jackselect/images
copying build/lib/jackselect/a2jcontrol.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/qjackctlconf.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/jackselect.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/alsainfo.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/pyudev_gobject.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/jackselect_service.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/devmonitor.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/jackcontrol.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/dbusinterface.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/__init__.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/__main__.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/indicator.py -> build/bdist.linux-x86_64/wheel/jackselect
copying build/lib/jackselect/version.py -> build/bdist.linux-x86_64/wheel/jackselect
running install_egg_info
Copying jack_select.egg-info to build/bdist.linux-x86_64/wheel/jack_select-1.4.1.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.linux-x86_64/wheel/jack_select-1.4.1.dist-info/WHEEL
creating 'dist/jack_select-1.4.1-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'jackselect/__init__.py'
adding 'jackselect/__main__.py'
adding 'jackselect/a2jcontrol.py'
adding 'jackselect/alsainfo.py'
adding 'jackselect/dbusinterface.py'
adding 'jackselect/devmonitor.py'
adding 'jackselect/indicator.py'
adding 'jackselect/jackcontrol.py'
adding 'jackselect/jackselect.py'
adding 'jackselect/jackselect_service.py'
adding 'jackselect/pyudev_gobject.py'
adding 'jackselect/qjackctlconf.py'
adding 'jackselect/version.py'
adding 'jackselect/images/jack.png'
adding 'jackselect/images/midi.png'
adding 'jackselect/images/quit.png'
adding 'jackselect/images/start.png'
adding 'jackselect/images/started.png'
adding 'jackselect/images/stop.png'
adding 'jackselect/images/stopped.png'
adding 'jack_select-1.4.1.dist-info/LICENSE'
adding 'jack_select-1.4.1.dist-info/METADATA'
adding 'jack_select-1.4.1.dist-info/WHEEL'
adding 'jack_select-1.4.1.dist-info/entry_points.txt'
adding 'jack_select-1.4.1.dist-info/top_level.txt'
adding 'jack_select-1.4.1.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel

It is not sufficient to install docutils via the python3 package manager sudp pip3 install docutils this will leave rst2man inaccessible. I had to install this package via sudo apt install python3-docutils

However, still issues:

jack-select 
Traceback (most recent call last):
  File "/usr/bin/jack-select", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3250, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jack-select==1.4.1' distribution was not found and is required by the application

So, I tested installation of jack-select from the git repo on a Kubuntu 19.10 virtual machine, and I can reproduce the error.

(Side note: you need to install the following packages before attempting to install jack-select: build-essential git python3-dbus python3-gi python3-pyudev python3-setuptools python3-xdg and python-docutils (yes, for Python 2, for the rst2man program).

It seems that the version of setuptools on Ubuntu behaves rather strangely, to say the least (I'd call it seriously broken). If you use the --prefix=/usr when installing a Python package with python setup.py install, it will install the package into /usr/lib/python3.7/site-packages, but that directory has been removed from sys.path in the Python version on Debian / Ubuntu. So the package can not be imported.

If you use --prefix=/usr/local (the default), then the package will be installed in a directory, which is in sys.path and it can be imported.

To cut a long story short: if you want to install jack-select from the git repo on Ubuntu, you can't use make PREFIX=/usr install you have to use make install to install it under /usr/local.

In the light of these results I can not really recommend using Ubuntu, unless you are using only software from the distribution packages.

Thanks for checking!