Im running python and visual studio code on Mac when I try to import these packages:
import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import pyjokes
import pywhatkit
import pyowm
It give me this:
Unable to import 'speech_recognition'
Unable to import 'wikipedia'
Unable to import 'pyjokes'
Unable to import 'pywhatkit'
Unable to import 'pyowm'
It says the same thing for all the packages, How do I fix This?
Related
I'm unable to import packages into anaconda Jupyter notebook.
import numpy
ImportError: cannot import name 'set_array_function_like_doc' from 'numpy.core.overrides' (C:\Users\4523220\AppData\Roaming\Python\Python38\site-packages\numpy\core\overrides.py)
import pandas as pd
ImportError: cannot import name 'set_array_function_like_doc' from 'numpy.core.overrides' (C:\Users\4523220\AppData\Roaming\Python\Python38\site-packages\numpy\core\overrides.py)
This is happening after restarting Anaconda.
I have a python code which i'm converting into exe
The code is working fine in development when i'm running code in terminal
This error is coming when i'm opening the exe
My script modules
from tkinter import *
import tkinter as tk
from PIL import ImageTk, Image
from tkinter import messagebox
import pymysql
import time
import pyautogui
import datetime
from datetime import datetime as dt
from datetime import datetime as dt1
import win32gui
import psutil
import os
import requests
import win32process
import operator
import random, string
import threading
import sys
import os.path
from ctypes import Structure, windll, c_uint, sizeof, byref
from tkinter import messagebox
from pynput.keyboard import Key, Listener
import logging
Possible error is comng from here i think - from pynput.keyboard import Key, Listener
Try build exe this way:
install pyinstaller: pip install pyinstaller
Open cdm -> navigate to folder -> enter following command:
pyinstaller.exe --onefile --icon=myicon.ico --windowed app.py
--onefile : create only .exe in one file not in folder with many files
--icon: if you have icon you want to use for .exe file
--windowed: to open windowed mode.
I do not program on Python, so I don't know what the problem is.
I just can't start the program from the command line, this is displayed:
Here is code __init__.py
import os
import sys
from PyQt4 import QtGui, QtCore
from pynfb.experiment import Experiment
from pynfb.io.xml_ import xml_file_to_params
from pynfb.settings_widget.general import GeneralSettingsWidget
from pynfb.settings_widget.inlet import InletSettingsWidget
from pynfb.settings_widget.protocol_sequence import ProtocolSequenceSettingsWidget
from pynfb.settings_widget.protocols import ProtocolsSettingsWidget, FileSelectorLine
from pynfb.settings_widget.signals import SignalsSettingsWidget
from pynfb.settings_widget.composite_signals import CompositeSignalsSettingsWidget
from pynfb.settings_widget.protocols_group import ProtocolGroupsSettingsWidget
static_path = os.path.realpath(os.path.dirname(os.path.realpath(__file__)) + '/static')
class SettingsWidget(QtGui.QWidget):
You need to install PyQt4 first: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4.
Download the correct file corresponding to the version of your python, e.g. PyQt4‑4.11.4‑cp37‑cp37m‑win_amd64.whl then install by using pip (https://pip.pypa.io/en/stable/installing/)
pip install PyQt4-4.11.4-cp37-none-win_amd64.whl
I'm a relatively inexperienced programmer and I ran these import statements last week on my computer without a problem but now this week when I run the following statements in particular the wkhtmltopdf import I run into an error.
import pyodbc
import pymysql
import numpy as np
import pandas as pd
import datetime
import jinja2
import wkhtmltopdf
from wkhtmltopdf.main import WKhtmlToPdf
import datetime
import calendar
from pathlib import Path
This leads to this error
enter image description here
Any help is appreciated
I am trying to run the chatbot on windows 10. Python version I am using is Python 3.6.6. I installed rasa-core using pip3 install rasa_core and the installation was completed.
But every time I run my code, I get ImportError: No module named rasa_core.policies.keras_policy.
here are the import libraries:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import warnings
import csv
import pandas as pd
import unicodedata
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core import utils
from rasa_core.actions import Action
from rasa_core.actions.forms import FormAction
from rasa_core.agent import Agent
from rasa_core.channels.console import ConsoleInputChannel
from rasa_core.events import SlotSet
from rasa_core.events import AllSlotsReset
from rasa_core.featurizers import (
MaxHistoryTrackerFeaturizer,
BinarySingleStateFeaturizer)
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_nlu.model import Metadata, Interpreter
How can I get rid of Import Errors related to rasa-core?
What version of rasa-core are you using?
For e.g. on my mac Below are versions.
pip freeze |grep -i rasa
rasa-core==0.8.2
rasa-core-sdk==0.11.4
rasa-nlu==0.11.4
for rasa-core==0.8.2 class KerasPolicy is in
python3.6/site-packages/rasa_core/policies/keras_policy.py.
Hence you would import it using,
from rasa_core.policies.keras_policy import KerasPolicy
However, if you are using latest version rasa-core. for e.g.
pip freeze |grep -i rasa
rasa-core==0.12.0a3
rasa-core-sdk==0.11.4
rasa-nlu==0.13.3
Then class KerasPolicy is in
/python3.6/site-packages/rasa_core/policies/keras_policy.py .
Hence you would import it using
from rasa_core.policies.keras_policy import KerasPolicy
It appears that you are using an older version of rasa-core and trying newer versions based example.
You need to upgrade both rasa-core and rasa-nlu.
Here's link to latest requirement.txt that you can download.
After that simply run following to get dependencies installed along-with rasa-core and rasa-nlu.
pip install -r requirement.txt