pymc-resources icon indicating copy to clipboard operation
pymc-resources copied to clipboard

Chapter 5 import error when running pymc model

Open EAly opened this issue 2 years ago • 9 comments

I get the following error when I try to run any pymc model from chapter 5, e.g. Code 5.3, Code 5.6, Code 5.10:

ImportError                               Traceback (most recent call last)
File ~/miniconda3/envs/StatsReth_Py39/lib/python3.9/site-packages/aesara/link/c/lazylinker_c.py:79, in <module>
     78         if version != actual_version:
---> 79             raise ImportError(
     80                 "Version check of the existing lazylinker compiled file."
     81                 f" Looking for version {version}, but found {actual_version}. "
     82                 f"Extra debug information: force_compile={force_compile}, _need_reload={_need_reload}"
     83             )
     84 except ImportError:

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.212, but found 0.211. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
File ~/miniconda3/envs/StatsReth_Py39/lib/python3.9/site-packages/aesara/link/c/lazylinker_c.py:100, in <module>
     99     if version != actual_version:
--> 100         raise ImportError(
    101             "Version check of the existing lazylinker compiled file."
    102             f" Looking for version {version}, but found {actual_version}. "
    103             f"Extra debug information: force_compile={force_compile}, _need_reload={_need_reload}"
    104         )
    105 except ImportError:
    106     # It is useless to try to compile if there isn't any
...
    329     del sys.path[0]
--> 331 assert fullpath.startswith(rval.__file__)
    332 return rval

AssertionError: 

I exported the details of the environment I'm using to the attached txt files (I'm sorry if this is not the optimal way to share environments, but this is the best of my knowledge) stats_reth2_ea_env.txt

stats_reth2_ea_envExport.txt

EAly avatar Jul 18 '22 03:07 EAly

Have you tried using this environment with the package versions listed here? https://github.com/pymc-devs/pymc-resources/blob/main/Rethinking_2/environment.yml

canyon289 avatar Jul 18 '22 04:07 canyon289

The environment I'm using is pretty much the same, except that I'm using pymc v4

EAly avatar Jul 18 '22 04:07 EAly

That explains it. PyMC V4 has multiple breaking changes and isnt compatible with the notebooks in that directory. Id suggest using that version exactly, or if youd like upgrading the rethinking notebooks to v4 in prs.

canyon289 avatar Jul 18 '22 04:07 canyon289

Just to be sure, are you referring to this pull request: #198?

EAly avatar Jul 18 '22 04:07 EAly

I dont think so because the environment doesnt change in that PR

On Sun, Jul 17, 2022 at 9:42 PM EAly @.***> wrote:

Just to be sure, are you referring to this pull request: #198 https://github.com/pymc-devs/pymc-resources/pull/198?

— Reply to this email directly, view it on GitHub https://github.com/pymc-devs/pymc-resources/issues/201#issuecomment-1186763315, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXBFYMIC5OS3CTB6ZRAZCTVUTOERANCNFSM5323H3AA . You are receiving this because you commented.Message ID: @.***>

canyon289 avatar Jul 18 '22 13:07 canyon289

Actually the use of aesara instead of theano, as per the notebook, solved the problem and the models are working fine so far (up to code snippet 5.10). I'm not sure though if others changes need to be done to the other packages in the environment.

EAly avatar Jul 19 '22 02:07 EAly

Looked at the PR, yes though it needs some work. Would you be willing to update env file and the rest of the notebooks as well? That would be a great help!

On Mon, Jul 18, 2022 at 6:04 AM Ravin Kumar @.***> wrote:

I dont think so because the environment doesnt change in that PR

On Sun, Jul 17, 2022 at 9:42 PM EAly @.***> wrote:

Just to be sure, are you referring to this pull request: #198 https://github.com/pymc-devs/pymc-resources/pull/198?

— Reply to this email directly, view it on GitHub https://github.com/pymc-devs/pymc-resources/issues/201#issuecomment-1186763315, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXBFYMIC5OS3CTB6ZRAZCTVUTOERANCNFSM5323H3AA . You are receiving this because you commented.Message ID: @.***>

canyon289 avatar Oct 11 '22 07:10 canyon289

I read in the Rethinking README that chapters 14, 15 and 16 are left to be migrated. Is someone working on that? I didn't find any related issue.

symeneses avatar Nov 12 '22 13:11 symeneses

@symeneses chapter 14 updates are on main, you can find the 15 and 16 updates on this PR

yahrMason avatar Nov 30 '22 12:11 yahrMason