AguaClara / aide

AguaClara Infrastructure Design Engine - a software tool that designs AguaClara water treatment plants and their components.
MIT License
0 stars 0 forks source link

Integrate aide_render.render_lfom() #6

Closed eak24 closed 6 years ago

eak24 commented 6 years ago

In the latest version of aide_render, I made a render_lfom() function that takes in an lfom yaml (right now supporting only the flow rate variable, Q) and returns the design YAML. Please incorporate this into the aide main loop. If you need to save the output as a yaml file, make sure to specify the yaml_path_out keyword argument.

To clarify, this is the function you'll be calling with the flow rate input. From there, this function will run and produce a design output. That design output will then be read by aide_draw. Please pip install aide_render and try to run the render_lfom() function. It should be well documented.

oliver-leung commented 6 years ago

I've (partially) implemented aide_render.render_lfom within aide's observer function, but I can't run it in Fusion 360 because it can't find the ruamel.yaml dependency. However, I did test running from the same location in the Python terminal and it worked.

Should I add ruamel.yaml to aide_render and change the pip imports to relative imports? Just wanted to ask before changing things.

eak24 commented 6 years ago

@oliver-leung What are the pip imports you are referring to?

If you add your system path (i.e. where pip installs these things) you don't need to cascade through all the dependencies to add the sdists.

Even better solution: make a conda environment with: conda create --name aide Once that is done, the sdists will be in: ~/anaconda3/envs/aide/bin Now you can add that path at the top of your aide doc: sys.path.append(youre_environment_path) (referring to the right path with os) Then, if you need ruamel, just install it to that environment by first activating the environment then installing (you may need to install pip first, IDK): source activate aide or on Windows: activate aide now, you can use it just like your normal python terminal, except it will point to ~/anaconda3/envs/aide/bin. This effectively isolates what aide's fusion can use without having you manage the sdists. Whatever you do, do not include all the sdists in aide. I never should have said aide gui could do that... it is so easy to fall into dependency hell!

oliver-leung commented 6 years ago

@ethan92429 I ran:

conda create --name aide
activate aide
conda install pip
pip install ruamel.yaml

But I can't see the sdists in ~/anaconda3/envs/aide/bin. I added the following line to aide/aide.py, aide_render/__init__.py, and aide_render/yaml.py:

sys.path.append(r"C:\Users\EN-CE-AC\AppData\Local\Continuum\anaconda3\envs\aide\bin
# (I did this both with and without \bin, because the \bin folder wasn't in \anaconda3\envs\aide)

But I'm running into the same ImportError: No module named ruamel as before. Am I doing something wrong/missing something?

eak24 commented 6 years ago

Hmm... What is the output of conda info? @oliver-leung

oliver-leung commented 6 years ago

@ethan92429 Strange, it says active environment : None. I tried activate aide and conda activate aide, still None.

Just figured out what's going on: the activate command somehow isn't recognized in Powershell, but it works in CMD. I'll try it now and see what happens.

oliver-leung commented 6 years ago

It managed to get past import ruamel.yaml, which is good, but I can't pip install aide_design to the environment for some reason. I got an error message similar to the one here and went through each command that the top answer suggested, but with no luck.

I'll try this on a different computer and see if that changes anything!

eak24 commented 6 years ago

That's good you got past the install error! Unfortunately, it's hard for me to diagnose that issue with windows from here. If you want, I could teamshare you and try a couple things out on your computer? Let me know if you need that!

oliver-leung commented 6 years ago

I'm now getting errors that matplotlib can't be installed due to missing FreeType and PNG. I installed both, but it still says that they're missing.

I think I'm just gonna take a break from this and work on trying to get pip install to work from within the add-in.

eak24 commented 6 years ago

OK, that sounds good. BTW, you can link issues like so: #5

oliver-leung commented 6 years ago

This has been implemented, but the function will most likely need to be rewritten for Onshape.