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

Identify "finished" notebooks and pin them to versions of HARK #51

Closed
shaunagm opened this issue Jul 23, 2019 · 10 comments
Closed

Identify "finished" notebooks and pin them to versions of HARK #51

shaunagm opened this issue Jul 23, 2019 · 10 comments

Comments

@shaunagm
Copy link
Contributor

Per discussions on issue #43 and PR #50, the only way to have multiple notebooks in a repository that use different versions of HARK is to add a cell to the top of the notebooks installing the desired version, which would look something like:

%%capture
! pip install econ-ark==0.10.whatever

(The %%capture is there to prevent the installation's progress from displaying within the notebook -- it suppresses all output.)

Once we do this, we can set the default in the repository to be the latest stable release. Any notebooks that are not "finished" and pinned to an older version will automatically be updated to the new release, and we can test them when that happens.

@llorracc
Copy link
Collaborator

That solution would be fine for notebooks that are being run on transient machines in the cloud. But it occurs to me that it is kind of rude for the notebook to install something, maybe something very large, on the user's machine without even asking permission.

Maybe a more robust solution: For "pinned" notebooks, there should be a test for the availability of the particular version needed; if it does not exist, then the user should be asked whether it is OK to install it. (If it does exist, then the pip install is not necessary, but does no harm (=takes little time). I take it that the reason to do it regardless is that the process of installing puts the correct version of python in the path?

@shaunagm
Copy link
Contributor Author

I see what you're saying, but the user will have installed econ-ark already, this is just a different version.

The process of installing puts the correct version of Hark on the path.

@llorracc
Copy link
Collaborator

Well, they might not have installed it at all, right? They might just have downloaded a notebook without realizing they would need to install HARK to run it. When they learn they will need to install a software package on their computer they might decide that it's not worth it.

@shaunagm
Copy link
Contributor Author

shaunagm commented Jul 24, 2019

If they want to run our notebooks, they'll need to install HARK, there's no way around that. Currently this is done by installing things in the requirements.txt.

@llorracc
Copy link
Collaborator

My point is that if they download a notebook without having installed HARK (and therefore obviously haven't understood how the whole thing works), they might change their mind and decide they don't want to run the notebook after all because they don't want to install another package on their computer.

@shaunagm
Copy link
Contributor Author

shaunagm commented Aug 7, 2019

But they can't run the notebook anyway without installing HARK. So if they don't want to install another package there's nothing we can do that will end up with them running the notebook locally - we can only point them to hosted solutions.

Is your worry that you think it's harder to get consent for installing HARK when doing so from inside the notebook, whereas users are explicitly consenting when they run pip install requirements.txt from the command line? If not, can you explain again from the beginning, I feel like we're talking past each other here and I'm quite confused.

@llorracc
Copy link
Collaborator

llorracc commented Aug 8, 2019 via email

@shaunagm
Copy link
Contributor Author

shaunagm commented Aug 8, 2019

I can't find evidence that Jupyter notebooks allow popups but I'll look harder tomorrow. If you're okay with cluttering the top of the notebooks a little bit, an alternative would be:

# hark installation code 
if HARK is not installed:
  raiseError("HARK needs to be installed to run this notebook.  To install HARK, please remove the hash symbol from the following line and re-run the notebook.  If you do not want to install HARK on your computer, try running this notebook on the cloud at the following URL: ")

Raising the error will cause the contents of the error to show up when you run the notebook. This will be annoying for some people but you can't customize for every user.

This also makes it harder to do the pinned version override. Up to you what you care about more and which experiences you're trying to optimize.

@llorracc
Copy link
Collaborator

llorracc commented Aug 8, 2019

Jupyter notebooks can definitely be interactive and your solution is exactly the kind of thing I had in mind.

And you are right that the key question is balancing simplicity versus other requirements.

Unfortunately, we already need a fair amount of preamble/setup stuff to make sure that our .ipynb Jupyter notebooks generate flawlessly functioning *.py files that can be executed via a ipython [x].py command. So adding one more item does not seem too awful.

@MridulS
Copy link
Member

MridulS commented Aug 6, 2020

This issue is resolved with having pinned versioned released of the DemARK with HARK releases, further discussion in #108

@shaunagm @llorracc we should close this issue.

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

No branches or pull requests

3 participants