Blender Connector fail

Helo
I am new to speckle and I have a problem enabeling the conector to blender. First i am not able to downlaod the latest verson only 2.9.0-Beta2 and 2.9.0-alpha5. When i try to enable any og these in blender prefrences, i get the same error:

ModuleNotFoundError: No Module named ´bpy_speckle´

1 Like

Hey @MrMaggyMe ,

Can you answer following questions to give more context?

  • What is your operating system?
  • What is your Blender version?
  • What is the Speckle Blender connector version?
  • Is Speckle the first plugin you installed?
  • Can you check if there is a folder named modules under %appdata%/Blender Foundation/(Blender version)/(number)/scripts/addons?
  • Did you try restarting Blender?

Thank you :rose:

Thank you for superquick responds and of course!

  • MacOS Ventura verson 13.0.1
  • Blender verson 3.2.0
  • Tried 2.9.0-Beta2 and 2.9.0-Alpha5 (2.10.0-Beta and 2.9.1 doesnt work to download)
  • Can find the folder here: /Applications/Blender.app/Contents/Resources/3.2/scripts/addons
  • Restarted blender multiple times :slight_smile:
1 Like

Manager now downloads latest Blender Connector 2.10

  • MacOS Ventura verson 13.1 Beta (22C5050e)

  • speckle manager 2.7.0

  • Blender verson 3.3.2 RC

  • Blender verson 3.5.0 ALPHA

  • have a 2.9.0 (fake) Settings Folder

  • Manager does not install : User/Library/Application Support/Blender/ANY_VERSION/scripts/addons/
    bpy.speckle nor modules Folder

  • Restarted blender multiple times :slight_smile:

  • Download of most recent Blender Connector worked now in Manager 2.7.0

  • Found the “Installer” now in hidden User/Config/Speckle

  • Extracted both Zips for bpy.speckly and Modules Folders

  • Renamed ModulesAppple ARM (or similar) to modules

  • Manually copied both folders into my Blender Settings/AddOns

  • Tried to activate both in 3.3 and 3.5, both denied and bring a warning
    (I am not able to create a screenshot from the warning as it disappears)

1 Like

Oh no!
I’ll take a look at this tomorrow, thanks for the help troubleshooting.

2 Likes

Had this before.

I think you need to activate Betas in Managers Settings.
For me latest Blender Connector downloads only worked since Manager 2.7.0
from 2 (?) days ago.
When you reboot or close/restart Manager with Beta activated it should update
to latest version and be able to download latest Blender Connector.

Unfortunately, for me, it did not install that Blender AddOn in any Blender
Settings Folder though - but at least it downloaded it …

EDIT :
Ooops, did I switch threads or did the Post I replied too evaporate …

Have you figured anything out yet? :slight_smile:

2.10 is able to download Connectors from Manager here on my Ventura M1 Mini.

But it only downloads packages into Manager Software.
It does not install anything in any of my Blender Setting Folders.

I went again into my User Folder, made hidden files visible (SHIFT+CMD+.)
In the hidden .Config/Speckle Folder, I found again zip files that contain
the 2 Folders to rename to bpy_speckle and modules,
(these Zips will only be there when Manager could successfull download the Connector,
path is “YourDisk”/Users/“YourUserName”/.config/Speckle/Manager/blender/.installationFiles)
which should reside in your Blender Settings AddOns Folders.

When I copy them manually in Blender Settings Folder,
Start Blender,
in Blender Settings : AddOns will now show the “Scene” sub category, where your
Speckle Connector AddOn is listed and waiting for activation.

But as usual, trying to activate Speckle AddOn will fail with a warning messsage
on any of my Blender Apps.
(AFAIK currently 3.3 and 3.5 Alpha)

So no clue if the …
current Blender Connectors are just not compatible with my Blender versions,
Blender would need more files beside these 2 Folders,
there may be a way to force real installation of Connectors from there,

Hello folks,

@Jedd and I have been hard at work figuring out a proper installation mechanism for Blender.
I can tell you we have made great advancements in ironing out all the known issues on all the supported platforms.

We will be able to provide a properly working installer from manager and also a .zip file based installer to be able to use on non officially supported Blender versions (like alpha and beta).

We are including the changes in the upcoming release, until that there is a workaround that you can take if you are daring.

As hinted by the very detailed investigations by @zoomer, unfortunately our current installer on M1 mac-s doesn’t install the python dependencies of the blender connector. But that can be fixed with a python script ran inside blender’s scripting environment:

from pathlib import Path
from importlib import import_module

import bpy
import sys

print("Starting Speckle Blender installation")
print(sys.executable)

PYTHON_PATH = sys.executable



def modules_path() -> Path:
    modules_path = Path(bpy.utils.script_path_user(), "addons", "modules")
    modules_path.mkdir(exist_ok=True, parents=True)

    # set user modules path at beginning of paths for earlier hit
    if sys.path[1] != modules_path:
        sys.path.insert(1, modules_path)

    return modules_path


print(f"Found blender modules path {modules_path()}")


def is_pip_available() -> bool:
    try:
        import_module("pip")  # noqa F401
        return True
    except ImportError:
        return False


def ensure_pip() -> None:
    print("Installing pip... "),

    from subprocess import run

    completed_process = run([PYTHON_PATH, "-m", "ensurepip"])

    if completed_process.returncode == 0:
        print("Successfully installed pip")
    else:
        raise Exception("Failed to install pip.")


def get_requirements_path() -> Path:
    # we assume that a requirements.txt exists next to the __init__.py file
    path = Path(Path(__file__).parent, "requirements.txt")
    assert path.exists()
    return path


def install_requirements() -> None:
    # set up addons/modules under the user
    # script path. Here we'll install the
    # dependencies
    path = modules_path()
    print(f"Installing Speckle dependencies to {path}")

    from subprocess import run

    completed_process = run(
        [
            PYTHON_PATH,
            "-m",
            "pip",
            "install",
            "-t",
            str(path),
            "specklepy"
        ],
        capture_output=True,
        text=True,
    )

    if completed_process.returncode != 0:
        print("Please try manually installing speckle-blender")
        raise Exception(
            """
            Failed to install speckle-blender.
            See console for manual install instruction.
            """
        )


def install_dependencies() -> None:
    if not is_pip_available():
        ensure_pip()

    install_requirements()


def _import_dependencies() -> None:
    import_module("specklepy")


def ensure_dependencies() -> None:
    try:
        _import_dependencies()
        print("Found all dependencies, proceed with loading")
    except ImportError:
        print("Failed to load all dependencies, trying to install them...")
        install_dependencies()
        raise Exception("Please restart Blender.")


ensure_dependencies()

disclaimer, I’ve copy pasted and modified code from our new installer, let me know if it has any issues.

After running this, enabling the addon should succeed.

1 Like

Great News @gjedlicska !

I will try if I can run your script in Blender.
And looking forward to the next installer.

@gjedlicska

I tried and it didn’t work for my Blender 3.3 -3.5.
But I have no knowledge of anything scripting or terminal texts at all …

I think it is still the same warning that Blender could not load something
Python from within modules folder.
(Traceback (most recent call last):
File “/Applications/Blender.app/Contents/Resources/3.3/scripts/modules/addon_utils.py”, line 333, in enable
mod = import(module_name)
File “/Users/micha/Library/Application Support/Blender/3.3/scripts/addons/bpy_speckle/init.py”, line 26, in
from bpy_speckle.operators import *
File “/Users/micha/Library/Application Support/Blender/3.3/scripts/addons/bpy_speckle/operators/init.py”, line 10, in
from .streams import (
File “/Users/micha/Library/Application Support/Blender/3.3/scripts/addons/bpy_speckle/operators/streams.py”, line 28, in
from specklepy.api import operations, host_applications
ImportError: cannot import name ‘host_applications’ from ‘specklepy.api’ (/Users/micha/Library/Application Support/Blender/3.3/scripts/addons/modules/specklepy/api/init.py)

)

The 2.10 version of “modules” and Specklypy folders do exist there.

What I did :

  • copy your complete script text
  • open Blender
  • go to script workspace
  • insert script text
  • press Enter
    → “found all dependencies, proceed with loading”
  • try to activate Speckle AddOn > Warning
  • restart Blender
    -try to activate Speckle AddOn > Warning

I will update my Blenders first and then try again.

If you only try hard enough …

Absolutely great !
Now I have Speckle up and running on ALL my Blender versions on my M1 Mini !

  • I updated all my Blenders no to 3.3.2 LTS, 3.4.0 Stable and 3.5.0 Alpha
  • I updated my Speckle Manager 2.7.3
  • Installed latest Blender Connector 2.11

This installed bpy-speckle folder into (only) my Blender 3.3 Settings folder.
I missed the “modules” folder, at first.
When activating Speckle AddON there was no warning - but nothing happened.
After a while I clicked the check mark again - warning appeared again.
So I restarted Blender and tried again.
I saw the “modules” Folder was added now.
(Maybe LittleSnitch Firewall, waiting for me allowing Speckle connections,
interrupted first installation)
I tried to activate again and it worked !

So now I copied BPYSpeckle and Modules folders over to 3.4 and 3.5 Settings.
This way Speckele AddOn Activation worked also flawlessly for 3.4 and 3.5.

So thanks again @gjedlicska !

Now I can finally start examining Speckle …

3 Likes

That’s great. Thanks for persevering and documenting your recovery steps for us to see and for other Community members to mimic.

The team have been actively battling this issue as we want to make all this pain go away - :crossed_fingers: we may have it nailed for the next release.

2 Likes

Yeah, as Jonathon said, you’ve basically tested our pre alpha installer. Thanks for doing that :slight_smile:

And some insider info, the compiled version is already available in our alpha release channel. If anyone is brave enough to test it.

Also a manual .ZIP installer should be landing in the same channel soon.

Cheers

I did a Manager refresh
(no update available)
and found a new Blender 2.11.0 Alpha 3 released (41 minutes ago)

I did a Connector install.
Not sure if it really updated my AddOns.
I searched for File Dates, which were mostly from yesterdays installation.

But if /bpy_speckle/requirements.txt really is an indicator, it is from today 10:21.
So if that is correct for Alpha 3, in that case,
I could state that Alpha 3 was updated in ALL of my Blender version’s Settings.

(Otherwise installation would have failed for ALL Blenders)

2 Likes

It is. Nice one

giphy

2 Likes

I tried but can not RECEIVE my Speckle Stream into Blender ?

But I need to test further before I moan.
Just in case it could help and someone is interested,
here is the error message in Blender :

Blockquote
Python: Traceback (most recent call last):
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/bpy_speckle/operators/streams.py”, line 369, in execute
stream_data = operations._untracked_receive(commit.referencedObject, transport)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/api/operations.py”, line 84, in _untracked_receive
return serializer.read_json(obj_string=obj_string)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 304, in read_json
return self.recompose_base(obj=obj)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 358, in recompose_base
base.setattr(prop, self.recompose_base(obj=ref_obj))
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 358, in recompose_base
base.setattr(prop, self.recompose_base(obj=ref_obj))
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 358, in recompose_base
base.setattr(prop, self.recompose_base(obj=ref_obj))
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 368, in recompose_base
base.setattr(prop, self.handle_value(value))
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 392, in handle_value
obj_list = [self.handle_value(o) for o in obj]
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 392, in
obj_list = [self.handle_value(o) for o in obj]
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 406, in handle_value
return self.recompose_base(obj=obj)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 368, in recompose_base
base.setattr(prop, self.handle_value(value))
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 392, in handle_value
obj_list = [self.handle_value(o) for o in obj]
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 392, in
obj_list = [self.handle_value(o) for o in obj]
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 406, in handle_value
return self.recompose_base(obj=obj)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 368, in recompose_base
base.setattr(prop, self.handle_value(value))
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 406, in handle_value
return self.recompose_base(obj=obj)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/serialization/base_object_serializer.py”, line 349, in recompose_base
base.setattr(prop, value)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/objects/base.py”, line 208, in setattr
value = self._type_check(name, value)
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/modules/specklepy/objects/base.py”, line 292, in _type_check
raise SpeckleException(
specklepy.logging.exceptions.SpeckleException: SpeckleException: Cannot set ‘RenderMaterial.diffuse’: it expects type ‘int’, but received type ‘float’

And BTW
I tried to upload a new IFC test, which also failed …
But that seems to be a bit strange IFC as it also fails to load into BlenderBIM.
Which AFAIK uses the same Open IFC stuff.

(Did take a while until I realized that, as that IFC loaded without issues into
Bricscad or OpenIFCViewer)

But again, I have to test a bit more.

2 Likes

If it’s possible could, could you share that stream with me (jedd@speckle[dot]systems) and I can take a look at why it’s failing.

I’ll try and test some more IFC importer commits tomorrow.

Hello Jedd,

thanks a lot !

I sent you an email with the link. I hope it works.

BTW,
the IFC contains some Dummy Boxes that occlude most of the building geometry.
Seems that I am not able to switch visibilities of objects in general in this Stream’s
content.
But I have already seen visibility switching working in some of Speckle examples,
postet here on the Forum by Speckle.

But I have to test more and look for better IFC demo files from my side.

Blender Connectors now still load fine each time here on my M1 Mini.

And I have a new clean IFC V4.1 uploaded.
Unfortunately I can not stream it down in Blender :
(tried with 2.11.0 alpha 3 and now final 2.11.1)

"Python: Traceback (most recent call last):
File “/Users/micha/Library/Application Support/Blender/3.5/scripts/addons/bpy_speckle/operators/streams.py”, line 377, in execute
context.window_manager.progress_begin(0, stream_data.totalChildrenCount)
AttributeError: ‘dict’ object has no attribute ‘totalChildrenCount’
"

Although, in Safari the Model looks great and Stream’s Data View shows : children count 1245

1 Like