<@U04SE163WC8> I'm getting this error while tryin...
# ask-ai
h
@kapa.ai I'm getting this error while trying to build my connector:
Copy code
Γöé Γöé       Γöâ Traceback (most recent call last):
Γöé Γöé       Γöâ   File "/airbyte/integration_code/main.py", line 8, in <module>
Γöé Γöé       Γöâ     from destination_orange_hdfs import DestinationOrangeHdfs
Γöé Γöé       Γöâ   File "/airbyte/integration_code/destination_orange_hdfs/__init__.py", line 6, in <module>
Γöé Γöé       Γöâ     from .destination import DestinationOrangeHdfs
Γöé Γöé       Γöâ   File "/airbyte/integration_code/destination_orange_hdfs/destination.py", line 8, in <module>
Γöé Γöé       Γöâ     from airbyte_cdk import AirbyteLogger
Γöé Γöé       Γöâ ImportError: cannot import name 'AirbyteLogger' from 'airbyte_cdk' (/usr/local/lib/python3.9/site-packages/airbyte_cdk/__init__.py)
this is the command:
Copy code
airbyte-ci connectors --name destination-orange-hdfs build
k
It looks like you're encountering an
ImportError
when trying to import
AirbyteLogger
from the
airbyte_cdk
module. This issue might be related to the version of the
airbyte_cdk
you are using or how the environment is set up. Here are a few steps you can take to troubleshoot and resolve this issue: 1. Ensure
airbyte_cdk
is Installed
: Make sure that the
airbyte_cdk
package is installed in your environment. You can install it using pip:
Copy code
bash    pip install airbyte-cdk
2. Check the Version: Verify that you are using a compatible version of
airbyte_cdk
. Sometimes, certain functions or classes might not be available in older versions. 3. Use Local CDK for Testing: If you are making changes to the CDK and want to test them locally, you can use the
--local-cdk
flag with
airbyte-ci
to build the connector against the local CDK. This can help ensure that your changes are being picked up correctly.
Copy code
bash    airbyte-ci connector build --local-cdk
4. Review the Import Path: Double-check the import path in your
destination.py
file to ensure it is correct. The import statement should look like this:
Copy code
python    from airbyte_cdk import AirbyteLogger
5. Rebuild the Connector: After making sure that the
airbyte_cdk
is correctly installed and the import paths are correct, try rebuilding the connector:
Copy code
bash    airbyte-ci connectors --name destination-orange-hdfs build
If the issue persists, you might want to check the specific version of
airbyte_cdk
you are using and ensure it includes the
AirbyteLogger
class. You can also refer to the [Airbyte documentation](https://docs.airbyte.com) for more detailed guidance. For more context, you can refer to the following knowledge sources: - [Update connector build to use local CDK on flag](https://github.com/airbytehq/airbyte/issues/28428) - [connectors-ci: Allow compiling native python extensions](https://github.com/airbytehq/airbyte/issues/27971) If you need further assistance, feel free to ask!
h
@kapa.ai so how do I know the correct aka compatible version for airbyte cdk that needs to be there
k
A message from kapa.ai
To determine the correct or compatible version of the
airbyte-cdk
that you need, you can follow these steps: 1. Check the Documentation: The Airbyte documentation often specifies the required versions for different components. You can refer to the [Airbyte documentation](https://docs.airbyte.com) for detailed information. 2. Review the Connector's
requirements.txt
or
setup.py
: If you are working on a specific connector, the
requirements.txt
or
setup.py
file in the connector's directory should specify the required version of the
airbyte-cdk
. For example:
Copy code
plaintext    airbyte-cdk~=0.1.56
3. Use the Latest Compatible Version: If you are unsure, you can try using the latest stable version of the
airbyte-cdk
that is available. You can install it using pip:
Copy code
bash    pip install airbyte-cdk
4. Refer to the Airbyte GitHub Repository: The Airbyte GitHub repository often has discussions and issues that can provide insights into the compatible versions. For example, you can refer to the [GitHub Issue on building connectors with the local CDK](https://github.com/airbytehq/airbyte/issues/30242) for more context. 5. Check for Pre-release Versions: If you are developing or testing new features, you might need to use a pre-release version of the
airbyte-cdk
. You can install pre-release versions using the
--pre
flag:
Copy code
bash    pip install --pre airbyte-cdk
6. Consult the Community: If you are still unsure, you can ask for help in the Airbyte community forums or GitHub discussions. For example, you can refer to the [Airbyte community forum post](https://discuss.airbyte.io/t/1397) where users discuss issues related to
airbyte-cdk
versions. By following these steps, you should be able to determine the correct and compatible version of the
airbyte-cdk
for your needs. If you encounter any specific issues, feel free to ask for further assistance!
h
@kapa.ai this is the setup.py file, does not include version for airbyte_cdk :
Copy code
from setuptools import find_packages, setup

MAIN_REQUIREMENTS = ["airbyte-cdk", "paramiko~=3.4.0", "asyncssh~=2.14.2", "setuptools~=3.3.0", "pydoop~=2.0.0"]

TEST_REQUIREMENTS = ["pytest~=6.2"]

setup(
    name="destination_orange_hdfs",
    description="Some descrinion.",
    author="Airbyte",
    author_email="<mailto:contact@airbyte.io|contact@airbyte.io>",
    packages=find_packages(),
    install_requires=MAIN_REQUIREMENTS,
    package_data={"": ["*.json"]},
    extras_require={
        "tests": TEST_REQUIREMENTS,
    },
)
k
A message from kapa.ai
To ensure compatibility and avoid issues with the
airbyte-cdk
version, you should specify a version for the
airbyte-cdk
in your
setup.py
file. Here’s how you can modify your
setup.py
file to include a specific version for `airbyte-cdk`: 1. Determine the Compatible Version: Based on the knowledge sources, you might want to use a version that is known to be stable and compatible with your setup. For example, you can use
airbyte-cdk~=0.1.56
as mentioned in the [forum post](https://discuss.airbyte.io/t/1397). 2. Update
setup.py
: Modify the
MAIN_REQUIREMENTS
list in your
setup.py
file to include the specific version for
airbyte-cdk
. Here is the updated
setup.py
file:
Copy code
python from setuptools import find_packages, setup  MAIN_REQUIREMENTS = [     "airbyte-cdk~=0.1.56",  # Specify the version for airbyte-cdk     "paramiko~=3.4.0",     "asyncssh~=2.14.2",     "setuptools~=3.3.0",     "pydoop~=2.0.0" ]  TEST_REQUIREMENTS = ["pytest~=6.2"]  setup(     name="destination_orange_hdfs",     description="Some description.",     author="Airbyte",     author_email="<mailto:contact@airbyte.io|contact@airbyte.io>",     packages=find_packages(),     install_requires=MAIN_REQUIREMENTS,     package_data={"": ["*.json"]},     extras_require={         "tests": TEST_REQUIREMENTS,     }, )
3. Rebuild the Connector: After updating the
setup.py
file, rebuild your connector to ensure that the specified version of
airbyte-cdk
is used:
Copy code
bash    airbyte-ci connectors --name destination-orange-hdfs build
By specifying the version of
airbyte-cdk
in your
setup.py
file, you can avoid compatibility issues and ensure that your connector builds correctly. If you encounter any further issues, you can refer to the [Airbyte documentation](https://docs.airbyte.com) or seek help from the Airbyte community.