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

Example notebooks don't work, at least on a 2023 Macbook pro #96

Open
westb2 opened this issue Jul 30, 2024 · 1 comment
Open

Example notebooks don't work, at least on a 2023 Macbook pro #96

westb2 opened this issue Jul 30, 2024 · 1 comment

Comments

@westb2
Copy link

westb2 commented Jul 30, 2024

When running the example notebooks I get the following error

Cell code that gives error has the code:
mask_solid_paths = st.write_mask_solid(mask=mask, grid=grid, write_dir=static_write_dir)

Error is

CalledProcessError                        Traceback (most recent call last)
File /opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:340, in write_mask_solid(mask, grid, write_dir)
    [339](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:339) try:
--> [340](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:340)     subprocess.run(
    [341](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:341)         [
    [342](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:342)             script_path,
    [343](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:343)             "--mask",
    [344](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:344)             mask_path,
    [345](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:345)             "--pfsol",
    [346](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:346)             solid_path,
    [347](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:347)             "--vtk",
    [348](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:348)             mask_vtk_path,
    [349](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:349)             "--z-bottom",
    [350](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:350)             str(CONUS_Z_BOTTOM),
    [351](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:351)             "--z-top",
    [352](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:352)             str(z_top),
    [353](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:353)         ],
    [354](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:354)         check=True,
    [355](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:355)         capture_output=True,
    [356](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:356)     )
    [357](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:357) except subprocess.CalledProcessError as e:

File /opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:571, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    [570](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:570)     if check and retcode:
--> [571](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:571)         raise CalledProcessError(retcode, process.args,
    [572](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:572)                                  output=stdout, stderr=stderr)
    [573](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:573) return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['/Users/ben/parflow_installation/parflow/bin/pfmask-to-pfsol', '--mask', '/Users/ben/subsettools_tutorial/inputs/conus1_upper_verde_conus1_2005WY/static/mask.pfb', '--pfsol', '/Users/ben/subsettools_tutorial/inputs/conus1_upper_verde_conus1_2005WY/static/solidfile.pfsol', '--vtk', '/Users/ben/subsettools_tutorial/inputs/conus1_upper_verde_conus1_2005WY/static/mask_vtk.vtk', '--z-bottom', '0', '--z-top', '500']' died with <Signals.SIGABRT: 6>.

During handling of the above exception, another exception occurred:

CalledProcessError                        Traceback (most recent call last)
    [... skipping hidden 1 frame]

Cell In[35], [line 1](vscode-notebook-cell:?execution_count=35&line=1)
----> [1](vscode-notebook-cell:?execution_count=35&line=1) mask_solid_paths = st.write_mask_solid(mask=mask, grid=grid, write_dir=static_write_dir)

File /opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:358, in write_mask_solid(mask, grid, write_dir)
    [357](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:357) except subprocess.CalledProcessError as e:
--> [358](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:358)     raise subprocess.CalledProcessError("pfmask-to-pfsol error:", e.stderr)
    [360](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/site-packages/subsettools/domain.py:360) print(f"Wrote solidfile and mask_vtk with total z of {z_top} meters")

<class 'str'>: (<class 'TypeError'>, TypeError("'<' not supported between instances of 'str' and 'int'"))
...
    [141](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:141)         try:
    [142](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:142)             return "Command '%s' died with %r." % (
    [143](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/envs/test-env/lib/python3.11/subprocess.py:143)                     self.cmd, signal.Signals(-self.returncode))

TypeError: '<' not supported between instances of 'str' and 'int'```
@westb2
Copy link
Author

westb2 commented Aug 2, 2024

As an update, the actual exception that pf-mask-to-pfsol is throwing is:

b"dyld[2241]: Library not loaded: @rpath/libpftools.dylib\n Referenced from: <9D55BCC4-B866-3AD1-8CC5-7C9A5E78E6F3> [/Users/ben/parflow_installation/parflow/bin/pfmask-to-pfsol](https://file+.vscode-resource.vscode-cdn.net/Users/ben/parflow_installation/parflow/bin/pfmask-to-pfsol)\n Reason: tried: '/usr/local/lib/libpftools.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libpftools.dylib' (no such file), '/usr/local/lib/libpftools.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libpftools.dylib' (no such file), '/usr/local/lib/libpftools.dylib' (no such file), '/usr/lib/libpftools.dylib' (no such file, not in dyld cache)\n"

This exception was being masked because there was a python error being thrown when trying to handle it.

I was able to fix this by creating a symbolic link within /usr/local/lib to the location my libpftools got installed to. For me this looked like

sudo ln -s ~/parflow_installation/parflow/bin/libpftools.dylib /usr/local/lib/libpftools.dylib

I don't imagine this is the best long term solution. During my parflow install I was careful to set all the required environment variables. Perhaps I missed a step, or perhaps something about the build needs to be updated to support dylib cache linking on newer macs.

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

No branches or pull requests

1 participant