Why do I get this message: Failed to import X: No module named X

It’s all good. This is also my first time dealing with a private group. It never hurts to ask how it works.

Hi! I am encountering this same issue even though I made sure I did step 4 correctly. I noticed the username of the account I’m using on this computer has a space though. Is it possible that that could be causing the problem?

1 Like

That shouldn’t cause this problem, @LanceMonfort . But the space might cause some other issues that we are currently trying to resolve. If you want to make sure that you ran the last installation step correctly with Rhino closed, you should open the file at this location in a text editor:

C:\Users\[USERNAME]\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings

If it looks something like this, then you have done the last step correctly and we can try debugging some other things:

Thank you for the response, @chris. I opened that file and mine looks like this:

Screenshot 2020-10-13 121203

Can I just edit the text to match what you posted or should I do something else to fix the issue? What do you think? Thanks!

Hey @LanceMonfort,

That screenshot really seems to suggest that set_python_path.bat wasn’t run with Rhino closed. So you can either run the set_python_path.bat and you will see that the correct text automatically gets added to that file. Or you can manually do it if you want. Just make sure that Rhino is closed throughout the whole process.

Ah wait. You are right that the white space is the issue. I forgot that the command that’s being run in the .bat file isn’t formatted correctly to handle white spaces. If you add quotation marks around these parts of the .bat file, that will get it to run correctly:

Sorry for the confusion here and I will add a fix into the intsaller.gh now.

Thanks for catching and reporting this, @LanceMonfort . I just updated the link on Food4Rhino to make sure the installer.gh can handle white spaces in the file path. So you saved many others from experiencing the same issue.

Note that the Food4Rhino update was only a change in the installer.gh file and none of the components that are a part of the plugin have been affected.

No worries and thank you as well, @chris! Just tried re-installing it and it works perfectly now. Thanks again!

1 Like

Hi Chis. I have the same problem. I check that the set_python_path.bat had quotation marks and ran it. When I drop a LB 1.1.0 componet to the canvas it becomes red and shows me “1. Solution exception:
Failed to import ladybug: No module named ladybug.futil”

My User directory name has an space in it.

1 Like

Hellow, Chris. I have the same situation. I am sure that I double-clicked that .bat file with rhino closed, but my lb could not run. :sob:
I didn’t install my rhino on disk C. Could this have caused that malfunction?
Here is my screenshot.

1 Like

Hi there,

I’m unfortunately having the same problem. Just like @potato, the set_python_path application tells me “Congratulations! Setting the search path in the following file was succesful:” without then naming a file location (also see the screenshot attached).
I tried reinstallation, running it as administrator, but nothing helped.

Thank you for your help and the great work at LB in general!

Best,
Julian

Interestingly, it now worked with my newly installed Rhino 7. However, the python library is still not connected to Rhino 6.
Which raises the question if it is even possible to have LB 1.0.1 installed for both versions at the same time and how you’d tell the “set_python_path” tool to connect to R6?

Best,
Julian

1 Like

Just saw this thread, which answers most of the questions:

sorry for not seeing it first and thank you!

1 Like

Thanks for sharing the thread! This helped me a lot.
And thanks for all those who have contributed to solving this problem!

Glad that everyone seems to have gotten things working here. I also wanted to post the manual workaround which will always work on any Windows machine and for either Rhino 6 or 7 (regardless of whether you have admin privileges, a username, etc.):

As you can see it’s a lot of steps so, if you can get things to run just by re-running the .bat file, then that’s probably preferred. But, with the manual process above, anyone will be able to get things to work.

I’m still unable to use any of the Ladybug/Honeybee components and getting the “failed to import…” errors.

I have added the paths manually to the Python Search paths too.
Output when I run

import sys
print(‘\n’.join(sys.path))

C:\Program Files\Rhino 6\Plug-ins\IronPython\Lib
C:\Users\TSA94506\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib
C:\Users\TSA94506\AppData\Roaming\McNeel\Rhinoceros\6.0\scripts
C:\Users\TSA94506\ladybug_tools\python\Lib\site-packages

Hi,
I also meet this problem, how can I solve this, really thanks if there is anyone can help me!

Best,
Renwei

I am getting the same error, I am using it on mac (OSX). I couldn’t find the python file (in users folder) which needs to run in step 4.

Thanks in advance.

There is no .bat file to run when you are on OSX. See the Mac installation instructions:

If you’re still having difficulty, try deleting the folder at:
/Users/[USERNAME]/ladybug_tools
Then, re-run the installer.gh

Just to add my 2 cents here for Mac installations.
Once you’ve followed all the instructions, make sure to right click Rhino and Quit before relaunching.
Simply closing a Rhino window on Mac won’t reload all the changes made by the instalations.
Maybe trivial, but I did go in circles for a while.

1 Like