Failed to import module __PyInstaller_hooks_0_scipy - pyinstaller

when I pip -F install demo_full.py
it happened
PyInstaller.exceptions.ImportErrorWhenRunningHook: Failed to import module __PyInstaller_hooks_0_scipy required by
hook for module F:\ProgramData\Anaconda3\envs\opencv-1\lib\site-packages\PyInstaller\hooks\hook-scipy.py. Please ch
eck whether module __PyInstaller_hooks_0_scipy actually exists and whether the hook is compatible with your version
of F:\ProgramData\Anaconda3\envs\opencv-1\lib\site-packages\PyInstaller\hooks\hook-scipy.py: You might want to rea
d more about hooks in the manual and provide a pull-request to improve PyInstaller.

Related

MWAA Apache Airflow DAG error importing EcsOperator

I am trying to deploy an Airfow DAG to MWAA.
My requirements.txt:
apache-airflow[amazon] == 3.2.0
I import EcsOperator like this:
from airflow.contrib.operators.ecs_operator import EcsOperator
However, I get this error:
Broken DAG: [/usr/local/airflow/dags/mydag.py] Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/airflow/dags/mydag.py", line 4, in <module>
from airflow.contrib.operators.ecs_operator import EcsOperator
ImportError: cannot import name 'EcsOperator' from 'airflow.contrib.operators.ecs_operator' (/usr/local/lib/python3.7/site-packages/airflow/contrib/operators/ecs_operator.py)
What am I doing wrong here?
What am I doing wrong here?
You might be referencing a different version (1.10.12?) of the Airflow documentation.
airflow.contrib.operators.ecs_operator (1.10.12)
The documentation for 3.2.0 is here. You can import the EcsOperator like this:
from airflow.providers.amazon.aws.operators.ecs import EcsOperator
airflow.providers.amazon.aws.operators.ecs (3.2.0)
The correct requirements.txt:
(empty)
And the correct import:
from airflow.providers.amazon.aws.operators.ecs import ECSOperator
Note the casing!
There are several issues here so I'll compile a detailed answer since privious answers didn't cover all of them.
First, the updated import path (provider release 3.2.0) is:
from airflow.providers.amazon.aws.operators.ecs import EcsOperator
The reason this doesn't work for you is because you install the provider with extras as:
apache-airflow[amazon]
as explained in the provider extra docs when installing provider in that manner you get the provider version which was released at the time of the Airflow version that you are using. Thus you are not guaranteed to get the updated provider version. So in case you are using Airflow 2.2.4 (latest at the time of writing this answer) you will get Amazon provider version 3.0.0 which is not the most recent one.
To get updated provider you should install it as:
pip install apache-airflow-providers-amazon
if you like to pick a specific version then:
pip install apache-airflow-providers-amazon==3.2.0
Please note that you should always install from constraint files provided by Airflow. Example:
pip install "apache-airflow-providers-amazon" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-3.7.txt"
Note that the provider is referring to constraints-main which constantly updated and not to constraints-2.2.4 or any other specific Airflow version.
You can read more about it in the doc about Installation and upgrading of Airflow providers separately.

Apache Airflow 1.9 install on debian 8 from GitHub

I installed Apache airflow 1.9 from GitHub thanks to this command line on debian 9: pip install git+https://github.com/apache/incubator-airflow.git#v1-9-stable
However, I have an error during the airflow initdb caused by Fernet, do you know how to solve this issue?
INFO [alembic.runtime.migration] Running upgrade 947454bf1dff -> d2ae31099d61, Increase text size for MySQL (not relevant for other DBs' text types)
[2017-12-27 17:19:24,586] {models.py:643} ERROR - Failed to load fernet while encrypting value, using non-encrypted value.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 639, in set_extra
fernet = get_fernet()
File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 103, in get_fernet
raise AirflowException('Failed to import Fernet, it may not be installed')
AirflowException: Failed to import Fernet, it may not be installed
[2017-12-27 17:19:24,601] {models.py:643} ERROR - Failed to load fernet
And how can I specify extrapackage like in pip install apache-airflow[gcp-api] from my previous pip command install with GitHub?
How to install the latest 1.9.0RC too? I have an assertionError.
The answer marked as good have a broken link, if you have landed here as me and it continues broken, these steps have worked for me:
pip install cryptography
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
Add the generated key to the config file airflow.cfg, fernet_key = YOUR_GENERATED_KEY
During install from source you have to replace fernet_key in airflow.cfg such as you can find in the docs here.
In apache-airflow documentation, the script for generating fernet key is apparently wrong.
it says to use the following script.
from cryptography.fernet import Fernet
fernet_key= Fernet.generate_key()
print(fernet_key) # your fernet_key, keep it in secured place!
but it raises an exception at 'airflow initdb' command.
to solve this instead of Fernet.generate_key() use Fernet.generate_key().decode() as shown in #skozz answer.

How to install MongoDBLibrary for Robot Framework

I want to connect to Mongo DB using Robot Framework.
I have read in the following link that we have to pull the source code and install the library. Robot FrameWork - MongoDB-Library
I installed the Library and it is installed in the location
D:\Python27\Lib\site-packages\MongoDBLibrary
When I add 'MongoDBLibrary' library in the RIDE it showing in red (means library is not installed properly),
when i ran the same using eclipse + Maven project i got the following error
[ ERROR ] Error in file 'D:\Robot_WorkSpace\robotFrameWork\src\test\robotframework\acceptance\MongoQuery.txt': Importing test library 'D:\Python27\Lib\site-packages\MongoDBLibrary' failed: ImportError: No module named bson
Traceback (most recent call last):
File "D:\Python27\Lib\site-packages\MongoDBLibrary\__init__.py", line 2, in <module>
from mongoquery import MongoQuery
File "D:\Python27\Lib\site-packages\MongoDBLibrary\mongoquery.py", line 2, in <module>
from bson.objectid import ObjectId
PYTHONPATH:
C:\Users\akurasa\.m2\repository\org\robotframework\robotframework\3.0\Lib
C:\Users\akurasa\.m2\repository\org\robotframework\robotframework\3.0\robotframework-3.0.jar\Lib
__classpath__
__pyclasspath__/
CLASSPATH:
/D:/Sarada/eclipse/configuration/org.eclipse.osgi/bundles/789/1/.cp/jars/plexus-classworlds-2.4.jar
Please any one help me where i did wrong
Make sure you have installed PyMongo (or bson):
pip install pymongo
pip install bson (don't know if still required then)

Serf 1.3.8 install using scons is failing

I am using Redhat 6.6 and installed scons and using scons to install serf 1.3.8 but seeing the below error. Anyone has faced the below error. I am stuck and i need serf for http/https access for svn 1.9. Seeking advice for below error. I followed below URL. "http://www.linuxfromscratch.org" site for install procedure. I see error while executing cmd "/local//scons-2.4.1/script/scons check"
Has anyone know the solution or alternative to install serf to bypass this option and install serf without no issues
scons: Building targets ... test/test_buckets.c: In function
'test_deflate_4GBplus_buckets': test/test_buckets.c:1559: warning: integer
overflow in expression scons: *** [test/test_buckets.o] Error 1 scons: building
terminated because of errors.
Please advice.
[EDIT]
What env variables are required for scons to work properly. I see different error, i messed the environment. Seeing the below error. Any idea what I have missed. I have the custom install for python7. I have added the python install path to PATH,LD_LIBRARY_PATH. Error is below. Import failed. Unable to find SCons files in: /local/appln/pkgs/scons-2.4.1/bin/../engine /local/appln/pkgs/scons-2.4.1/bin/scons-local-2.4.1 /local/appln/pkgs/scons-2.4.1/bin/scons-local /usr/lib/scons-2.4.1 /usr/local/lib/scons-2.4.1 /local/apps/pkgs/scons-2.4.1/lib/python2.6/site-packages/scons-2.4.1 /usr/lib/python2.6/site-packages/scons-2.4.1 /usr/local/lib/python2.6/site-packages/scons-2.4.1 /usr/lib64/scons-2.4.1 /local/apps/pkgs/scons-2.4.1/lib/scons /usr/lib/scons /usr/local/lib/scons /local/appln/pkgs/scons-2.4.1/lib/python2.6/site-packages/scons /usr/lib/python2.6/site-packages/scons
/usr/local/lib/python2.6/site-packages/scons /usr/lib64/scons
Traceback (most recent call last): File "/local/appln/pkgs/scons-2.4.1/bin/scons", line 190, in import SCons.Script
ImportError: No module named SCons.Script
[Closed]

Swift authentication when try to connect via API

I am a team member of research group and my current research needs to use Openstack Swift.
We have installed Openstack Juno and it works perfectly. For installation Packstack have used used. The swift service is also installed on the server and it works! We have tried to access it from the console create container, upload a file etc. everything works.
So we went further and tried to access swift using its API. Here we faced a problem on the phase of authentication.
Below you can see the simple python code I am using to check if I can connect to Swift.
import swiftclient
import keystoneclient
conn = swiftclient.Connection(
authurl='http://*[server ip]*:5000/v2.0/',
user='account_name:username',
key='serverpassword',
auth_version="2.0").get_auth()[0]
for container in conn.get_account()[1]:
print container['name']
Before executing the cod on client computer, I have installed the following necessary packages.
sudo aptitude install python-pip
sudo pip install python-swiftclient
sudo pip install python-keystoneclient
Here you can see the error which occurs during execution of the code.
Traceback (most recent call last):
File "new.py", line 15, in <module>
auth_version="2.0").get_auth()[0]
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1332, in get_auth
timeout=self.timeout)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 463, in get_auth
auth_version=auth_version)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 366, in get_auth_keystone
ksclient, exceptions = _import_keystone_client(auth_version)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 351, in _import_keystone_client
variables to be set or overridden with -A, -U, or -K.''')
swiftclient.exceptions.ClientException:
Auth versions 2.0 and 3 require python-keystoneclient, install it or use Auth
version 1.0 which requires ST_AUTH, ST_USER, and ST_KEY environment
variables to be set or overridden with -A, -U, or -K.
I have tried to find the solution searching in the Internet but I have not succeed.

Resources