pymc-devs / pymc-resources

PyMC educational resources
MIT License
1.96k stars 745 forks source link

Chapter 5 import error when running pymc model #201

Open EAly opened 2 years ago

EAly commented 2 years ago

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

canyon289 commented 2 years ago

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

EAly commented 2 years ago

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

canyon289 commented 2 years ago

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.

EAly commented 2 years ago

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

canyon289 commented 2 years ago

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: @.***>

EAly commented 2 years ago

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.

canyon289 commented 2 years ago

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: @.***>

symeneses commented 2 years ago

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.

yahrMason commented 2 years ago

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