error importing request in jupyter notebook - jupyter-notebook

Used the following import on Jupyter for API:
import requests
But got the following error:
ImportError: No module named requests
Is there a way around this?

Related

Using Pycharm I can't able to generate UMLDiagram due to an error down below

parsing C:\Users\USER\Documents_init_.py...
Failed to import module init with error:
No module named init.

Apache Airflow SqlSensor

I trying to make SqlSensor to work with Oracle database, I've installed all the required provider and successfully tested the connection. When I run SqlSensor I got this error message
ERROR - Failed to execute job 32 for task check_exec_date (The connection type is not supported by SqlSensor. The associated hook should be a subclass of `DbApiHook`. Got OracleHook; 419)
I'm running Apache Airflow version 2.3.3 and installed Oracle provider apache-airflow-providers-oracle version 3.2.0
TL;DR:
You are probably importing the sensor as:
from airflow.sensors import SqlSensor
Which cause the issue.
If you will import as
from airflow.providers.common.sql.sensors import SqlSensors
It will work.
Full Details:
There is a bug in apache-airflow-providers-common-sql==1.0.0 which causes
from airflow.sensors import SqlSensor not to work properly.
The bug is fixed in https://github.com/apache/airflow/pull/25293
thus upgrading to apache-airflow-providers-common-sql>1.0.0 will allow also the old import style.
Regardless of the bug, you should use
from airflow.providers.common.sql.sensors import SqlSensors
as from airflow.sensors import SqlSensor is deprecated.

MS SQL Hook and Operators not importing into Airflow

Trying to import the mssql hook and operator into my dag but I keep getting this error from Airflow.
I'm currently importing with the newest syntax:
from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook
from airflow.providers.microsoft.mssql.operators.mssql import MsSqlOperator
and I'm getting this import error:
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/airflow/dags/hevo_dag.py", line 5, in <module>
from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook
ModuleNotFoundError: No module named 'airflow.providers.microsoft.mssql'
To import the operator you need to do:
For Airflow>=2.0:
you need to use Mssql provider package:
pip install apache-airflow-providers-microsoft-mssql
For Airflow<2.0:
you need to use Mssql backport provider package:
pip install apache-airflow-backport-providers-microsoft-mssql
In your code it's the same import path (regardless of the package). Airflow backported the provider to ease migration from Airflow 1 to Airflow 2 so upon upgrading you will not need to change the import paths.

Form recogniser - Setup Issues

For the Form recognizer sample code provided in the below link, the Python interpreter cannot recognize Azure core API’s.
link
python —version
-Python 3.9.1
pip3 —version
- ip 21.0 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)
I receive the following error:
Exception has occurred: ModuleNotFoundError
No module named 'azure'
File "/Users/visiothoughts/Documents/Visiothoughts/Work-Project/AI-Moto/com/ai/Bill-Recogniser/RecogniseFormContent.py", line 5, in <module>
from azure.core.exceptions import ResourceNotFoundError
Can I get some guidance on what is missing?
Looks like the module for Azure-Core has not been installed.
Run
pip install azure-core
Since the error you re receiving is below :
from azure.core.exceptions import ResourceNotFoundError

Sikuli keeps getting an error

Sorry im a total noob with this. So ive tried integrating Sikuli in my Working RF setup meaning, I have to move from Python to Jython for this to work. my problem now is that im always getting an error.
Error in file 'C:\robot\suites\Test\Test.robot':
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Traceback (most recent call last):
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
from keywords import *
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\__init__.py", line 1, in <module>
from _logging import _LoggingKeywords
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\_logging.py", line 4, in <module>
from keywordgroup import KeywordGroup
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
PYTHONPATH:
C:\jython2.7.0\bin\jythonsikuli.bat
C:\jython2.7.0\Lib
__classpath__
__pyclasspath__/
C:\jython2.7.0\Lib\site-packages
CLASSPATH:
C:\jython2.7.0\jython.jar
C:\Sikuli\sikulix.jar
20180308 11:23:08.246 ERROR Error in file 'C:\robot\suites\Test\Test.robot':
Getting keyword names from library 'Remote' failed: Calling dynamic method
'get_keyword_names' failed: Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
In your error message there are two issues clearly defined:
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Which can be solved by installing the relevant Python Module from PIP:
pip install decorator
The second issue is towards the end:
Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
This means that Robot Framework is unable to make a connection on port 8720. This is often due to:
Firewalls preventing an opened port to be accessible. In Windows add a FireWall rule allowing for port 8270 to be accessible from the outside.
Try and connect using http://127.0.0.1:8270. Although often a synonym for localhost at a technical level it is not the same.

Resources