drmichaeldouglass / MedBlend

A Medical Visualisation Add-On for Blender
MIT License
66 stars 4 forks source link

Can't install #2

Closed terrielsimmons closed 1 year ago

terrielsimmons commented 1 year ago

I can't seem to get this to install. I have tried with both 3.5 alpha and beta. When I try to install the first version, I get the message that it's installing but it never pops up in my add-ons list. When I try to install the newest version, it shows up but when I check it to enable, I get the following message. 2023-03-10_7-45-57

drmichaeldouglass commented 1 year ago

Are you able to unzip the add-on zip file and try installing the init.py file as an add-on instead?

terrielsimmons commented 1 year ago

I can see the init file in the newer folder but not the older folder. It still doesn't come up in the add-ons list. Here's the message I get if it helps: Modules Installed () from 'C:\Users\starb\Documents\MedBlend-0.0.11_alpha\MedBlend-0.0.11_alpha\init.py' into 'C:\Users\starb\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons'

drmichaeldouglass commented 1 year ago

I think I know what the issue is. I will try and fix it today.

drmichaeldouglass commented 1 year ago

@terrielsimmons I have made a few changes to the add-on and updated the instructions in the readme file. It looks like part of the issue was administrator rights. Please download version 0.0.2 from the release page and let me know if it works now.

terrielsimmons commented 1 year ago

Ok I just installed the 3.5 release. Trying to direct to the zip still didn't work. When I unzipped it and put the folder in the addons folder, I renamed it to medblend and that worked. Looks like I installed the python dependencies too, so I will try some DICOMs now!

terrielsimmons commented 1 year ago

I tried to load a series and got this: 2023-03-30_20-14-09

drmichaeldouglass commented 1 year ago

@terrielsimmons Are you able to create a new script in the Blender scripting tab and run this script please?

def install_python_modules():

import subprocess
import platform

def isWindows():
    return os.name == 'nt'

def isMacOS():
    return os.name == 'posix' and platform.system() == "Darwin"

def isLinux():
    return os.name == 'posix' and platform.system() == "Linux"

def python_exec():
    import sys
    if isWindows():
        return os.path.join(sys.prefix, 'bin', 'python.exe')
    elif isMacOS():
        try:
            # 2.92 and older
            path = bpy.app.binary_path_python
        except AttributeError:
            # 2.93 and later
            import sys
            path = sys.executable
        return os.path.abspath(path)
    elif isLinux():
        return os.path.join(sys.prefix, 'sys.prefix/bin', 'python')
    else:
        print("sorry, still not implemented for ", os.name, " - ", platform.system)

def installModule(packageName):
    try:
        subprocess.call([python_exe, "import ", packageName])
    except:
        python_exe = python_exec()
       # upgrade pip
        subprocess.call([python_exe, "-m", "ensurepip"])
        subprocess.call([python_exe, "-m", "pip", "install", "--upgrade", "pip"])
       # install required packages
        subprocess.call([python_exe, "-m", "pip", "install", packageName])
installModule('pydicom')
return 1

pydicom_install_successful = install_python_modules()

terrielsimmons commented 1 year ago

[Edit: I did not run the script you provided above, I just reopened Blender. ]When I opened 3.5 and started up MedBlend, it looked like the dependencies installed despite the messages I received last time. It's working! I previously would convert a CT volume to VDB in Paraview to import into Blender, but this is so much faster. Thanks for making this addon! 2023-04-04_7-21-53

drmichaeldouglass commented 1 year ago

@terrielsimmons I am glad it worked. I have run into that issue before where re-starting Blender forces it to look for the python modules again. I will look at fixing that bug. Thanks