Failed to import butterfly

I just installed butterfly freshly on a new computer from scratch.

I got the following error on the createCaseFromTunnel component after opening the outdoor airflow example file:

1. Solution exception: 
Failed to import butterfly:
Cannot import name xyzToPoint

This happened after I did the following to solve the blockMesh error as reported here and make sure butterfly runs correctly:

  1. run virtualbox as admin and power off the default machine
  2. run OpenFOAM_Start as admin, and keep it open and standby
  3. updated butterfly using the Butterfly (BF::BF) component as suggested in this link
  4. change the version number to v1706+ as suggested in this link
  5. open Rhino as admin

I’m unable to find posts reporting the same issue, and I thought I’ve tried everything I learned from previous failed butterfly installations. So, I’d appreciate your kind advice on how to debug this issue.

Thanks.

1 Like

… I tried the following, and the problem as reported above is still not solved:

  1. reinstalled butterfly using the original installer file in the installation package

  2. changed the OpenFOAM version number to v1706+ in the version.py file

  3. there are 43 files in the folder C:\Users#USERNAME\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\butterfly

  4. now open the outdoor airflow example file, and there is no component with the Failed to import butterfly: red error. But the blockMesh component is not working and is still reporting OF version related error:

    1. Solution exception:Failed to find container id.Do you have the OpenFOAM container running?
      You can initiate OpenFOAM container by running start_OF.bat:
      C:\Program Files (x86)\ESI\OpenFOAM\1706\Windows\Scripts\start_OF.bat
  5. so, update butterfly using the Butterfly (BF::BF) component, and there is a problem, so delete the three butterfly related folder in C:\Users#USERNAME\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts as discussed here

  6. update again, and it works.

  7. now there are 44 files in the folder C:\Users#USERNAME\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\butterfly, and the newly added file is gradingutil.py

  8. run Rhino as admin again, now the Failed to import butterfly: red error show up for three of the major butterfly component.

  9. So, it seems the butterfly update somehow created some issues here …

appreciate your kind advice on how to solve this issue.

Thanks.

Hi @Grasshope

Thanks for reporting. It’s hard for me to know why exactly this is happening since I updated only 3 days ago in my home computer with just updating the components and restarting rhino/gh. I did not close the virtual box or changed the name of the version, if that’s of any use. Everything worked out of the box.

Is it easy to do a fresh reinstall, maybe deleting all folders (new ones and old if they are there)? I’m sorry I can’t provide more help.

Kind regards,
Theodore.

Noted with thanks, @TheodorosGalanos. Let me try to do a thorough re-installation of Butterfly as suggested.

Hi @TheodorosGalanos, the “Failed to import butterfly” error remained after I did a complete re-installation of butterfly and restarted the virtual machine, OpenFOAM and Rhino as admin.

… still not sure what is causing this issue.

Hi, @TheodorosGalanos,

I manage to solve the issue by replacing the following folders and files with the ones copied from another computer which installed butterfly previously and running OpenFOAM correctly:

  1. C:\Users\USERNAME\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\butterfly
  2. C:\Users\USERNAME\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\butterfly_grasshopper
  3. all 59 butterfly ghuser objects in C:\Users\USERNAME\AppData\Roaming\Grasshopper\UserObjects folder

OpenFOAM now runs correctly through Butterfly.

However, updating Butterfly will cause the problem as reported above.

I noticed that the latest version.py file has been changed as compared to the “old” one I’m using now as shown below (old one is shown on the left, and the latest one on the right). I’m not sure if these changes in variable names are causing the problem here. Appreciate your kind advice.

version_old.py (2.1 KB)
version_new.py (2.1 KB)

Hi @Grasshope,

Butterfly has been through several updates recently which will break old sample files. It was expected but I should have provided a better support to let people know about it:

In any case what you have done should solve the problem. Once you have replaced all the files and userobjects use Ladybug’s update file component to update the files. That will replace the components with the most recent ones which should have from butterfly_grasshopper.geometry import xyz_to_point instead of xyzToPoint.

1 Like

Noted with thanks, @mostapha. Will try the suggestion later.

Thank you and the LB+HB+BF development team for all your hard work and generous help. Wish you all and your families a happy holiday season and a prosperous new year ahead.

-Ji

1 Like

Hello all!

I am having a similar issue, but with version 0.0.0.5 of Butterfly. I have deleted and reinstalled multiple times now, but still seem to get errors that either read: “1. Solution exception:
Failed to import butterfly:
Can’t find butterfly in sys.path.
You need to install butterfly to use butterfly-grasshopper.
You can download butterfly from
https://github.com/mostaphaRoudsari/Butterfly”

or “21. Solution exception:Failed to import butterfly:
Set your installation flavor in confing.yml.”.

I have blueCFD-Core-2020 installed on my computer (which I believe automatically installs OpenFoam?)Butterfly_err.gh (9.6 KB) . Perhaps I should try an earlier version?

Hey, I suggest you use Bluecfd2017.2

Zhengrong

Ok thanks I will try this.

Hi,
i’m having a problem with butterfly on rhino 7

  1. Solution exception:
    Failed to import butterfly:
    No module named butterfly_grasshopper.geometry

please help, i have a deadline :broken_heart::disappointed_relieved:

with all do respect ,
Rania.

Hey Rania,
I just had the same problem. On the second try I made sure to “unblock” the zip folder before extracting the files from food4rhino and to run the installer while having Rhino in Admin mode.
Hopefully that works for you too :slight_smile:

yes it worked thanx alot :ok_woman::pray:

hey i got this same issue with rhino 8 now, help :sob: