Skip to content
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

Python VetiverAPI deployment issues to. Posit connect #218

Open
rhea2909 opened this issue Nov 19, 2024 · 4 comments
Open

Python VetiverAPI deployment issues to. Posit connect #218

rhea2909 opened this issue Nov 19, 2024 · 4 comments

Comments

@rhea2909
Copy link

Hello I am facing packaging issues on Posit workbench vs posit connect while deploying a vetiver python model. I am using
vetiver.deploy_rsconnect( connect_server, board=board, pin_name=model_name, )
I want it to use my requirements.txt file but it still uses the default env.
The error i get is this:
ERROR: No matching distribution found for cloud-init==23.1.2 2024/11/19 19:31:49.530226724 pip install failed with exit code 1

@rhea2909
Copy link
Author

I have a custom transformer in my model and i tried to do it in the way that is described here: https://github.com/rstudio/vetiver-python/blob/main/docs/custom_code.qmd
But still after running the rsconnect deploy function the error is the same on Posit connect which says: AttributeError: Can't get attribute 'InteractionTransformer' on <module 'main' from '/opt/rstudio-connect/python/connect_fastapi_runtime.py'>

@isabelizimm
Copy link
Contributor

Hi there! Thank you so much for the report. For using the requirements.txt, you can pass it in using something like vetiver.deploy_rsconnect( connect_server, board=board, pin_name=model_name, extra_files=['requirements.txt'])

Are you able to share some more information on the setup of your deployed files for the AttributeError? Eg, what files are being deployed, and what each one is doing?

@rhea2909
Copy link
Author

rhea2909 commented Dec 5, 2024

i am deploying app.py, custom_transformers.py and requirements.txt. The app.py is reading the python model pipeline pin from posit connect and wrapping it up in VetiverAPI. app.py is importing my custom_transformers script (from custom_transformers import....)
Still on posit connect I get the same attribute error

@isabelizimm
Copy link
Contributor

Ah, a few things might be happening here! The two most seen ways to get that error are:

  1. The original custom_transformer may have been pinned from inside a Jupyter Notebook. Because pickling only saves a reference for how to read a class, not the source code, a custom model transformer pinned from a Jupyter notebook will not resolve to the same location as custom_transformers.py. To fix this, repin your model/transformer from inside the custom_transformers.py script.
  2. You may not be supplying the custom transformer to the model. When deploying, you'll want to add in the transformer to the extra_files so that it can be read back later.vetiver.deploy_rsconnect( connect_server, board=board, pin_name=model_name, extra_files=['custom_transformers.py', 'requirements.txt'])

Let me know if either of these fixes helped out!

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

No branches or pull requests

2 participants