ejolly / pymer4

All the convenience of lme4 in python
http://eshinjolly.com/pymer4
MIT License
193 stars 26 forks source link

Issue with r-matrix package? #136

Open noahcreany opened 8 months ago

noahcreany commented 8 months ago

Please answer these questions:

Does installing pymer4 into a clean conda environment in any of these four ways solve the problem? If so, which worked and which didn't?

  1. conda create --name test_env1 -c ejolly -c defaults -c conda-forge pymer4
    • Did not work
  2. conda create --name test_env2 -c ejolly -c conda-forge -c defaults pymer4
    • Did not work
  3. conda create --name test_env3 -c ejolly/label/pre-release -c defaults -c conda-forge pymer4
    • Did not work
  4. conda create --name test_env4 -c ejolly/label/pre-release -c conda-forge -c defaults pymer4
    • Did not work

Please provide the following information

1. Description

After creating a Pymer4 Lmer model, it fails becuase of :

RRuntimeError: Error in initializePtr() : 
  function 'chm_factor_ldetL2' not provided by package 'Matrix'
     active environment : pymer4
      active env location : /Users/~/miniconda3/envs/pymer4
                     shell level : 4
            user config file : /Users/~/.condarc
populated config files : /Users/~/.condarc
             conda version : 24.1.2
   conda-build version : not installed
            python version : 3.11.7.final.0
                           solver : libmamba (default)
          virtual packages : __archspec=1=m1
                                         __conda=24.1.2=0
                                         __osx=14.4=0
                                        __unix=0=0
       base environment : /Users/noah/miniconda3  (writable)
        conda av data dir : /Users/noah/miniconda3/etc/conda
conda av metadata url : None
               channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                                          https://conda.anaconda.org/conda-forge/noarch
                                          https://repo.anaconda.com/pkgs/main/osx-arm64
                                          https://repo.anaconda.com/pkgs/main/noarch
                                          https://repo.anaconda.com/pkgs/r/osx-arm64
                                          https://repo.anaconda.com/pkgs/r/noarch
             package cache : /Users/~/miniconda3/pkgs
                        platform : osx-arm64
                    user-agent : conda/24.1.2 requests/2.31.0 CPython/3.11.7 Darwin/23.4.0 OSX/14.4 solver/libmamba conda-libmamba- 
                                            solver/23.12.0 libmambapy/1.5.3
                         UID:GID : 501:20
                        netrc file : None
                  offline mode : False

2. Minimal reproducible example

These are the shortest steps that reconstruct the problem.

I'm trying to fit a linear mixed effect model. I tried this in both jupyter lab and spyder, both were installed in the same line as conda create --name...., so they followed the same channel priority as the installation of pymer. I tried the following code:

from pymer4.models import Lmer
import pandas as pd

df = pd.read_pickle('df.pkl')

mod = Lmer('Width~ TreatCntrl*PrePost+(1|Trail)', data = df)
print(mod.fit())

In both cases, I get the following error:

RRuntimeError: Error in initializePtr() : 
  function 'chm_factor_ldetL2' not provided by package 'Matrix'

I presume this is coming from the r-matrix package which according to the conda environment is as follows:

r-matrix                  1.6_5             r42hb447869_0    conda-forge

My only suspicion is that this relates to the fact that I'm using an M1 Mac. I saw that you have previously resolved an issue with the M1 and no arch - Issue #38 , but perhaps this is something new? Here is some information about the conda environment pymer4 is installed in.

3. Conda environment

Activate the conda environment that has pymer4 installed, run the following command in a terminal window, and upload the pymer4_issue.txt file as an attachment with your issue.

conda list --explicit > pymer4_issue.txt

pymer4_issue.txt

4. System information

Please provide the specifics about your computer hardware architecture and operating system version. For example:

    $ uname -mprsv
Darwin 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:06 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T8103 arm64 arm

    $ sw_vers
ProductName:        macOS
ProductVersion:     14.4
BuildVersion:       23E214
Shotgunosine commented 6 months ago

I just hit this issue myself on an intel mac. Try this: conda create --name test -c ejolly -c conda-forge -c defaults pymer4 r-matrix=1.5-3

Seems related to this issue: https://github.com/lme4/lme4/issues/763