BradyAJohnston / MolecularNodes

Toolbox for molecular animations in Blender, powered by Geometry Nodes.
https://bradyajohnston.github.io/MolecularNodes/
GNU General Public License v3.0
902 stars 83 forks source link

MDAnalysis unavailable error #24

Closed soviete closed 1 year ago

soviete commented 2 years ago

I keep getting "Error: MDAnalysis Unavaiable" despite having MDanalysis installed. I just followed the instructions, and installed:

However, I keep getting the error "MDAnalysis Unavaiable" (I obtain the path from import MDAnalysis as mda; mda.__path__)

markahix commented 2 years ago

Sorry, should've been more clear! It's not recognizing MDAnalysis despite having the path correct. When I open an interactive python session and import MDAnalysis, it works fine.

BradyAJohnston commented 2 years ago

When you click the Check MDAnalysis Installation button, is there an error that pops up? Can you open the console by going Window -> Toggle System Console and see what error messages are popping up in there. WIthout specific error messages I can't really help.

markahix commented 2 years ago

Clicking the red "Check Installation" button returns a hovering tooltip under the mouse which reads: "ReportError: MDAnalysis Unavailable".

In the python console under the scripting tab, I get only "MDAnalysis Unavailable"

Somehow, I feel like Blender isn't giving me much to go on with errors.

BradyAJohnston commented 2 years ago

I am unsure how to get the proper console output on Linux, can you please either go Window -> Toggle System Console or if that isn't an option (isn't on Mac, is on Windows) start Blender from a terminal which will enable the terminal output and more verbose error logging. Then try the check installation button and report the errors that you get.

asandweiss commented 2 years ago

Was having the same issue as many people above, I tried installing on both python and conda, no luck. Tried all the tricks listed, still said "MDAnalysis Unavailable." Then I restarted my computer... The path that previously didn't work was still in Blender, I clicked check and it worked. Sometimes it's a good ol' fashion reset that does the trick. Anyway, many thanks!

recombinatrix commented 1 year ago

Right. Same issue as above. It's proving quite intractable.

Running on an M1 mac with MacOS 12.2.1 Download blender for apple silicon (blender-3.3.1-macos-arm64) Already have a working conda environment with mdanalysis in python 3.9 Set up a conda environment with MDAnalysis in python 3.10, just for Blender:

conda create -n Blender python=3.10
conda install numpy pandas cython MDAnalysis

Activate this environment. Test this MDAnalysis installation works by rerunning some RMSD calculations on large trajectories; it works fine.

Launch blender from terminal. Install molecular_nodes_0.13.0 Install Atomium Try to provide path to MDAnalysis installation. I try the path to the blender specific installtion, and to my working python nine installation, with and without training slashes. All fail; only terminal message is Error: MDAnalysis Unavaiable

Run the first diagnostic script you provided above:

import sys
import os
import site

# path to python.exe
python_exe = os.path.realpath(sys.executable)

def verify_user_sitepackages(package_location):

    if os.path.exists(package_location) and package_location not in sys.path:
        sys.path.append(package_location)

verify_user_sitepackages(site.getusersitepackages())
verify_user_sitepackages('/.local/lib/python3.10/site-packages')

import MDAnalysis as mda
print("succesfully imported")

output:

Error: Python: Traceback (most recent call last):
  File "/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/util.py", line 219, in <module>
    from ._cutil import unique_int_1d
ImportError: dlopen(/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/_cutil.cpython-310-darwin.so, 0x0002): tried: '/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/_cutil.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/_cutil.cpython-310-darwin.so' (no such file)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Text", line 19, in <module>
  File "/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/__init__.py", line 191, in <module>
    from .lib import log
  File "/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/__init__.py", line 34, in <module>
    from . import transformations
  File "/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/transformations.py", line 173, in <module>
    from .mdamath import angle as vecangle
  File "/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/mdamath.py", line 63, in <module>
    from . import util
  File "/Users/ada/opt/anaconda3/envs/Blender/lib/python3.10/site-packages/MDAnalysis/lib/util.py", line 221, in <module>
    raise ImportError("MDAnalysis not installed properly. "
ImportError: MDAnalysis not installed properly. This can happen if your C extensions have not been built.

It seems like there's a problem with cython. That is extremely weird to me, given that MDAnalysis works normally for actual MD Analysis, which I would expect to require c libraries. I wonder if Blender python isn't playing well with apple silicon + conda

recombinatrix commented 1 year ago

Additionally, there's a typo in the terminal error message when I try and fail to provide a path to MDAnalysis in the MolecularNodes preferences; the error message in the terminal and the error report reads Error: MDAnalysis Unavaiable (no L in unavailable).

That's quite trivial but I mention it in case it's useful for identifying source of the problem.

(Please never read my code it is full of typos)

BradyAJohnston commented 1 year ago

Thanks for the error reports! I'm currently in the middle of a complete re-write of Molecular Nodes which will hopefully help with some of the issues that people are getting (and fix a bunch of the typos ha).

I haven't got access to apple silicon (one day..). Blender does seem to be missing some C headers which is why it's hard / impossible to install MDAnalysis into Blender's python natively - although so far the issue has been solved with the linking to the external conda environment.

Are you able to trial this on another computer by any chance? If it succeeds on another computer, maybe a reinstall of Blender? I currently can't think other methods for troubleshooting.

I know others have installed Molecular Nodes on M1 macs but I don't know if anyone has done the MDAnalysis linking.

recombinatrix commented 1 year ago

So, I did a fresh install of Blender today on my apple silicon mac and my ubuntu desktop. A bit of tweaking got ubuntu working, but so far the mac has refused to work across three separate installs.

I'll see if I can come up with a solution following something silimar to RobertArbon's comment above, but otherwise I suspect this one might need to wait a bit.

Happy to run tests and/or generate error reports on apple silicon if that's useful, and I appreciate all your work.

BradyAJohnston commented 1 year ago

Thanks! Glad at least the desktop is working.

I'll hopefully have a the refactored version ready for public testing next week, and if the issues aren't fixed then we can do some deeper dives into troubleshooting.

famrein commented 1 year ago

I can't install MDAnalysis on windows. It says I need numpy but I already have it... I don't know where it's searching for numpy, but it definitely isn't finding it.

image

EDIT: downgrading to python 3.10 solved everything

BradyAJohnston commented 1 year ago

Hi @famrein, thanks for the error report (and the fix!), glad it's all working now!

I've got a completely re-written version of MN coming in the next week or so, which should hopefully make this installation process easier as well once Blender 3.4 is out.

BradyAJohnston commented 1 year ago

I have now published MolecularNodes 2.0 which should hopefully fix issues that people are having with installation on MDAnalysis (should now be a 1-click install).

At least it has fixed it on my machines which would otherwise require multi-step installation. If people in this thread who have had trouble could test it out and let me know if the installation goes smoothly, that would be very much appreciated!

BradyAJohnston commented 1 year ago

I am going to be closing this issue, as it seems to be mostly resolved for Linux users from what I can tell, there is now only an issue with M1 / M2 macs which is tracked in #108 and #111