-
Notifications
You must be signed in to change notification settings - Fork 42
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
Load a python script that contains a main function #59
Comments
Hello @dvmorris |
This example works:
This works:
This does not work:
|
I believe that removing the filename from the url of the non-working example will fix it as well. |
|
Does this test assume that xboost_ray is installed on the system, and you're just trying to import it via a remote script? |
Yes, the issue with this particular use case is that this pip package
doesn't include the examples in it.
…On Tue, Nov 7, 2023, 2:08 PM rkbennett ***@***.***> wrote:
Does this test assume that xboost_ray is installed on the system, and
you're just trying to import it via a remote script?
—
Reply to this email directly, view it on GitHub
<#59 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABNPDLLEYCOM3YWLOWPOFDYDKIK3AVCNFSM6AAAAAA6ZNB36GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJZHA2DAOBQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
So I was looking into this a bit, and I think xboost_ray uses some odd python files. Saw a bunch of pyx in my testing. Haven't had time to look into it more though. |
|
Can you paste your code in here? |
Are you running this on linux? I suppose I should have started with that question |
@dvmorris I did some testing with another tool and I don't think there is actually an issue with being unable to import packages with main functions. I think it's likely a different issue which is that when the import happens it's missing a dependency (likely ray[train] or sklearn) which is causing a failure in the import, this then cascades back to an actual issue in this project, which is that when an error happens during import with httpimport it silently continues and you end up with broken packages showing imported, but they are never fully imported. If you really want to test this theory you could try my code from my PR. Otherwise, you can try it with my od_import project. Testing there it definitely has a main function
Having said that, in my testing, while I do get simple to import and it has a main function, when you attempt to run |
The problem seems to be python 3.12, it doesn't happen with od_import. |
Yeah, httpimport doesn't currently support 3.12, there's an open issue for adding that support, but in 3.12 they depricated the load_module function and completely removed the find_module function, which has broken compatibility with httpimport. |
As shown here: #58 (comment) If you are still on it, can you please test again? |
I want to load this file and call the main function: https://raw.githubusercontent.com/dmlc/xgboost/d3f06467797acd61e80e87be38fb9812a016a64e/demo/guide-python/categorical.py
How do I do this? I see your example that loads a file from a gist that contains a single function, but I can't get this technique to work with the file above.
The text was updated successfully, but these errors were encountered: