econ-ark / EstimatingMicroDSOPs

https://econ-ark.github.io/EstimatingMicroDSOPs/
MIT License
2 stars 10 forks source link

Website Materials Notebook does not exist #8

Closed alanlujan91 closed 1 year ago

alanlujan91 commented 1 year ago

The website at https://econ-ark.org/materials/solvingmicrodsops points to an interactive notebook that does not exist in this repository, namely Code/Python/SolvingMicroDSOPs-Python.ipynb.

Reported in Scientific Python Discord https://discord.com/channels/786703927705862175/1057710158639267990/1060587813281747034

alanlujan91 commented 1 year ago

@llorracc It seems like in the private repo the notebook has been moved and renamed and it hasn't propagated to the public version

alanlujan91 commented 1 year ago

@llorracc after your fix, I tried to open it and it returned this error

ERROR: Ignored the following versions that require a different python version: 0.8.0.dev1 Requires-Python >=2.7, !=3.*; 0.8.0.dev2 Requires-Python >=2.7, !=3.*; 0.8.0.dev3 Requires-Python >=2.7, !=3.*; 0.8.0.dev4 Requires-Python >=2.7, !=3.*; 0.8.0.dev5 Requires-Python >=2.7, !=3.*; 0.8.0.dev6 Requires-Python >=2.7, !=3.*; 0.8.0.dev7 Requires-Python >=2.7, !=3.*; 0.9.0 Requires-Python >=2.7, !=3.*; 0.9.0.dev1 Requires-Python >=2.7, !=3.*; 0.9.0.dev2 Requires-Python >=2.7, !=3.*; 3.6.0 Requires-Python >=3.8; 3.6.0rc1 Requires-Python >=3.8; 3.6.0rc2 Requires-Python >=3.8; 3.6.1 Requires-Python >=3.8; 3.6.2 Requires-Python >=3.8
ERROR: Could not find a version that satisfies the requirement matplotlib-base==3.3.4 (from versions: none)
ERROR: No matching distribution found for matplotlib-base==3.3.4
Removing intermediate container 80ec26f8130c
The command '/bin/sh -c ${KERNEL_PYTHON_PREFIX}/bin/pip install --no-cache-dir -r "binder/requirements.txt"' returned a non-zero code: 1

it has to do with requirement inconsistency

llorracc commented 1 year ago

OK, can you see if you can figure out the problem? Presumably some change to the requirements.txt file ...

alanlujan91 commented 1 year ago

made some changes on my fork, this link is almost working but now I think there are some errors in the code https://mybinder.org/v2/gh/alanlujan91/SolvingMicroDSOPs/enviro?labpath=SolvingMicroDSOP.ipynb

llorracc commented 1 year ago

I'm getting the same "cannot find SolvingMicroDSOPs.ipynb" error as before when I click on the link.

On Fri, Jan 6, 2023 at 1:41 PM alanlujan91 @.***> wrote:

made some changes on my fork, this link is almost working but now I think there are some errors in the code https://mybinder.org/v2/gh/alanlujan91/SolvingMicroDSOPs/enviro?labpath=SolvingMicroDSOPs.ipynb

— Reply to this email directly, view it on GitHub https://github.com/econ-ark/SolvingMicroDSOPs/issues/8#issuecomment-1374047152, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKCK74TFS643HEIDSORJNTWRBYMVANCNFSM6AAAAAATSLJHEI . You are receiving this because you were mentioned.Message ID: @.***>

--

alanlujan91 commented 1 year ago

Fixed it so now the link works. However, running the notebook in this environment still creates an error further down in the notebook, so still need to figure out what's going on.

It also still takes way too long to set up this environment, maybe @camriddell can provide suggestions.

llorracc commented 1 year ago

@alanlujan91 can you make a PR to the SolvingMicroDSOPs-Latest repo so I can run my script to create the public version and test it?

camriddell commented 1 year ago

@alanlujan91 the binder link was actually quite fast for me, but that's likely because when you accessed it you had to sit through a build of the container (then when I accessed it, binder was able to pull that previously built image).

There are a few ways you can speed up binder links

There are shortcuts we can take, but let's save that for an online meeting.


As per the notebook issue, there is an issue with the GothicMC class where its varsigma_Tminus1 and varsigma_t methods sometimes return a numpy scalar and sometimes return a numpy array with 1 element. A quick fix of squeezing via np.squeeze the returned result down into a scalar enabled me to run the notebook to completion.

class GothicMC(Gothic):  ## inheriting from Gothic class
    ## inheritance from Gothic and adds additional functions/methods for portfolio choice
    ...

    def varsigma_Tminus1(self,
                         a):
        ...
        return np.squeeze(varsigma_opt)

    def varsigma_t(self, 
                   a, 
                   c_prime):       
        ...
        return np.squeeze(varsigma_opt)
alanlujan91 commented 1 year ago

Awesome! Thanks for helping out with this @camriddell. I think there might also be redundancy with having a binder folder and also requirements.txt and environment.yml files in root directory. For the PR that @llorracc just requested I will just keep the environment.yml file.

llorracc commented 1 year ago

@camriddell,@alanlujan91

Well, really my recommendation is that we queue this up for the systematic review of how we handle requirements. Since @alanlujan91 could not figure out how to require texlive-full I'm concerned that the .yml approach may be less general than the files-in-binder-directory version.