import ClickHouseHook in airflow 1.10.12 - python

I try to import class ClickHouseHook from airflow.hooks.clickhouse_hook
from airflow.hooks.clickhouse_hook import ClickHouseHook
This is no problem. No import errors here.
But when I try:
import airflow.hooks.clickhouse_hook
I have an error:
ModuleNotFoundError: No module named 'airflow.hooks.clickhouse_hook'
And I can't understand how it works? I have no module named clickhouse_hook in directory airflow.hooks, but how can I import class ClickHouseHook without error in this way?

There is no ClickHouse provider in Airflow.
I assume you are using clickhouse plugin
thus the clickhouse_hook file is not in airflow/hooks folder because it is not part of Airflow.

Related

Having trouble importing RLGlue: "No module named 'rlglue.rl_glue'"

I was going through an Reinforcement Learning Course and wanted to try running the code locally. I installed RLGlue with pip install rlglue from here
But then when trying to run the code:
from rlglue.rl_glue import RLGlue
import main_agent
import ten_arm_env
import test_env
Received this error message:
ModuleNotFoundError: No module named 'rlglue.rl_glue'
Any idea on how to fix that to import the module?
I use this as work-around, add this file to your project.
https://gist.github.com/niektuytel/eab1117070454042b11e5e5c026dd3fb

How to import Airflow's PostgresOperator

I'm trying to import the PostgresOperator from the airflow package:
from airflow.providers.postgres.operators.postgres import PostgresOperator
But I'm getting the following error: Cannot find reference 'postgres' in imported module airflow.providers.
The solution was to run the following in the terminal, using the project's virtualenv: pip install 'apache-airflow[postgres]'.
Please notice that it won't work if you don't wrap the name of the package between single-quotes.
Use:
from airflow.operators.postgres_operator import PostgresOperator

Getting import error saying there is no module

I want to import a color module but I am getting the error:
ImportError: No module named 'scripts.UltraColor'
Import code:
from scripts.UltraColor import *
The import code is in pygameTest.py
The problem here, as far as I can see on that screenshot is UltraColor file doesn't have the .py extension, for import to work properly you'll need to rename it from UltraColor to UltraColor.py, otherwise will raise an ImportError exception.
For more information, take a look to this one. Import a python module without the .py extension

ImportError: No module named X, even if folder is in the same directory

I've downloaded pymumble from https://github.com/Robert904/pymumble and saved it to my working directory. I import it with:
from pymumble import pymumble
However, I receive:
ImportError: No module named pymumble
I'm looking at similar code that does this successfully. What am I doing wrong when trying to import this?
As I can see there is no file called pymumble in given repository, if you are looking for this there is a file called mumble.py, try importing
from mumble import mumble
this will work.

AWS Lambda with Zappa fails on "Unable to import module 'handler': No module named builtins"

I've deployed my application to AWS Lambda with Zappa. The deployment went fine without any issues. But when I try to reach the app via AWS API Gateway I get a 500 response.
The logs says
Unable to import module 'handler': No module named builtins
The environment runs on Python 2.7. I've added future to the Pipfile but it still won't work.
When I check the code in Lambda I can see the following code
from __future__ import unicode_literals
import base64
import boto3
import collections
import datetime
import importlib
import inspect
import json
import logging
import os
import sys
import traceback
import zipfile
from builtins import str
I can't find what can be wrong. Does anyone have a clue?
I solved the problem. I'm using pipenv to install my packages, but for some reason the packages wasn't installed inside the virtual environment, which made Zappa to not include them to AWS Lambda. I had to install them manually in PyCharm by going through Settings > Project > Project Interpreter and add the packages there. Thanks for your help.

Categories

Resources