Closed PlethoraChutney closed 10 months ago
@PlethoraChutney Well if you already have a global Python3.10, whether it was installed via brew or conda, you may create any new directory and run pip wheel
into it.
The wheel file shall be downloaded and built.
I guess gcc is still required for running a wheel buiding from source code contains C files.
mkdir MN_wheels;
cd MN_wheels;
pip3.10 wheel MDAnalysis==2.2.0 --cache-dir .
Then all the wheels will be appeared.
OK, got that installed. I also had to install cython or the build would fail, so here's the steps to recreate:
conda create -n wheel-builder python=3.10 cython
conda activate wheel-builder
python -m pip wheel MDAnalysis==2.2.0 --cache-dir .
Now, sorry to be a little computer baby, but how do I convince blender to use this wheel?
@PlethoraChutney Great, then you can walk down to the Blender-bundled-python directory, generally it would be like /Applications/Blender.app/Contents/Resources/3.4/python/bin
, and run pip install ./python3.10 -m pip install <wheel>
.
I am not sure whether the wheel
is required by this pip install or not.
If this is works, we can maybe ship the wheel built on your ARM machine as an apple M1 / M2 specific install. At least until the next release of MDAnalysis which might also fix the issue with supplying wheels on PyPi.
Await is all we need. 🤣 It should be fine to just pin the version as 2.5.0 after it's released.
After failing to get MolecularNodes installed on my M1 machine (symptom was that blender wouldn't open after symlinking a conda env with biotite & MDA) I came to this thread.
Can confirm rebuilding the wheels worked for me!
mkdir ~/biotite-wheel
conda create -n wheel-builder python=3.10 cython
conda activate wheel-builder
python -m pip wheel biotite==0.35.0 --cache-dir .
conda deactivate
cd /Applications/Blender.app/Contents/Resources/3.4/python/bin
./python3.10 -m pip install biotite --cache-dir ~/biotite-wheel
I did the same thing for MDA but I haven't tested it, but can confirm biotite works and I can import structures.
I just tried the Covid spike protein example and I can confirm that MDA works using the same procedure.
@evanbunnage thanks so much for the details! Exciting that this is working. This seems like it will be a more robust fix for the time being. I'll try and update the docs soon for installation instructions.
Great! I'm sure customized wheel building should work better bcs of higher compatibility with one's own machine. Before the 2.5.0 official wheel release of MDA, this can be a solid fix. BTW, biotite has an official wheel at 0.36.0 so we can set it in requirements.txt for the fix too.
I was still having issues with Blender finding python.h after trying the current proposed solution, but I'm not at all knowledgeable about computer science, so I thought I would ask GPT4 to help so that I could provide more than a problem, and I actually found a working solution. Let me know if this works for anyone else still having issues.
Everything seemed to resolve on the attempt where GPT4 suggested this command cd /Applications/Blender.app/Contents/Resources/3.4/python/include/python3.10 ln -s ../../Python.framework/Versions/3.10/Headers/ Python.h
after building the wheels. Again, I know almost nothing about how these things work, just throwing this out there in case it could save someone's career.
It also took me an embarrassing amount of time to realize I had to add the --user option to the final install command.
Let me know if this helps anyone!
FWIW, I just cloned the master branch, zipped up the MolecularNodes folder, installed it, closed out of blender, opened blender, clicked install biotite, waited, closed out of blender, and opened it again and it appears to work fine.
Edit: M1 mac, not using any MD related stuff. Edit2: Installed blender 3.5, was able to install MolecularNodes ezpz no closing of Blender needed.
The method from @evanbunnage which is also in the documentation didn't work for me because of the Python.h issue for MDAnalysis. I resolved it by getting the header libraries from the official Python page for the version of Python which ships with Blender (3.10.9, for Blender 3.5). Unfortunately, if Blender is installed in either /Applications
or $HOME/Applications/
, Apple's System Integrity Protection prevents you from copying the contents of the Include
directory from the downloaded version of Python, so you have to copy the whole Blender directory somewhere else, copy the include directory, then move Blender back.
I can then install MDA from the cached wheel and import it from Blender's internal Python console, but Molecular Nodes cannot see MDA and says its not installed.
I'm on an M1 Mac running Blender 3.5.
Hi @ErikPoppleton this is an interesting one. It might be that there is a version mismatch for MDAnalysis. If you can import it via the python console inside of Blender then it should be available to MolecularNodes. What version do you get with the below. MolecularNodes is currently expecting 2.2.0
exactly.
MDA.__version__
Yes! The version was 2.4.3. Downloading and caching specifically 2.2.0 fixed the problem and Molecular Nodes now sees MDA as installed. Thanks!
MDAnalysis has just released 2.5.0
which includes pre-built .whl
for M1 / M2 macs, which should HOPEFULLY fix the installation error that has been plaguing us for so long. It should now just be a single-button click from inside of Blender like all of the other packages rather than the complicated install using conda environments.
I don't have an apple silicon machine to test. I have created a potential new release which requests the new MDAnalysis. Can people please try this out? If possible on a fresh installation of Blender. If not a fresh installation, please ensure you restart Blender after clicking 'install' button.
https://github.com/BradyAJohnston/MolecularNodes/releases/tag/v2.7.1_beta
@BradyAJohnston I tried the new MolecularNodes install with a fresh blender install. I get the following error when I try the MDAnalysis install.
bpy.ops.mol.install_package(package="MDAnalysis", version="2.5.0", description="Install required python package: MDAnalysis")
Error installing package. Please check the log files in '/Users/lucasmorley/Library/Application Support/Blender/3.5/scripts/addons/MolecularNodes/logs'.
Some of the stuff in side-packages-install.log is:
INFO:root:Running Pip: '['/Applications/Blender.app/Contents/Resources/3.5/python/bin/python3.10', '-m', 'pip', 'install', 'MDAnalysis==2.5.0']'
ERROR:root:Command failed: ['/Applications/Blender.app/Contents/Resources/3.5/python/bin/python3.10', '-m', 'pip', 'install', 'MDAnalysis==2.5.0']
ERROR:root:stdout: Collecting MDAnalysis==2.5.0
Using cached MDAnalysis-2.5.0-cp310-cp310-macosx_11_0_arm64.whl (3.3 MB)
...
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/brecht/dev/build_darwin/deps/Release/sqlite/include -I/Users/brecht/dev/build_darwin/deps/Release/bzip2/include -I/Users/brecht/dev/build_darwin/deps/Release/lzma/include -I/Users/brecht/dev/build_darwin/deps/Release/zlib/include -mmacosx-version-min=11.00 -arch arm64 -mmacosx-version-min=11.00 -arch arm64 -I/Applications/Blender.app/Contents/Resources/3.5/python/include/p
ython3.10 -c Bio/Align/_aligners.c -o build/temp.macosx-11.00-arm64-cpython-310/Bio/Align/_aligners.o
Bio/Align/_aligners.c:11:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for biopython
ERROR: Could not build wheels for biopython, which is required to install pyproject.toml-based projects
These look like the same errors as before, but I am pretty confident I did it correctly.
(To be fair, the previous caching solution also never worked for me and I had the same error so maybe something on my end)
Thanks @Luc1100 for the details. Yours works otherwise by creating and linking the conda environment still?
Actually @Luc1100 it seems that the error is with the biopython
install itself. I just had a look at the biopython pypi page and it looks like there isn't a MacOS ARM build.... looks like we will have the same issue ðŸ«
@BradyAJohnston much sadness :( and my linking of the conda environment broke when I updated to MacOS 13 because there are some weird permissions I cannot figure out.
Any solution to fixing the biopython install?
@mhbokhari using the workaround that is currently in the documentation should still work (docs) as it is basically the same issue as it was previously unfortunately
@BradyAJohnston I still get the following error message when I try out the workaround in the documentation;
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for biopython
Failed to build biopython
ERROR: Could not build wheels for biopython, which is required to install pyproject.toml-based projects
Im using M1 with 12.5 Montrey
@mhbokhari I would need more of the earlier part of the error message to help try and debug at all, the final part that you've given doesn't provide much information to work with. There are a number of other potential fixes in this thread that seem to work / not work for various people on various machines.
I would suggest trying some of those, and if it still isn't working include more of the error messages in another comment. You can include code
formatted text by doing three backticks and it will format it more nicely
error message goes here
The biopython
devs are happy to add a .whl so this should hopefully fix another dependency issue.
As I don't have an M1/2 mac I can't check for myself, is anyone able to try and see if any of the other dependencies are also lacking a .whl
that we can try and get one for? Might be getting close to it finally working 🥹
Here is an optimized solution of MN package installation for Mac on M1/M2 Apple Silicon :
- Make sure your Blender is built on apple silicon version and MN has already installed.
- Check if you have already install
python@3.10
viaconda
orhomebrew
:which python3.10
orbrew list python@3.10
. If yes, go tostep 6
.- Install
miniconda
oranaconda
on ARM version.- Create a new conda env containing python3.10:
conda create -n py310 python=3.10 -y
- Activate it:
conda activate py310
- walk to the build-in python binary dir of blender:
cd /Applications/Blender.app/Contents/Resources/3.4/python/bin
run pip with a CPATH anoucement:
CPATH=$CPATH:$(python3.10-config --include | sed -E 's/ ?-I/:/g') ./pip3.10 install MDAnalysis==2.2.0
To install the exactly pinned version of required packages in
requirements.txt
, please use the following instead:CPATH=$CPATH:$(python3.10-config --include | sed -E 's/ ?-I/:/g') ./pip3.10 install -r "/Users/$(whoami)/Library/Application Support/Blender/3.4/scripts/addons/MolecularNodes/requirements.txt"
This worked for me!
Thanks @mhbokhari , just had to copy/paste that last line and everything is working perfectly!
Attempted to follow steps for @mhbokhari , however, pip3.10 does not seem to be in that directory with blender 3.5.1. When I move into the directory of "/Applications/Blender.app/Contents/Resources/3.5/python/bin", pip310 is not there. Only see "python3.10" in that directory. I have the conda env created and activated but CPATH step is getting an error saying "zsh: no such file or directory: ./pip3.10".
I previously had MolNodes working in a python env with conda but updated and broke what I was doing.
I didn't have to do the above step with Blender 3.5.0 and MolNodes 2.7.4. Happy to continue to help, have a bit more time this summer. Excited for the Ribbon structure update @BradyAJohnston
@Aseamann does your last message mean that it is now working in Blender 3.5.0 / MN 2.7.4? Happy for any help you would like to offer. Feel free to open separate issues / PRs to discuss particular topics.
@BradyAJohnston Correct, with 3.5.0 I didn't have to mess with the python environment at all. However, I attempted with Blender 3.5.1 and it did not, I was unable to see the properties title in the "add-ons" menu under MN to install the packages.
@Aseamann upgrading can be weird sometimes. I would uninstall MN from 3.5.0, uninstall and reinstall 3.5.1, then reinstall MN and see if that helps.
Attempted to follow steps for @mhbokhari , however, pip3.10 does not seem to be in that directory with blender 3.5.1. When I move into the directory of "/Applications/Blender.app/Contents/Resources/3.5/python/bin", pip310 is not there. Only see "python3.10" in that directory. I have the conda env created and activated but CPATH step is getting an error saying "zsh: no such file or directory: ./pip3.10".
I previously had MolNodes working in a python env with conda but updated and broke what I was doing.
WOW that is weird! I installed latest Blender and MN and ./pip3.10
will be created only after the ./python3.10 -m ensurepip
and ./python3.10 -m pip install pip --upgrade
commands are executed../pip3.10
just disapears! you may use ./python3.10 -m pip
instead.
For a detailed implementation, you may see this outdated installer script hahaha: https://github.com/YaoYinYing/MolecularNodes/blob/ARM-mac-installer/MolecularNodes/troubleshoot/InstallDependencies_M1.sh
However, please note that using this script may potentially cause issues with your Python/pip linking. So proceed with caution and make sure to handle it carefully.
Hi all, I had some issues to install MolecularNodes 2.7.4 under Blender3.6.0 on a MacBook Pro M1. I found a workaround and I wanted to share my workflow here, in case somebody else has similar troubles:
Under macOS (Ventura 13.4) I could not simply copy the header files to Blender's Python distribution. Hence I did the following:
I am happy to get your feedback about my suggestions and I hope I can help somebody! Cheers, Marius
Hi @m-a-r-i-u-s, thanks for the details! Good to have more examples of things that work for different people. I'm still not sure why the ./python3.10 -m pip install MDAnalysis --cache-dir ~/MDAnalysis-wheel
would complain about missing headers. It should not be trying to use Blender's python, it should be using the conda environment's python which should have the required headers, but that error seems to say that it is attempting to use Blender's python.
Another solution should be just ensuring that you are definitely using the newly created python environoment. If you are definitely using the conda environment & it's installed python, but still getting the header error, then that is a problem with the conda environment.
Hi, I'm using M1 Monterey 12.4 with Blender 3.6.1 and I had the same problem. In my case, after doing the @mhbokhari workaround the problem persisted, so I installed directly MDAnalysis (not the cached .whl
):
./python3.10 -m pip install MDAnalysis
And it works, I'm not sure why, and probably it's not the best practice.
Hi I've followed the installation guide for M1/M2 installing from pip doesn't return any errors. I can also import MDA from the builtin python in Blender started from the terminal but not from the console run from Scripting tab!
From the molecular node add-in in preferences the button is styll deactivated and seems that it doesn't detect the installation. Is this a known issue?
When I try to import a .cif file from the molecularnode tab I obtain
Hi @MarcoVando, it seems there are two different issues here.
.cif
Files: Can you please open a new issue regarding the opening of the .cif
files as that doesn't involve MDA. When you open the .cif
can you try and include an example file that doesn't work and any additional details that could help with debugging.
MDA Installation: Can you please report Blender version, Molecular Nodes version, more details about your mac, what you have tried in terms of installation, as currently there are not many details to go on.
For those who have been having trouble with the installation instructions on the website, I have realised that it might be because the last step that installs from the cache doesn't specify the version to install, which sometimes seems to install the more recent versions from pip which are higher and it's not detected when installed. I will update the documentation, but specifying the specific version may also help with installation issues.
./python3.10 -m pip install MDAnalysis --cache-dir ~/MDAnalysis-wheel
./python3.10 -m pip install MDAnalysis==2.5.0 --cache-dir ~/MDAnalysis-wheel
This solved my installation problem. Now also blender recognize MDA package as installed. I can also import structure form pdb databse
There should now be a version that is no longer problematic to install on macOS ARM machines. If people in this thread could please try it out by downloading it from the PR #400 and try it out installing.
If others report back that it's working, then I can move it into main and this saga can finally come to an end.
Hi @BradyAJohnston,
I was able to download MDAnalysis through the plugin page successfully. However, when I try to load a trajectory I get the following error:
Python: Traceback (most recent call last):
File "/Users/lmorley/Library/Application Support/Blender/3.6/scripts/addons/molecularnodes/io/md.py", line 131, in execute
mol, universe = load(
File "/Users/lmorley/Library/Application Support/Blender/3.6/scripts/addons/molecularnodes/io/md.py", line 99, in load
mol = session.show(atoms=universe,
File "/Users/lmorley/Library/Application Support/Blender/3.6/scripts/addons/molecularnodes/io/mda.py", line 534, in show
mol_object = self._process_atomgroup(
File "/Users/lmorley/Library/Application Support/Blender/3.6/scripts/addons/molecularnodes/io/mda.py", line 774, in _process_atomgroup
nodes.create_starting_node_tree(
File "/Users/lmorley/Library/Application Support/Blender/3.6/scripts/addons/molecularnodes/blender/nodes.py", line 388, in create_starting_node_tree
group = new_group(name)
File "/Users/lmorley/Library/Application Support/Blender/3.6/scripts/addons/molecularnodes/blender/nodes.py", line 229, in new_group
group.interface.new_socket('Geometry', in_out='INPUT', socket_type='NodeSocketGeometry')
AttributeError: 'GeometryNodeTree' object has no attribute 'interface'
@Luc1100 that looks like you might be on a 3.X version of Blender, but the latest MN requires 4.0+.
@BradyAJohnston oops my bad. New error though, unsure if it something I am doing:
Python: Traceback (most recent call last):
File "/Users/lmorley/Library/Application Support/Blender/4.0/scripts/addons/molecularnodes/io/md.py", line 131, in execute
mol, universe = load(
File "/Users/lmorley/Library/Application Support/Blender/4.0/scripts/addons/molecularnodes/io/md.py", line 89, in load
universe = mda.Universe(top, traj)
TypeError: MockUniverse() takes no arguments
@Luc1100 after install try restarting Blender and see if that error goes away.
@BradyAJohnston that fixed it 🙌
Hi Brady! Excited to play with the new features, and maybe finally dip my toes into contributing!
Unfortunately, trying to install the required packages using this button in blender:
results in an error message reading:
The contents of that log file are:
System Info
Steps already taken