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

[BUG] Examples directory contains absolute imports which do not work and relative imports also dont work with current zenml git logic #55

Closed
SaraKingGH opened this issue Feb 25, 2021 · 3 comments · Fixed by #59
Labels
bug Something isn't working

Comments

@SaraKingGH
Copy link

Describe the bug
I tried to run the scikit demo from example folder. first it gave the "No module named 'examples'".
Then I change this line
from examples.scikit.step.trainer import MyScikitTrainer in run.py to from step.trainer import MyScikitTrainer to fix the problem and now its giving this error:

Screenshots
it attached

** Context (please complete the following information):**

OS: Mac
Python Version: 3.7.4
ZenML Version: cloned from the git
Screen Shot 2021-02-25 at 12 21 42 PM

@SaraKingGH SaraKingGH added the bug Something isn't working label Feb 25, 2021
@htahir1
Copy link
Contributor

htahir1 commented Feb 26, 2021

@SaraKingGH Two answers to this.

First case: The import problem

In the first instance, could you tell us which context you executed the script in? To make it work 'as is', you should run it within the examples/scikit directory. From scratch, do the following:

git clone https://github.com/maiot-io/zenml.git

Before continuing, either install the zenml pip package or install it from the cloned repo. Then:

cd zenml
zenml init
cd examples/scikit

python run.py

This is working for me personally, and looking at your screenshot also seems to be what you're doing. Not sure why you had to resolve from examples.scikit.step.trainer import MyScikitTrainer in run.py to from step.trainer import MyScikitTrainer. Could you try repeating the above steps and tell if the problems persists?

Second case: The Ref HEAD problem

The screenshot you shared seems to indicate that there is a file called fun.py within the directory. And that seems to be the cause of the problem: As it seems not to be tracked by Git at all, we are having a hard error when it tries to resolve the step. Read more about how Git resolution works here: https://docs.zenml.io/repository/integration-with-git.html .

This is not intended behavior, and seems to be a bug. Further investigation is warranted. For now, please try and commit fun.py before running and it should work better. Let me know if any of that helps!

@htahir1 htahir1 changed the title [BUG] [BUG] Git panic thrown if non-tracked file present in repo Feb 26, 2021
@htahir1 htahir1 linked a pull request Mar 17, 2021 that will close this issue
9 tasks
@htahir1 htahir1 changed the title [BUG] Git panic thrown if non-tracked file present in repo [BUG] Examples directory contains absolute imports which do not work and relative imports also dont work with current zenml git logic Mar 17, 2021
@htahir1
Copy link
Contributor

htahir1 commented Mar 17, 2021

@SaraKingGH Update: After further investigation, my above diagnosis seems flawed.You were indeed correct to point out that changing from from examples.scikit.step.trainer import MyScikitTrainer in run.py of the scikit example to from step.trainer import MyScikitTrainer would yield the error you showed. This was becuase of the logic of resolving relative imports in the git wrapper of zenml. We have no fixed this issue with PR #59. After merge and next release (hopefully today or tomorrow), please installed the latest zenml and see if it works now :-). Thank you!

@SaraKingGH
Copy link
Author

@SaraKingGH Update: After further investigation, my above diagnosis seems flawed.You were indeed correct to point out that changing from from examples.scikit.step.trainer import MyScikitTrainer in run.py of the scikit example to from step.trainer import MyScikitTrainer would yield the error you showed. This was becuase of the logic of resolving relative imports in the git wrapper of zenml. We have no fixed this issue with PR #59. After merge and next release (hopefully today or tomorrow), please installed the latest zenml and see if it works now :-). Thank you!

sounds great Tahir, thanks for letting me know.:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants