Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Numba nopython error
#1
Good day,

Can someone help me please, I recently installed an ssd and reinstalled windows and python.

Before I got a new ssd for my laptop the script ran fine on my HDD but now after installing the modules I get this error. What am I missing.

import JarvisAI
import re
import pprint
import random
import sys
import subprocess
import pyautogui
import os
import requests
from win10toast import ToastNotifier
from numba import jit

toaster = ToastNotifier()


url = "http://www.google.com"
timeout = 5
try:
    request = requests.get(url, timeout=timeout)
    print("Connected to the Internet")
    toaster.show_toast("Jarvis Voice Assistant", "Systems Online", threaded=True, icon_path=None, duration=5)

except (requests.ConnectionError, requests.Timeout) as exception:
    print("No internet connection.")
    toaster.show_toast("Jarvis Voice Assistant", "Systems Offline, Systems Shutting Down", threaded=True, icon_path=None, duration=5)
    sys.exit()


obj = JarvisAI.JarvisAssistant()

@jit(nopython=True)
def t2s(text):
    obj.text2speech(text)
    
t2s("Systems Online")




while True:
    status, command = obj.hot_word_detect()
    if status:
        while True:
            res = obj.mic_input()
            print(res)


            if re.search('tell me jokes|joke|tell me a joke|tell me another joke', res):
                joke_ = obj.tell_me_joke('en', 'neutral')
                print(joke_)
                break

            if re.search('close window', res):
                t2s("closing window")
                pyautogui.hotkey('ctrl','w')
                break

            if re.search('you are stupid|stupid', res):
                print("no, im an not, you are")
                t2s("no, im am not, you are")

            # if re.search('do I need to put you on charge',res):
            #     percent = str(battery.percent)
            #     print("percent")
            #     if percent <=20:
            #         print("yes please")
            #         t2s("yes please")
            #     elif percent >20:
            #         print("no not yet, check again later")
            #         t2s("no not yet, check again later")

            if re.search('turn volume up',res):
                t2s("turning volume up")
                pyautogui.hotkey('volumeup')
                break

            if re.search('turn volume down',res):
                t2s("turning volume down")
                pyautogui.hotkey('volumedown')
                break

            if re.search('setup|set up', res):
                setup = obj.setup()
                print(setup)
                break

            if re.search('google photos', res):
                photos = obj.show_google_photos()
                print(photos)
                break

            if re.search('local photos', res):
                photos = obj.show_me_my_images()
                print(photos)
                break

            if re.search('take a screenshot', res):
                print("taking a screenshot")
                t2s("taking a screenshot")
                pyautogui.screenshot()
                break

            if re.search('restart', res):
                os.system('shutdown /r /t 1')
                print("restarting")
                t2s("Restarting will begin now")


            if re.search('shutdown|shut down',res):
                os.system('shutdown /s')
                print("shutting down")
                t2s("shutting down now, goodbye")

            if re.search('weather|temperature', res):
                city = res.split(' ')[-1]
                weather_res = obj.weather(city=city)
                print(weather_res)
                t2s(weather_res)
                break

            if re.search('news', res):
                news_res = obj.news()
                pprint.pprint(news_res)
                t2s(f"I have found {len(news_res)} news. You can read it. Let me tell you first 2 of them")
                t2s(news_res[0])
                t2s(news_res[1])
                break

            if re.search('tell me about', res):
                topic = res[14:]
                wiki_res = obj.tell_me(topic, sentences=1)
                print(wiki_res)
                t2s(wiki_res)
                break

            if re.search('what is the date', res):
                date = obj.tell_me_date()
                print(date)
                print(t2s(date))
                break

            if re.search('what is the time', res):
                time = obj.tell_me_time()
                print(time)
                t2s(time)
                break



            if re.search('open', res):
                domain = res.split(' ')[-1]
                open_result = obj.website_opener(domain)
                print(open_result)
                break

            if re.search('launch', res):
                dict_app = {}

                app = res.split(' ', 1)[1]
                path = dict_app.get(app)
                if path is None:
                    t2s('Application path not found')
                    print('Application path not found')
                else:
                    t2s('Launching: ' + app)
                    obj.launch_any_app(path_of_app=path)
                break

            if re.search ("what is the percentage of my laptop", res):
                break

            if re.search('hello|hi', res):
                print('Hi')
                t2s('Hi')
                break

            if re.search('how are you', res):
                li = ['good', 'fine', 'great']
                response = random.choice(li)
                print(f"I am {response}")
                t2s(f"I am {response}")
                break



            if re.search('your name|who are you', res):
                print("My name is Jarvis, I am your personal assistant")
                t2s("My name is Jarvis, I am your personal assistant")
                break

            if re.search('quit|bye|goodbye jarvis|goodbye', res):
                print("goodbye")
                t2s("goodbye")
                sys.exit()

            if re.search('who made you', res):
                print("DoominsinI Software")
                t2s("DoominsinI Software")

            if re.search('who is your boyfriend|do you have a boyfriend', res):
                print("my boyfriend is wifi")
                t2s("my boyfriend is wifi")

            if re.search('what can you do', res):
                li_commands = {
                    "open websites": "Example: 'open youtube.com",
                    "time": "Example: 'what time it is?'",
                    "date": "Example: 'what date it is?'",
                    "launch applications": "Example: 'launch chrome'",
                    "tell me": "Example: 'tell me about India'",
                    "weather": "Example: 'what weather/temperature in Mumbai?'",
                    "news": "Example: 'news for today' ",
                }
                ans = """I can do lots of things, for example you can ask me time, date, weather in your city,
                I can open websites for you, launch application and more. See the list of commands-"""
                print(ans)
                pprint.pprint(li_commands)
                t2s(ans)
                break
    else:
        continue
Output:
Connected to the Internet Traceback (most recent call last): File "E:\USB\DoominsinI Software\Jarvis-Assisant-master\Jarvis-Assisant-master\scripts\main.py", line 35, in <module> t2s("Systems Online") File "C:\Users\tyrel\AppData\Roaming\Python\Python36\site-packages\numba\core\dispatcher.py", line 420, in _compile_for_args error_rewrite(e, 'typing') File "C:\Users\tyrel\AppData\Roaming\Python\Python36\site-packages\numba\core\dispatcher.py", line 361, in error_rewrite raise e.with_traceback(None) numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Untyped global name 'obj': Cannot determine Numba type of <class 'JarvisAI.JarvisAssistant'>  File "main.py", line 33: def t2s(text):  obj.text2speech(text)  ^ 
Larz60+ write Jun-19-2021, 11:20 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

You should paste the code from image into post with bbcode tags.
Reply
#2
Issue
Try with out decorator and see if work.

Or you also have to also use decorated(@jit(nopython=True)) on the class JarvisAI.JarvisAssistant
Compiling Python classes with @jitclass
Quote:All methods of a jitclass are compiled into nopython functions.
Reply
#3
(Jun-19-2021, 09:33 PM)snippsat Wrote: Issue
Try with out decorator and see if work.

Or you also have to also use decorated(@jit(nopython=True)) on the class JarvisAI.JarvisAssistant
Compiling Python classes with @jitclass
Quote:All methods of a jitclass are compiled into nopython functions.

When I remove it it just keeps looping printing none
so where must I move it to exactly.
Reply
#4
(Jun-19-2021, 09:33 PM)snippsat Wrote: Issue
Try with out decorator and see if work.

Or you also have to also use decorated(@jit(nopython=True)) on the class JarvisAI.JarvisAssistant
Compiling Python classes with @jitclass
Quote:All methods of a jitclass are compiled into nopython functions.

This is the output I get when I remove it
It loops False None and when I press Ctrl+C I get this


Output:
False None False None False None False None False None False None False None False None False Traceback (most recent call last): File "E:\USB\DoominsinI Software\Jarvis-Assisant-master\Jarvis-Assisant-master\scripts\main.py", line 43, in <module> status, command = obj.hot_word_detect() File "C:\Users\tyrel\AppData\Roaming\Python\Python36\site-packages\JarvisAI\__init__.py", line 85, in hot_word_detect print(status, command) KeyboardInterrupt
Reply
#5
I can do i test and also show how to use virtual environment with Python 3.9.
Virtual environment can aslo help if this has work at one time and you freeze it
Then don't haver figure what changed in one of the many libraries in this case 100.
pip freeze -l > requirements.txt

# Install on new system 
pip install -r requirements.txt
In general so is Virtual environment very import using libraries as this,or it can be full crash what already installed.
This JarvisAI is a monster🐳 as it install 100 libraries(nearly 3GB).
So this is the code i want to test,
see that i have comment out Numba decorator as it should no impacts(other than make it faster)at all on this code.
# speech_test.py
import JarvisAI

obj = JarvisAI.JarvisAssistant()

#@jit(nopython=True)
def t2s(text):
    obj.text2speech(text)

t2s("Systems Online")
# Make environment 
G:\div_code
λ python -m venv jar_env

# Cd in
G:\div_code
λ cd jar_env\

# Activate
G:\div_code\jar_env
λ G:\div_code\jar_env\Scripts\activate

# Install 
(jar_env) G:\div_code\jar_env
λ pip install JarvisAI
Collecting JarvisAI ..... long long downloads.
Test
(jar_env) G:\div_code\jar_env
λ python speech_test.py
2021-06-20 00:15:19.554395: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-06-20 00:15:19.555340: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

Set 'obj = JarvisAI.JarvisAssistant(sync=False, token='xyz')' if you do not want to use API
Obtain your token from: http://jarvis-ai-api.herokuapp.com/
Its free to use. Even API services is also free.
Well, JarvisAI need support of your to keep this project and it's API alive.
So, your contribution/donation will be appreciated.

DONATE: https://www.buymeacoffee.com/dipeshpal
...ect
So after a while it work a woman 👩‍🦰 say Systems Online🔊
Reply
#6
(Jun-19-2021, 10:51 PM)snippsat Wrote: I can do i test and also show how to use virtual environment with Python 3.9.
Virtual environment can aslo help if this has work at one time and you freeze it
Then don't haver figure what changed in one of the many libraries in this case 100.
pip freeze -l > requirements.txt

# Install on new system 
pip install -r requirements.txt
In general so is Virtual environment very import using libraries as this,or it can be full crash what already installed.
This JarvisAI is a monster🐳 as it install 100 libraries(nearly 3GB).
So this is the code i want to test,
see that i have comment out Numba decorator as it should no impacts(other than make it faster)at all on this code.
# speech_test.py
import JarvisAI

obj = JarvisAI.JarvisAssistant()

#@jit(nopython=True)
def t2s(text):
    obj.text2speech(text)

t2s("Systems Online")
# Make environment 
G:\div_code
λ python -m venv jar_env

# Cd in
G:\div_code
λ cd jar_env\

# Activate
G:\div_code\jar_env
λ G:\div_code\jar_env\Scripts\activate

# Install 
(jar_env) G:\div_code\jar_env
λ pip install JarvisAI
Collecting JarvisAI ..... long long downloads.
Test
(jar_env) G:\div_code\jar_env
λ python speech_test.py
2021-06-20 00:15:19.554395: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-06-20 00:15:19.555340: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

Set 'obj = JarvisAI.JarvisAssistant(sync=False, token='xyz')' if you do not want to use API
Obtain your token from: http://jarvis-ai-api.herokuapp.com/
Its free to use. Even API services is also free.
Well, JarvisAI need support of your to keep this project and it's API alive.
So, your contribution/donation will be appreciated.

DONATE: https://www.buymeacoffee.com/dipeshpal
...ect
So after a while it work a woman 👩‍🦰 say Systems Online🔊


Thank you so much it worked Big Grin Big Grin Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  error in import numba Sara 1 6,682 Oct-22-2017, 08:07 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020