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

LookupError: No trigger by the name "interval" was found #77

Closed
agronholm opened this issue Nov 8, 2014 · 26 comments
Closed

LookupError: No trigger by the name "interval" was found #77

agronholm opened this issue Nov 8, 2014 · 26 comments

Comments

@agronholm
Copy link
Owner

Originally reported by: Rodrigo Brim (Bitbucket: rodrigo_brim, GitHub: Unknown)


Hello.

I'm getting this error with OSX 10.9.4. The following lines describes my problem. Sorry if this is a stupid post.

#!bash

rbr:python rodrigo$ pip list | grep -i apscheduler
APScheduler (3.0.1)

rbr:python rodrigo$ cat ./schedule.py

#!python

#!/usr/bin/python
from datetime import datetime
import os

from apscheduler.schedulers.blocking import BlockingScheduler

def tick():
    print('Tick! The time is: %s' % datetime.now())

if __name__ == '__main__':
    scheduler = BlockingScheduler()
    scheduler.add_job(tick, 'interval', seconds=3)
    print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))

    try:
        scheduler.start()
    except (KeyboardInterrupt, SystemExit):
        pass
#!bash

rbr:python rodrigo$ ./schedule.py 
Traceback (most recent call last):
  File "./schedule.py", line 14, in <module>
    scheduler.add_job(tick, 'interval', seconds=3)
  File "/Library/Python/2.7/site-packages/apscheduler/schedulers/base.py", line 330, in add_job
    'trigger': self._create_trigger(trigger, trigger_args),
  File "/Library/Python/2.7/site-packages/apscheduler/schedulers/base.py", line 782, in _create_trigger
    return self._create_plugin_instance('trigger', trigger, trigger_args)
  File "/Library/Python/2.7/site-packages/apscheduler/schedulers/base.py", line 766, in _create_plugin_instance
    raise LookupError('No {0} by the name "{1}" was found'.format(type_, alias))
LookupError: No trigger by the name "interval" was found
rbr:python rodrigo$

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


I assume you haven't properly installed APScheduler. I should maybe add a warning when that is detected (ie. no triggers are found during plugin lookup).

@agronholm
Copy link
Owner Author

Original comment by Géza Papp (Bitbucket: prambo, GitHub: prambo):


I met with same issue on Raspberry PI installation. It was done by pip without error message. But on the pip.log i found an error: "InstallationError: apscheduler should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+"
Installation by easy_install solved the problem.

@agronholm
Copy link
Owner Author

Original comment by Larry Hartman (Bitbucket: larryhartman50, GitHub: larryhartman50):


I wish to report the same issue with UDOO board using BackgroundScheduler and cron trigger--Python 3.2, apscheduler 3.01, installed with pip3-2.

I installed apscheduler originally with Python 2.7 using pip and apscheduler was working fine with the cron trigger. I then installed Python 3.2 in tandem along with python3-setuptools, python3-dev. I installed apscheduler for Python3 using pip3. No errors reported on install.

I am unsure if this is a bug or just an error pertaining to having two Python environments installed in tandem. Any hints are welcome. I am unable to find any relevant info via Google searches.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


This has been reported when using a stone age version of setuptools (0.6). I have a workaround planned that will remove the requirement of having an up to date version of setuptools. In the meantime, you can instantiate the triggers manually, or update your setuptools.

@agronholm
Copy link
Owner Author

Original comment by Larry Hartman (Bitbucket: larryhartman50, GitHub: larryhartman50):


Alex

Very appreciate of your timely response. It seems the easiest course would be to update the setup tools—I will look at the version that is installed and initially proceed in this direction.

As far as instantiation goes: 1) load triggers library at top of file, 2) create object with loaded class—after this how do I connect the object to the add_jobs function?

Larry

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Give the instantiated trigger as the second parameter to add_job(). See http://apscheduler.readthedocs.org/en/latest/modules/schedulers/base.html#apscheduler.schedulers.base.BaseScheduler.add_job for further details.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Hopefully the new explicit setuptools version requirement fixes this.

@agronholm
Copy link
Owner Author

Original comment by Roel De Coninck (Bitbucket: saroele, GitHub: saroele):


Hi, I don't think it's entirely solved. I installed apscheduler today with sudo pip install apscheduler with this output::

    Collecting apscheduler
  Downloading APScheduler-3.0.4-py2.py3-none-any.whl (47kB)
    100% |████████████████████████████████| 49kB 1.0MB/s 
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from apscheduler)
Requirement already satisfied (use --upgrade to upgrade): futures in /usr/local/lib/python2.7/dist-packages (from apscheduler)
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages (from apscheduler)
Collecting tzlocal (from apscheduler)
  Downloading tzlocal-1.2.tar.gz
Installing collected packages: tzlocal, apscheduler
  Running setup.py install for tzlocal
Successfully installed apscheduler-3.0.4 tzlocal-1.2

But I had the same issue. I'm using pip 7.1.2, which is up-to-date.
However, setuptools was indeed a very old version, and after a sudo pip install --upgrade setuptools and reinstallation of apscheduler with sudo pip install --ignore-installed apscheduler the problem is solved.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


How old was your setuptools then?

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Oddly enough, the setuptools requirement never made it to the wheel metadata. All the other requirements are there. I wonder why.

@agronholm
Copy link
Owner Author

Original comment by Roel De Coninck (Bitbucket: saroele, GitHub: saroele):


I was a bit surprised at how old my setuptools was: 5.5.1 (and after upgrading 14.3.1).
No idea how these requirements are handled, can't help you with that.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


So you're saying you had a problem with triggers not being recognized? Your setuptools should be new enough for that to work.

@nstanoszek
Copy link

Hi, I am seeing this issue with py2exe suddenly on the latest versions. I have updated setuptools and everything, but have no luck. When not frozen, APScheduler works wonderfully!

Thoughts?

@njanmo
Copy link

njanmo commented Oct 9, 2017

Hi, I am also experiencing this problem, my traceback is as follows, when i install via pip no errors are prevalent.

However when installing via easy install I get this error:

  File "build\bdist.win-amd64\egg\apscheduler\executors\base_py3.py", line 12
    async def run_coroutine_job(job, jobstore_alias, run_times, logger_name):
            ^
SyntaxError: invalid syntax

creating c:\users\delphi\anaconda2\lib\site-packages\apscheduler-3.3.1-py2.7.egg
Extracting apscheduler-3.3.1-py2.7.egg to c:\users\delphi\anaconda2\lib\site-packages
  File "c:\users\delphi\anaconda2\lib\site-packages\apscheduler-3.3.1-py2.7.egg\apscheduler\executors\base_py3.py", line 12
    async def run_coroutine_job(job, jobstore_alias, run_times, logger_name):
            ^
SyntaxError: invalid syntax

Adding apscheduler 3.3.1 to easy-install.pth file

Installed c:\users\delphi\anaconda2\lib\site-packages\apscheduler-3.3.1-py2.7.egg
Processing dependencies for apscheduler
Finished processing dependencies for apscheduler

This is the error my traceback is producing from easy_install

  File "C:\Users\Delphi\Anaconda2\lib\site-packages\apscheduler\schedulers\base.py", line 888, in _create_plugin_instance

LookupError: No trigger by the name "interval" was found

The error my traceback is producing from the pip install

  File "C:\Users\Delphi\Anaconda2\lib\site-packages\apscheduler\schedulers\base.py", line 888, in _create_plugin_instance
    raise LookupError('No {0} by the name "{1}" was found'.format(type_, alias))

LookupError: No trigger by the name "interval" was found

Thanks in advance for help

@agronholm
Copy link
Owner Author

You're seeing those messages because easy_install tries to compile them to bytecode, which fails when a Python 2 interpreter encounters Python 3 syntax. It's harmless.

@ierturk
Copy link

ierturk commented Dec 27, 2018

Hi, I experienced the problem and fixed as explained at this link

@DanieleB89
Copy link

Problem is still here

@agronholm
Copy link
Owner Author

@DanieleB89 Are you using PyInstaller or what else is causing your problem?

@DanieleB89
Copy link

my actions:
pip install apscheduler

got this:
Successfully installed apscheduler-3.6.3 pytz-2020.1 setuptools-47.3.1 six-1.15.0 tzlocal-2.1

in a random .py file:
"
from apscheduler.schedulers.background import BackgroundScheduler

def job1():
print("Job 1 fired")

scheduler = BackgroundScheduler()
scheduler.add_job(job1, 'interval', seconds=2, id="job1")
scheduler.start()
"

after esecution got this error:
Got this:
File "...\lib\site-packages\apscheduler\schedulers\base.py", line 420, in add_job
'trigger': self._create_trigger(trigger, trigger_args),
File "...\lib\site-packages\apscheduler\schedulers\base.py", line 921, in _create_trigger
return self._create_plugin_instance('trigger', trigger, trigger_args)
File "...\lib\site-packages\apscheduler\schedulers\base.py", line 904, in create_plugin_instance
raise LookupError('No {0} by the name "{1}" was found'.format(type
, alias))
LookupError: No trigger by the name "interval" was found

@agronholm
Copy link
Owner Author

That is strange. But if this was a general problem with pip installs, a lot more people would come here to complain about it.
Are you running this on Windows?

@DanieleB89
Copy link

Yes, I made few changes to the code and I got it running. I've posted my code fix here: https://stackoverflow.com/questions/28682723/no-trigger-by-the-name-interval-was-found/

@agronholm
Copy link
Owner Author

This still doesn't explain why the trigger lookup failed, even though you have recent versions of all the involved tools.

@DanieleB89
Copy link

I'm new to apscheduler, maybe it's something I did wrong. I found this library interesting: no problem for me if it's just an alias not working (at least for me).

@agronholm
Copy link
Owner Author

Yes, I understand. But I don't see anything wrong with your code.

@n2201
Copy link

n2201 commented Sep 11, 2020

Have you restarted the kernel after the restart? That could be your problem

@agronholm
Copy link
Owner Author

Have you restarted the kernel after the restart? That could be your problem

Uh, what?

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

No branches or pull requests

6 participants