Open bbarad opened 2 years ago
https://github.com/cnr-isti-vclab/PyMeshLab/issues/167 - Associated pymeshlab issue with ongoing work being done
FYI: My work laptop is an M1 Mac, I'd be very happy to help you test stuff out.,
I saw https://github.com/cnr-isti-vclab/PyMeshLab/issues/167 but wasn't able to figure out how to build or install pymeshlab when I tried it yesterday. Perhaps with a bit more effort, it might work.
If you ever want to do some pair programming, that could work. It looks like your institution is the Scripps Research Institute, located in California. Late afternoon there should overlap with mornings here in Melbourne Australia. Screen sharing and/or VSCode live share works pretty well for remote collaboration.
I hadn't seen that there is a working build for m1 now! I was planning to solve this with #10 but have been sidetracked with feature additions for response to review (mostly new statistics tools)!
I suspect you will have better judgment than me on this - do you think getting native install (for this and for #7) working is the better route than the container? If so, I'd be happy to do some pair programming next week - I don't have an m1 so I can't easily test but I am not gonna be on the microscope at all next week so its an ideal time for some programming!
There are two days next week that are good for me:
I should have your email address, you've emailed me before. I'll send you a zoom link.
I suspect you will have better judgment than me on this - do you think getting native install (for this and for https://github.com/GrotjahnLab/surface_morphometrics/issues/7) working is the better route than the container?
I do not have a sense of which way is likely to be the easiest. Perhaps we'll have a bit more of an idea after next week?
Email sent!
Ben and I got this working today. Here's a copy of the notes we made (we'll need to write these up nicely and make a PR to add them to the docs):
Issue: M1 Mac installation
Build the conda environment like normal, but don't pip install pymeshlab - just remove it from the pip_requirements.txt file
Install pyqt into your conda environment: For M1 Macs, the andfoy conda channel has a working pyqt build:
conda install pyqt -c andfoy
Build pymeshlab https://github.com/cnr-isti-vclab/PyMeshLab/blob/main/src/README.md
brew install libomp cgal xerces-c
git clone --recursive https://github.com/cnr-isti-vclab/PyMeshLab.git
cd PyMeshLab
# Build pymeshlab
mkdir src/build
cd src/build
cmake ..
make
make install
KMP_DUPLICATE_LIB_OK
environment variable
This prevents libomp errors.
You can use conda to permanently set an environment variable in the morphometrics conda environment:
conda activate morphometrics
conda env config vars set KMP_DUPLICATE_LIB_OK=TRUE
conda deactivate conda activate morphometrics conda env config vars list
4. Check the build worked:
```bash
python -m pip install pytest
python -m pytest --pyargs pymeshlab
Install pymeshlab to the conda environment:
pip install .
You're ready to go! Try running the surface-morphometrics scripts on the example data. See the README for more details.
Good news! There is a pyqt build for M1 macs now available through conda-forge link.
So we can just do
conda install pyqt -c conda-forge
...instead of using -c andfoy
instead of conda-forge (andfoy is a more experimental development channel, I'm given to understand)
Irritatingly, the conda environment file throws up a lot of conflicts (even without me editing it to try and include pyqt, etc.) It's super odd, because when I make an empty conda environment, with just python 3.9, I can install all the dependencies into that one by one. Just not all at once with the environment.yml file.
EDIT: I've figured out that if we relax the pinning of the python version (eg: use python=3.9
instead of python=3.9.0
) then that's enough to fix this problem.
Note: there are two build scripts for pymeshlab (as an alternative to the make commands)
We found that if you use those on an M1 mac, you should edit the file first.
Modify build script (scripts/macOS/1_build.sh) line 77, with custom qt dir and remove -DBUILD_DUMMY_BIN_MAC_DEPLOY flag.` Then you can run:
sh scripts/macOS/1_build.sh sh scripts/macOS/2_deploy.sh
We ended up running into segfaults with these build scripts I believe? Were you able to go back and get them working?
Oh yes, you're right. I remember now, the build scripts seemed like they worked, but then when we tried to import pymeshlab it would segfault. No, we didn't stop to work out why. We just moved to using the make install commands instead, since that did work.
Thanks for prompting me to include all the details, I would definitely have forgotten parts of this otherwise.
I am inclined to leave this open until we get confirmation from 1 more user that these instructions worked, then I'll convert to a documentation file with any extra details needed and close this out.
I was able to get the pymesh installation done without any errors but when I run python segmentation_to_meshes.py config.yml I ger the following error :
File "/opt/homebrew/Caskroom/miniforge/base/envs/morphometrics/lib/python3.9/site-packages/pymeshlab/init.py", line 11, in
When I pytest --pyargs pymeshlab in the disturb directory I got several similar errors
____ ERROR collecting tests/test_ambient_occlusion.py ____
ImportError while importing test module '/opt/homebrew/Caskroom/miniforge/base/envs/morphometrics/lib/python3.9/site-packages/pymeshlab/tests/test_ambient_occlusion.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Caskroom/miniforge/base/envs/morphometrics/lib/python3.9/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
/opt/homebrew/Caskroom/miniforge/base/envs/morphometrics/lib/python3.9/site-packages/pymeshlab/init.py:11: in
Any help would be really appreciated. Thanks in advance
I am getting exactly the same error as akas0018 above with my Macbook Pro M2.
Bumping the cry for help!!! I tried trawling the internet for solutions to no avail.
Pymeshlab fails to run on m1 macs, as builds are only being tested on x86_64. We should evaluate workarounds but I don't have an m1 mac so I can't do much testing...