-
Notifications
You must be signed in to change notification settings - Fork 100
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
OSError: could not get source code #191
Comments
Thanks for opening this! Definitely want to figure out what's going on, but I'm not able to reproduce the issue on my end (thanks for providing a minimal code sample, by the way). I was able to check the sample code on MacOS 10.14 and Ubuntu 16.04 (both running Python 3.6 and 3.7) without issue. Can you tell me about your setup? Python version? OS? Thanks again for taking the time to report this problem! I really appreciate it! |
Thank you for the help. My setup is windows 10, python 3.6 using pycharm IDE. So, it appears that the issue is running the code interactively... After troubleshooting in different situations, I found that I could run the code above successfully in a script file:
But either in pycharm or just the python shell, if I paste the code it fails with the above error. This behavior is the same for Windows and Ubuntu. Here's the same error on ubuntu:
|
Ahh nice catch. I was able to reproduce the error in a terminal shell. However, I didn't get the error using the PyCharm debugger to step through the script...
The error being raised in the shell makes sense because |
I see, makes sense... Yes, I prefer to use pycharm in a similar way to jupyter where I use the pycharm variable inspector to show the results as each code snippet is executed. I don't use the debugger but rather have pycharm setup to "shift-enter" through each code blocks and then use the variable inspector to explore. I think if you were to execute the code in pycharm (not debugger) it will reproduce the error as it is similar to running it in the shell (with the added benefit of having the variable explorer). Yes it would be great to have pycharm support to be able to interactively run experiments without having to execute the entire script each time. I could always switch to jupyter but it lacks some of the benefits of pycharm. Thanks and looking forward to digging deeper into using hyperparameter hunter. So far it looks very nice :) |
This is weird... I would have expected you to get the same error in pycharm's console as you would in a a shell console... Yes, I am using the pycharm console tool the same way as you in the picture. However, I am getting the error: I was using python 3.6 but tried 3.7 just for testing and got the same result. I also tried playing around with some settings in pycharm but wasn't able to get it to work. I did notice that my python variables are being displayed in the explorer window under the "Special Variables" section but I think that is just a different visual represenation. Hmmmm... Not sure but will continue to look into it... |
I believe the variable display difference is caused by the left gear icon’s “Simplified Variables View” option. I checked that option and restarted the console, which produced a display closer to yours, so as you said, I think that’s unrelated. I came up with a smaller snippet for our testing: import inspect
def foo(): ...
inspect.getsource(foo)
inspect.getfile(foo) The last line outputs “<ipython-input-3-0ad329aeb3e9>”, which was interesting, so I looked into my settings and found I had the “Build, Execution, Deployment” > “Console” > “Use IPython if available” option checked. When I unchecked this, I got the So it looks like the PyCharm console originally worked for me because of that setting, which must be saving some temporary IPython notebook somewhere, enabling the Perhaps we can implement something similar in HH. However, the fact that it only worked because of a fairly obscure PyCharm setting makes me think that for HH, we would basically need to save all interactive console input as it’s coming in. To do that, HH would have to be imported immediately after starting the interactive session, and I don’t think that’s a reasonable requirement. I’ll keep trying to think of other ways around this, though… |
Great catch! Yes, so that is good that there is a work around in pycharm provided you have that option checked and ipython installed. (Which I didn't have installed when I also tried that setting earlier to try to replicate your success). I wouldn't make this a high priority now that we have a workaround. BTW, HH so far is very nice! Great work! I have run some simple experiments so far and really like how easy it is to setup and also to keep track of everything. I am planning on next week diving deeper and would like to give you some feedback. Do you have a forum for users to discuss or to ask you questions? |
Awesome! Glad that worked for you, too! Thanks a lot! I'd absolutely love any feedback! I do have a Slack channel set up for HyperparameterHunter, but I haven't been able to figure out how to add the nice little invite badge to the README yet, so it's pretty much empty. Nevertheless, that's a great place to give feedback or ask anything you might not think is "issue-worthy". Thanks a lot for asking and for taking the time to dive in! |
Hello,
I am getting the following error when trying to follow along this article:
https://towardsdatascience.com/hyperparameter-hunter-feature-engineering-958966818b6e
Here is the code:
CVExperiment exp_0 works but not exp_1
Thanks for any help.
The text was updated successfully, but these errors were encountered: