Skip to content

remote build VS code issue - ModuleNotFoundError: No module named 'teradatasqlalchemy.dialect #1299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Sagarthore11 opened this issue Aug 7, 2023 · 29 comments
Assignees

Comments

@Sagarthore11
Copy link

Error : Result: Failure Exception: ModuleNotFoundError: No module named 'teradatasqlalchemy.dialect'

Hello Team,

Please refer the requirement.txt and init.py for reference and to reproduce issue

init.py

import logging
from sqlalchemy import create_engine
import azure.functions as func

def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')

teradata_client = create_engine("teradatasql://username:passwd@server_name")
logging.info('after teradata')

name = req.params.get('name')
if not name:
    try:
        req_body = req.get_json()
    except ValueError:
        pass
    else:
        name = req_body.get('name')

if name:
    return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
else:
    return func.HttpResponse(
         "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
         status_code=200
    )

requirement.txt

azure-functions
teradatasqlalchemy

Deployed the above code using vs code in python function app version ~4 and receiving an Failure Exception: ModuleNotFoundError: No module named 'teradatasqlalchemy.dialect' . even though same code is working fine on local

=> Also noticed that adding there is an issue with remote build only I believe
=> Even tried to do the pip install explicitly on kudu site but no luck

Can you please help me with this? You can simply create the test function app, create the sample http trigger, add the code, and reproduce.

Thanks

@Sagarthore11
Copy link
Author

Hello Team any help would be appreciated

@bhagyshricompany bhagyshricompany self-assigned this Aug 8, 2023
@bhagyshricompany
Copy link

Thanks for reporting will check and update you.

@Sagarthore11
Copy link
Author

@bhagyshricompany Thank you for looking into it. Please feel free to let me know if you need any information from me.

@Sagarthore11
Copy link
Author

Any update on it please ?

@bhagyshricompany
Copy link

investigating on it will update once done

@Sagarthore11
Copy link
Author

@bhagyshricompany are you able to reproduce the issue ?

@YunchuWang
Copy link
Member

tried repro the code and i got this error both running in a simple python file or function app in local:
image
image

in my .venv, teradatasql is installed
image

Look like a sqlalchemy issue

@Sagarthore11
Copy link
Author

Hello @YunchuWang for looking into it. But we are not seeing any issue in vs code local. Please refer the below screen shot for the same

image

@Sagarthore11
Copy link
Author

@YunchuWang could you please try once by doing pip intsall in vs code

pip3 install -r requirements.txt

@YunchuWang
Copy link
Member

@Sagarthore11 thanks for clarification, i am able to repro this error. As you mentioned right seem an issue with remote build, I downloaded the deployed code and i found it seems an issue with remote build not building this package teradatasqlalchemy properly. In my screenshot you can see all the package module files are missing.
image

while building with local dependencies works, (func azure functionapp publish --build-native-deps)
image

image

Will try if i can check the remote build logs and let you know, meantime you can try local build

@Sagarthore11
Copy link
Author

Sagarthore11 commented Aug 11, 2023

Hello @YunchuWang ,

Thank you so much for looking into it and helping.

Yes I tried with the local build and it's working.

Also, after adding ENABLE_ORYX_BUILD = false and SCM_DO_BUILD_DURING_DEPLOYMENT = 0 in the configuration setting of function app explicitly when I am deploying using GitHub workflow action, it's working.

Ask: We would like to know if there is only one issue with the remote build?

Thank you so much for your help

@Sagarthore11
Copy link
Author

Hello @YunchuWang

Thanks for helping into it.

Did you get chance to check the remote build logs?

Thanks

@Sagarthore11
Copy link
Author

Hello @YunchuWang ,

Do you have any update on it please ?

Thanks

@Sagarthore11
Copy link
Author

Hello @YunchuWang and Team,

Greetings!!!

Thank you so much for helping us. Do you have any update on it please?

@YunchuWang
Copy link
Member

@Sagarthore11 Hi Sagarthore, sorry for delay. I was busy with other work past few days and just got a chance. I checked the oxry build log but cant find any err logs related https://statics.teams.cdn.office.net/evergreen-assets/safelinks/1/atp-safelinks.html. Will try build with oryx locally to see why this package is not installed properly and let you know soon.

@Sagarthore11
Copy link
Author

@YunchuWang Thank you for the response and help.

I will wait for your update. Thanks

@Sagarthore11
Copy link
Author

Hello @YunchuWang ,

Any luck on it please ?

Thanks

@Sagarthore11
Copy link
Author

Hello @YunchuWang ,

Thanks for helping on it

Any help on it please?

@YunchuWang
Copy link
Member

@Sagarthore11 Hi Saga, sorry. I tried oyrx build(the same way how remote build builds the packages) and see the same err
image
. This is first time we observe issue like this, thanks for bringing it up. I contacted oyrx team internally for further investigation on this matter and will let you know once they give an update.

@Sagarthore11
Copy link
Author

Thanks a lot @YunchuWang for helping us on it 👍

@YunchuWang
Copy link
Member

@Sagarthore11 No problem, a heads up, oyrx team identified this is a known issue which got fixed in https://github.com/microsoft/Oryx/releases/tag/20230403.1 by setting app setting ORYX_DISABLE_PIP_UPGRADE to true then publish with remote build.
image

Remote build right now uses Oryx Version: 0.2.20230210.1. I will let you know when remote build will release with oyrx 20230403.1

@Sagarthore11
Copy link
Author

Thanks a lot once again @YunchuWang for your help.

@bhagyshricompany
Copy link

hope now resolved query hence its closing

@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@Mikeflames
Copy link

Mikeflames commented Mar 7, 2025

I am facing the same issue , Everything works fine on local but on deployment it throws this error :-
2025-03-07T09:51:43Z [Error] Failed to create engine: No module named 'teradatasqlalchemy.dialect' 2025-03-07T09:51:43Z [Error] Teradata data fetch/store error: No module named 'teradatasqlalchemy.dialect'

I tried changing the enviornment variables as recommended above but that didn't helped :-

Image

@YunchuWang Can you please see this

@Sagarthore11
Copy link
Author

Hello @Mikeflames ,

Could you please by adding SCM_DO_BUILD_DURING_DEPLOYMENT and ENABLE_ORYX_BUILD are set to true and see if still it's same problem ?

I am happy to check with on it. if facing the same issue

@Mikeflames
Copy link

Mikeflames commented Mar 7, 2025

Would Continue the Conversation on Open Issue .
Link :- #1648

Yes still the same issue :-

Image

Env variables :-

Image

@Sagarthore11
Copy link
Author

@Mikeflames I will check the details and will keep you posted on it

@Mikeflames
Copy link

Hi are there any updates / resolution ? Please let me know
@YunchuWang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants