I want to integrate Slack alert messages when a task fail in Airflow with SlackWebHookOperator. I have issue with the import of the operator.
In this tutorial (https://medium.com/datareply/integrating-slack-alerts-in-airflow-c9dcd155105) the author mentions there are 2 ways to achieve this. The first implementation is using slack legacy tokens which can be deprecated anytime and the second is using slack webhook which is the implementation I want. The author mentions to install slack dependencies, quoted by the author "Remember to install slack dependencies pip install apache-airflow[slack]" but this doesn't install SlackWebHookOperator as the import throws a “Cannot find reference slack_webhook_operator in init.py” error. Is there any other installation I am missing?
from airflow.contrib.operators.slack_webhook_operator import SlackWebHookOperator
I expect the SlackWebHookOperator to be able to be referenced.
I have tried installing slackclient dependency but it didn't installed SlackWebHookOperator as I cannot reference it.
SlackWebHookOperator is not available
For Airflow 2.x
airflow.contrib.operators.slack_webhook_operator has been deprecated.
You'd first have to install apache-airflow-providers-slack:
pip install apache-airflow-providers-slack
and finally import SlackWebhookOperator:
from airflow.providers.slack.operators.slack_webhook import SlackWebhookOperator
from airflow.providers.slack.operators.slack_webhook import SlackWebhookOperator
Related
Hoping someone has some experience with the Alpaca API. I have installed using pip install alpaca-trade-api, and also pip3 install alpaca-trade-api.
What I do not understand is that I can install alpaca trade API, but not the specific module.
import alpaca_trade_api as tradeapi
This bit runs. But the below doesn't
from alpaca_trade_api import StreamConn
As it returns
cannot import name 'StreamConn' from 'alpaca_trade_api'
Thanks in advance! :)
I am spiking Flask based login and signup webapp.
I downloaded flask-login-example.
When I run the two example files(flask-login-example.py, flasklogin.py), I got error messages.
For importing flask.ext.login:
https://github.com/shekhargulati/flask-login-example/blob/master/flasklogin.py
For importing flask.login:
ModuleNotFoundError: No module named 'flask.login'
I installed flask-login package using the pip3 command, I got the same error messages for each example. What's wrong with my code? Which Python package should I install?
The link you've provided as example is a outdated reference source.
Looking on issues (this) in the same repository it's possible notice that package imports do not reflect the current package version anymore.
In new version of flask, use
from flask_login import LoginManager
and you'll found lots of package and imported this way in new version.
I installed Ibpy2 to connect to my interactive broker account.
https://github.com/blampe/IbPy
I installed IbPy2 successfully (by installing pip install IbPy2 AND python setup.py install).
However, when I open Spyder in Anaconda and run from IBWrapper import IBWrapper, contract. It says:
No module named 'IBWrapper'.
Please advise how I may fix it. Many, many thanks!
IbPy is outdated, it's a 3rd party module that's no longer supported as there is an official Python module available.
If you wish to use a IbPy like interface to interact with the official API, use IbPythonic. It's almost identical to IbPy with minor adjustments, for example IbPy has 'm_' prefixes in functions.
Please refer to https://github.com/anthonyng2/ib It is third party python file that you may directly code
from IBWrapper import IBWrapper, contract
You need to download the IBWrapper.py file and copy it into your python library path.
I'm new in Ethereum, so probably that's a silly question.
Now I'm trying to install serpent and pyethereum according to this tutorial. Everything works well, but when I'm launching Python's code:
import serpent
import pyethereum
There is an error: No module named pyethereum
How can I solve it?
The module's name is ethereum, not pyethereum. Using the following:
import serpent
import ethereum
should work just fine.
Follow the installation instructions from Pytherium's Readme, which read:
git clone https://github.com/ethereum/pyethereum/
cd pyethereum
python setup.py install
In the tutorial's instructions, develop branch is used, which seems to be failing according to the continuous integration badges.
I believe this has something to do with having multiple versions of python but after fiddling for many hours I am just plain lost. I am on OSX Yosemite. I have tried installing and reinstalling the twilio libraries multiple times.
The script won't run past line 1 without throwing this error.
ImportError: No module named twilio
from twilio import twiml
from twilio.rest import TwilioRestClient
Basic info for Twilio and python
twilio==4.5.0
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python
Thanks to anyone that can help.
I had this same problem, and found the solution here: Import error in twilio
It could be that you simply already have a file named twilio.py that is being imported instead of the library, twilio-python. Remove your twilio.py and twilio.pyc and hopefully it will solve your problem.
Since you're using Python 2.7 try installing twilio with pip2 (the python 2.7 pip version)
sudo pip2 install twilio
And remember to always keep you main pip version the same as your python version
i had the same problem, the problem was emanating from naming conflict. Had named my project file "twilio.py" thus
from twilio.rest import Client
gave an error