Closed soviete closed 1 year ago
Can you share a screenshot of the preferences panel, and the path for for the MDA installation? Any more info about your python installation etc.
Sure, thanks for the prompt response. The path is ~/.local/lib/python3.10/site-packages and I am sharing a screenshot of the preferences panel
Hmm there isn't anything immediately wrong that I can see. I assume something just isn't working about the path.
Can you try running this inside of Blender's script editor and seeing if it works?
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")
Could you try also maybe adding another forward slash to the end of the path inside of the package directory?
Blender seems to weird about wanting / not wanting those slashes at the end.
Output below:
Read prefs: /home/soviet/.config/blender/3.1/config/userpref.blend
Traceback (most recent call last):
File "/Text", line 19, in
I double checked, and I do have the packaging module installed in python3.10 (i.e. 'Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (21.3)')
I also tried adding another forward slash to the end of the path without success
Same problem here
Hmm - do you have more information about your systems & python installations? I can't replicate the error myself. Might be worth trying a different python installation if possible?
@soviete you are also on linux, right? Debian-based? I'm on pop-os 22.04 personally
From the error it seems like the path is working (it's calling MDAnalysis) but it's not initiating because of the 'lack' of packaging
.
Can you try running this in your Blender script editor? It might be that your system python does have packaging
but Blender's bundled python doesn't have it accessible as it's also not on path.
import subprocess
import sys
import os
import site
# path to python.exe
python_exe = os.path.realpath(sys.executable)
# upgrade pip
subprocess.call([python_exe, "-m", "ensurepip"])
subprocess.call([python_exe, "-m", "pip", "install",
"--upgrade", "pip"], timeout=600)
# install required packages
subprocess.call([python_exe, "-m", "pip", "install", "packaging"], timeout=600)
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())
import MDAnalysis as mda
print("success!")
This worked, Brady, thanks a lot!
I'm glad this worked! Seems like it might be a Linux Blender distro issue. I will leave this issue open for now to see if others also have the same issue (if you are reading this and have the issue, and it was fixed, please comment!)).
Should be able to add a check for the packaging
package as well in a later release though :)
This fixed it for me, too. On the manual installation of the blender linux version.
hm, so the check for MDAnalysis new works, but the Open
and Import Frames
buttons on Local File
and MD Trajectory
remain grayed out with files selected to import.
Any idea for debugging this?
The buttons will remain greyed out until Blender detects file that exist. For some reason Blender has a hard time with relative paths, but also seems to use them places for some reason (inconsistently).
When selecting the path, ensure that relative path is unticked:
Thank you very much! I just tried it. Consider my mind blown!
Glad to see it's working!
Hi Brady, I have the same problem. I tried the above script it failed! The path is /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages
Hi @HebaMohamed88 are you able to provide more detail about what you mean when 'it failed'? Can you show screenshots of specific error messages, and provide the version of Blender, version of Molecular Nodes and OS you are working on?
Blender: 3.1.2 Molecular Nodes:0.5.20 OS:12.2.1 I installed python 3.10, python3 -m pip install MDAnalysis, import MDAnalysis as mda; mda.path copied the path /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/
I tried to run the above script inside of Blender's script editor output
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/MDAnalysis/__init__.py", line 211, in <module>
from . import converters
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/MDAnalysis/converters/__init__.py", line 35, in <module>
from . import ParmEd
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/MDAnalysis/converters/ParmEd.py", line 84, in <module>
from ..coordinates import base
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/MDAnalysis/coordinates/__init__.py", line 750, in <module>
from . import GSD
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/MDAnalysis/coordinates/GSD.py", line 55, in <module>
import gsd.fl
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/gsd/fl.cpython-310-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/gsd/fl.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/fl.cpython-310-darwin.so' (no such file)
@HebaMohamed88 it seems like there is compatibility in terms of architecture for your python installation.
tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/gsd/fl.cpython-310-darwin.so'
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
'/usr/lib/fl.cpython-310-darwin.so' (no such file)
How did you install your system Python? Are you on an M1 mac or an intel Mac?
Likely will need to try reinstalling your python, or maybe additionally reinstalling blender, to ensure everything is compatible with your system (arm64
if M1, x86_64
if an intel Mac).
Additionally, as per your screenshot, you currently have Molecular Nodes 0.5.15 installed, not 0.5.20. I recommend installing the latest build to get access to bug fixes.
Thanks Brady,
Im on M1 mac, installed Python 3 release from https://www.python.org/downloads/macos/ straightforward installation. Im trying to figure out the problem, I reinstalled both Python and blender with no advance. Thanks for your time. [https://www.python.org/static/opengraph-icon-200x200.png]https://www.python.org/downloads/macos/
Python Releases for macOS | Python.orghttps://www.python.org/downloads/macos/ The official home of the Python Programming Language www.python.org
From: Brady Johnston @.> Sent: Friday, 27 May 2022 3:29 PM To: BradyAJohnston/MolecularNodes @.> Cc: Hebatalla Ahmed Ibrahim Mohamed @.>; Mention @.> Subject: Re: [BradyAJohnston/MolecularNodes] MDAnalysis unavailable error (Issue #24)
CAUTION: External email. Only click on links or open attachments from trusted senders.
Additionally, as per your screenshot, you currently have Molecular Nodes 0.5.15 installed, not 0.5.20. I recommend installing the latest build to get access to bug fixes.
— Reply to this email directly, view it on GitHubhttps://github.com/BradyAJohnston/MolecularNodes/issues/24#issuecomment-1139307322, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZLQQF3JDG6NDTIY34XF4VLVMBQCJANCNFSM5WVJAKMQ. You are receiving this because you were mentioned.Message ID: @.***>
@HebaMohamed88 Can you try running this code inside of your python installation? Either as a script or line by line in the console. Might be that the MDAnalysis isn't installing properly.
import MDAnalysis as mda
pdb = mda.fetch_mmtf('4ozs')
print("Succesfully import mda")
Thanks Brady, the issue was I installed Blender the Intel version not apple silicon. It works, thank you so much.
Hi. Thanks Brady! I have had a similar problem on Linux. It was not able to locate fasteners package. I saw this was because it was in a different path (/usr/local/lib) as where I had MDAnalysis (/home/my_user/.local/...).
I have solved this by installing MDAnalysis inside a conda environment. I did this with miniconda3:
First I installed miniconda:
bash Miniconda3-latest-Linux-x86_64.sh
Then I created the environment:
conda create --name MDAnalysis conda activate MDAnalysis conda install -c conda-forge MDAnalysis
Then with
conda list
I checked I had also fasteners inside the environment
Then FInally I passed the conda environment path to blender (/home/my_user/miniconda3/envs/MDAnalysis/) and it worked
And now I am beggining my journey in blender, and it goes along MolecularNodes. Many thanks!
HI @ahenao thanks for the info! I’m assuming this is also on Linux? Seems that the Blender’s bundled Python on Linux is missing a few packages that the others have. I don’t have a Linux machine to test out fixes on but I will try out adding a call to install the missing packages along with atomium.
Hi Brady,
Have also an error in windows 11, when checking the MDAnalysis installation. I've downloaded and installed Python 3.10.5 (latest version), with Blender 3.2 and Molecular Nodes 0.8.1. I've installed MDAnalysis and found the path inside Python. When pasting the path inside the MDAnalysis path, I get an error: MDAnalysis Unavailable
I've tried:
Blender script editor output gives back a ModuleNotFoundError: No module named 'MDAnaysis'. So in a way blender can't access the installed MDAnalysis. Do you have any ideas?
Tnx in advance!
Sander
Hi @SanderEwen, thanks for reporting the error! Are you able to give a screenshot of / paste more of the error output from the python console when you try to click the 'Check MDAnalysis' button? Can you also share a screenshot of the properties panel where the path is pasted so I can see what it looks like.
Hi @SanderEwen, thanks for reporting the error! Are you able to give a screenshot of / paste more of the error output from the python console when you try to click the 'Check MDAnalysis' button? Can you also share a screenshot of the properties panel where the path is pasted so I can see what it looks like.
Thanks for your fast reply :) See your requests in my original post.
Hi @SanderEwen, looking at the path in the settings, try removing the \MDAnalysis\
from the end of the path so it will be :
C:\Users\**\**\*\site-packages
Hi @SanderEwen, looking at the path in the settings, try removing the
\MDAnalysis\
from the end of the path so it will be :C:\Users\**\**\*\site-packages
Great! This action works! Thanks a lot Brady. Keep up the good work :-)
I just wanted to add that removing the trailing slash from the package directory when setting up the plugin made the difference for me:
/Users/***/anaconda3/envs/mda_blender32_py310/lib/python3.10/site-packages/
~/Users/***/anaconda3/envs/mda_blender32_py310/lib/python3.10/site-packages
Everything else below is just context:
I installed MDAnalysis with conda (on macOS x86) (if you don't have a conda environment you can set one up by installing miniconda)
conda create -c conda-forge -n mda_blender32_py310 python=3.10 mdanalysis
Then find the the package directory as described in the installation, or do it from the command line with
# activate your new environment
conda activate mda_blender32_py310
# use Python to find the package directory location (with trailing slash removed...)
python -c "import os.path; import MDAnalysis; print(os.path.dirname(MDAnalysis.__path__[0]))"
# optionally: deactivate the environment
conda deactivate
With trailing slash:
The plugin check for MDAnalysis succeeds ("MDAnalysis available") but then when I try to Import Frames in the Load MD Trajectory File panel I get UnboundLocalError: local variable 'mda' references before assignment
presumably because the try/except import in the plugin failed but continued anyway — maybe it would be better to fail hard?
Hi @orbeckst thanks for the detailed info! I'll add your notes on creating a conda environment to the docs, they are very helpful.
I'll also fix up the check so that yes it will fail hard instead. This is my first python project so I'm still getting my head around how things should be done inside of Python (R for life).
@orbeckst Thanks for the installation guide! That's really helpful and I got atomium and MDA linking to work(now both buttons are grey). When I was trying to load the pdb and xtc, I still got the following error. It seems to be something from blender
.
Hi @ChenouZhang - which version of Blender and which version of Molecular Nodes do you have? Seems like the python libraries are linked OK but that in the creation of some of the nodes there are issues.
@BradyAJohnston I was using Blender-3.2.0 + molecular_nodes_0.8.1. Maybe I should try an older version of molecular_nodes?
@ChenouZhang will address in a new issue #35
Still struggling with the same problem. I get the message when running the script from May 23. I have Blender 3.2.1 and plugin version 0.9.1:
Traceback (most recent call last):
File "
Thing is, I installed MDanalysis with Anaconda. And as a result I get a string like this: /.conda/pkgs/mdanalysis-2.2.0-py39h2e25243_0/Lib/site-packages If I make the string /.conda/pkgs/ it gives the same message
Hi @MiekeRoth what OS are you working on? Are you able to provide a screenshot of the preferences for the addon, so I can see all of the paths etc.
Can you be more specific about which script you have tried, and what the error was when you tried it? There were a couple of different scripts posted on that day.
Hi @BradyAJohnston,
I work on Windows 11. And here are the preferences:
the path I use is: C:\Users\xxxx.conda\pkgs\mdanalysis-2.2.0-py39h2e25243_0\Lib\site-packages\
I basically tried every script of that day I must confess. In all iterations. with and without the end . Also tried going back to C:\Users\xxxx.conda\pkgs\ with the same iterations.
The error I keep getting is what I wrote above:
Traceback (most recent call last):
File "
Are you able to test out if the MDAnalysis installation is working? By importing it in a python session in the environment, and trying something like the following:
import MDAnalysis as mda
mda.fetch_mmtf('4ozs')
print("success!")
And see if that works? If it doesn't then it's an issue with the installation, if it does then it's still a path issue.
@BradyAJohnston I will try that later today (I hope). Need to finish some work before tomorrow. ;-) I will come back to it.
@BradyAJohnston I just copied the complete text. I'm getting the same error. Within the anaconda environment I also checked by 'conda list' and mdanalysis does appear. I'm searching for other sources on why it doesn't work, but until now haven't found anything that explains it.
PYTHON INTERACTIVE CONSOLE 3.10.2 (main, Jan 27 2022, 08:34:43) [MSC v.1928 64 bit (AMD64)]
Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils Convenience Imports: from mathutils import ; from math import Convenience Variables: C = bpy.context, D = bpy.data
import MDAnalysis as mda Traceback (most recent call last): File "
", line 1, in ModuleNotFoundError: No module named 'MDAnalysis' mda.fetch_mmtf('4ozs') Traceback (most recent call last): File "
", line 1, in NameError: name 'mda' is not defined print("success!") success!
Did you use the standard python
interpreter that belongs to the conda environment to check? (I’m wondering because the “convenience imports" do not look standard to me.) If you use an interpreter that’s no installed into the conda env then it will not know about modules that were installed there.
If you created a new environment (like mda_blender32_py310 in my example https://github.com/BradyAJohnston/MolecularNodes/issues/24#issuecomment-1174434784 ), did you switch to the environment first?
(apologies in advance, I’m on macOS or Linux so I don’t know exactly how things appear under Windows)
Hi folks, I just thought I'd let you know how I got my python/blender setup working. I'm on Ubuntu 20.04.4 LTS; 'm using Blender 3.2.1 and MolecularNodes v0.10.4 (git SHA: 377dc073a72d406456c48cb98dc243e195486f2a).
I followed the advice here and did the following and created a conda environment:
conda create --name blender python==3.10 mdanalysis atomium -c conda-forge -y
This will create an environment in (will be slightly different on your machine, depending on whether you're using miniconda/anaconda etc.)
/path/to/miniconda3/envs/blender
this folder will contain the following folders (amongst others): bin
, lib
and include
.
The python version you install must match the Blender python version. You can inspect the python distro packaged with Blender to determine this. Go to your Blender download folder (e.g., /path/to/blender/blender-3.2.1-linux-x64/
). In there find the python executable in the 3.2/python/bin
subfolder. Inspect the python executable (e.g,, python3.10
means you should install python 3.10).
Now rename the Blender python folder by navigating to /path/to/blender/blender-3.2.1-linux-x64/3.2/
and doing:
mv python _python
Now Blender won't find the packaged distro.
Now make a soft-link to the anaconda version of python
ln -s /path/to/miniconda3/envs/blender python
The final result should match:
(blender) ➜ 3.2 pwd
/home/rob/Software/blender-3.2.1-linux-x64/3.2
(blender) ➜ 3.2 ll
total 12
drwxr-xr-x 8 rob rob 4096 Jul 6 11:01 datafiles
drwxr-xr-x 5 rob rob 4096 Jul 6 11:01 _python
lrwxrwxrwx 1 rob rob 33 Jul 24 12:22 python -> /home/rob/miniconda3/envs/blender
drwxr-xr-x 9 rob rob 4096 Jul 6 11:01 scripts
Hope this helps.
I had the same issue and nothing in this thread have worked for me. I solved it by upgrading python from 3.8 to 3.10 (same version as Blender's) and reinstalling all the needed packages. Hope this helps! Regards and thanks!
@GeraZerbetto thanks, I’m doing that tomorrow
Having the same issue as others.
Ubuntu 20.04 Blender 3.3.0 Molecular Nodes 0.13.0
I've got MDAnalysis installed in a conda environment I built specifically for Blender, and have the path correct in the Molecular Nodes plugin settings. I have tried the above scripts and suggestions with no luck.
Hi @markahix thanks for the bug report! Are you able to provide some more details about which particular error you are getting on Linux? Is it just not recognising MDAnalysis or is there another package that it's failing to find?
I keep getting "Error: MDAnalysis Unavaiable" despite having MDanalysis installed. I just followed the instructions, and installed:
python3 -m pip install MDAnalysis
(ok)However, I keep getting the error "MDAnalysis Unavaiable" (I obtain the path from
import MDAnalysis as mda; mda.__path__
)