question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: 'NoneType' object is not callable

See original GitHub issue

🐛 Bug

(compiler_gym) zeyi@server121:~/scripts$ python main.py 
Exception in thread Thread-1:
Traceback (most recent call last):
  File ".../lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File ".../lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File ".../lib/python3.8/site-packages/aim/ext/resource/tracker.py", line 102, in _stat_collector
    self._track(stat)
  File ".../lib/python3.8/site-packages/aim/ext/resource/tracker.py", line 78, in _track
    self._track_func()(
TypeError: 'NoneType' object is not callable

To reproduce

Minimum example:

from aim import Run


def main():
    run = Run()
    for i in range(1000):
        run.track(i, name="loss")


if __name__ == "__main__":
    main()

This problem happens occasionally. In my case it happens one out of four times. However, if I change the script slightly, the problem above never appears.

from aim import Run

run = Run()

def main():
    for i in range(1000):
        run.track(i, name="loss")


if __name__ == "__main__":
    main()

Notice that I moved the variable run into global scope. I think the problem is due to some objects are de-referenced too quickly (e.g., the thread used to track? I’m not sure).

Expected behavior

The script should run without problem.

Environment

aim==3.4.1
aimrecords==0.0.7
aimrocks==0.0.10

Python 3.8.12

Linux server121 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
udusecommented, Feb 14, 2022

@alberttorosyan Yeah I can’t reproduce this problem with the new version of aim 👍 nice fix

0reactions
udusecommented, Mar 15, 2022

No I don’t call those functions explicitly. Could it be a concurrency problem? I’m having multiple async functions and each one of them has their own aim.Run object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python NoneType object is not callable (beginner)
I faced the error "TypeError: 'NoneType' object is not callable " but for a different issue. With the above clues, i was able...
Read more >
Python TypeError: 'nonetype' object is not callable Solution | CK
“TypeError: 'nonetype' object is not callable” occurs when you try to call a None value as if it were a function. ... To...
Read more >
Can't figure out what the problem is - Codecademy
It is giving me a 'NoneType' object is not callable error and I can't seem to figure out why that is. It was...
Read more >
TypeError: 'NoneType' object is not callable - TensorFlow Forum
Any idea why the following issue occured? This happen when I try to recompile the model using callback. It should work, right?
Read more >
Typeerror: 'nonetype' object is not callable - CodeProject
The new error message is telling you that y_train does not contain any items.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found