Issue with loading entry point, possibly connected to version including dev tag

Viewed 3158

I'm getting an error when I try to run my tool from the command line. I've created a setup.py file and put together the entry point. This command line util works when I clone the repo and install on other computers. I wonder if the issue has something to do with the dev tag thats included in the location of package. ('this_tool==0.1.1.dev11')

By using python setup.py --version it's on 0.1.1.dev16. But I'm not sure how to fix this as rerunning the setup.py install doesn't seem to fix the problem.

Traceback (most recent call last):
  File "/Users/USERNAME/miniconda2/envs/USERNAME/bin/this_tool", line 30, in <module>
    sys.exit(load_entry_point('this_tool==0.1.1.dev11', 'console_scripts', 'this_tool')())
  File "/Users/USERNAME/miniconda2/envs/USERNAME/bin/this_tool", line 22, in importlib_load_entry_point
    return next(matches).load()
StopIteration

I can provide my setup.py if needed too, but since it seemed to work on the other computers I don't think that's the problem

2 Answers

In my case this happened when i had two versions of the same package. An older version which didn't have the script and a new version with the console_script installed by setup.py.

The discussion in https://github.com/pypa/setuptools/issues/2390

pointed me in the direction to try out a

pip uninstall mypackage

and i was asked interactively to remove the older version of the package.

After that the StopIteration issue went away.

I had the exact same problem with BorgBackup installed from Entware-ng (opkg) on my NAS

$ /opt/bin/borg
Traceback (most recent call last):
  File "/opt/bin/borg", line 33, in <module>
    sys.exit(load_entry_point('borgbackup==1.1.16', 'console_scripts', 'borg')())
  File "/opt/bin/borg", line 25, in importlib_load_entry_point
    return next(matches).load()
StopIteration

and as @anup-jonchhe commented above, a fresh install indeed solved the problem.

But I could also fix this issue without a full reinstallation.

In my setup, the problem occurred right after an update of the tool

opkg update && opkg upgrade python3-borgbackup

The problem is that the upgrade process left some conflicting directory which raised the error
In the directory /opt/lib/python3.9/site-packages
the upgrade from BorgBackup 1.1.15-1 to 1.1.16-1 left the old directory
borgbackup-1.1.15-py3.9.egg-info/
next to the new one
borgbackup-1.1.16-py3.9.egg-info/

After removing manually the old one (1.1.15), borg would run again without any problem

Related