Use imported package project in model api

tasneem.ghayas
tasneem.ghayas Member Posts: 11

I have a Model API which uses a custom import of a package. But the imported package path is not available during the API run. There is ModuleNotFound error but if the same file is ran without using the api there is no module error.

For example lets say:

I have a project named as 'api_project', in the 'api_project' ,the package is imported by navigating to Files --> Other Projects , the path of the package is /mnt/package_owner/project name but during the api run the environment is replaced with my owner name.

Answers

  • terry.stebbens
    terry.stebbens Moderator, Domino Posts: 17 mod

    Unfortunately at present imported projects are not included in a model when the environment for that model is built. This is similar to the way models don't read requirments.txt (a work-around for which you can find here: https://community.dominodatalab.com/discussion/167/how-do-i-ensure-a-python-package-from-a-private-repo-is-usable-in-both-runs-and-models#latest)

    I will make sure the documentation is updated to make it clear that imported projects are not read at present and also we'll work on making this work as expected in the future.

    For the moment, the work-around is either to copy the code from your imported projects to the model's project before publishing the model API or to upload the code in your imported projects to an external Git repository (such as GitHub) and import the code to you model via the external Git repository using the work-around I linked to above.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!