santoshphilip / eppy

scripting language for E+, Energyplus
MIT License
151 stars 67 forks source link

function to run E+ from eppy #62

Closed santoshphilip closed 8 years ago

santoshphilip commented 9 years ago

function to run E+ from eppy

See implementation details in this link

full discussion of the issue is here

development will be done in branch i62_eplusrunner

Jamie, do git checkout -b i62_eplusrunner origin/i62_eplusrunner to checkout this branch

barsa123 commented 8 years ago

Hi Jamie,

When I run the test it produces following error:

File "E:/pythonidf example/New folder/eppy-i62_eplusrunner/eppy/tests/test_runner.py", line 25, in from concurrent import futures ImportError: No module named concurrent

What is your suggestion?

Regards

Barsa

barsa123 commented 8 years ago

If I wont be cheeky, can you send me one of the example you have already done with your testing?

Regards

Barsa

jamiebull1 commented 8 years ago

That error tells me that you don't have the futures module installed. If you pull the latest update on the i62_eplusrunner branch I've removed that requirement as it was for a test we don't need any more. Then try the tests again and let me know if you still get any errors.

As far as sending you an example, I don't know what you mean. Do you mean the output of the test script?

barsa123 commented 8 years ago

What I meant was a running test or example? If possible? By the way I am sure I did download the lates one? when you say latest one what version is this one can you forward the link please?

jamiebull1 commented 8 years ago

I've just updated it a couple of minutes ago.

On Tue, 15 Mar 2016, 22:40 barsa123, notifications@github.com wrote:

What I meant was a running test or example? If possible? By the way I am sure I did download the lates one? when you say latest one what version is this one can you forward the link please?

— You are receiving this because you were assigned.

Reply to this email directly or view it on GitHub https://github.com/santoshphilip/eppy/issues/62#issuecomment-197033928

barsa123 commented 8 years ago

Hi Jamie,

I cannot see the latest version .I don't think I have authorization maybe this is why i was missing i saw on your profile you have updated but int he file cannot see can you send me the updated file as a zip to my email please?

jamiebull1 commented 8 years ago

Ok, it's now merged into this repo as well as mine. Here's the zip file link.

barsa123 commented 8 years ago

Thank you mate, I have downloaded the zip file, I work on it and let you know the result.

Regards

barsa123 commented 8 years ago

Hi Jamie,

when I run the the code you have sent me I have following error messages:

C:\Python27\python.exe C:/eppy/eppy/tests/test_runner.py Traceback (most recent call last): File "C:/eppy/eppy/tests/test_runner.py", line 25, in from eppy.runner.run_functions import EPLUS_WEATHER ImportError: No module named runner.run_functions

Does that mean we need to include somethings else?

How do you run on your machine if you can give me a step by step instruction I will appreciate as I am not expert in python, I believe you have to link different way.

jamiebull1 commented 8 years ago

Ok, so from scratch what I do to install is:

1) Install Minconda (if you don't already have it) from here 2) Install git (again, only if you don't already have it) from here

Then once you have those in place:

Create a new conda environment to keep any existing Python code on your system away from your new project. conda create -n eppy-env python

Activate the conda environment. activate eppy-env

Clone (download) the latest version of eppy using Git. git clone https://github.com/santoshphilip/eppy.git

Change into the eppy directory. cd eppy

Checkout the branch you want. git checkout i62_eplusrunner

Install eppy (this might be the step you're missing). pip install .

You'll also need to install tinynumpy to run the tests. pip install tinynumpy

Run the test suite (the -v flag gives verbose output from the tests).. py.test eppy -v

If you still have errors, post the output of the tests here.

barsa123 commented 8 years ago

Dear Jamie,

I have utilised the steps you have recommended, I only can see that the source file all are passed but when try to call the library by importing It doesn't work on python idle. Do you have a linked file which allows me to call eppy run function and run my script on it?

Bests

jamiebull1 commented 8 years ago

On this branch you need to use the IDF6 class to run an IDF. This snippet ought to work if you have everything importing correctly now.

from eppy.runner.runner import IDF6 as IDF

iddfile = <path to your IDD file>
idffile = <path to your IDF file>
epwfile = <path to your EPW file>

IDF.setiddname(open(iddfile, 'r'))
idf = IDF(open(idffile, 'r'), epwfile)
idf.run()

Hope that helps.

barsa123 commented 8 years ago

Hey Jamie, You are doing very good help appreciated but I think I cant proceed it. I everytime recive following errors.:

C:\Python27\python.exe "E:/pythonidf example/tests123/aaa.py" Traceback (most recent call last): File "E:/pythonidf example/tests123/aaa.py", line 24, in from eppy.runner.runner import IDF6 as IDF ImportError: No module named runner.runner

Process finished with exit code 1

It seems I havent included the path of eppy/runner in the tree. What do you suggest. Because the rest doesnt give any error. I guess I need to linked in the tree but cannot do it what I am missing . When I did in your previous suggestion Activate the conda environment. activate eppy-env

Clone (download) the latest version of eppy using Git. git clone https://github.com/santoshphilip/eppy.git

Change into the eppy directory. cd eppy

Checkout the branch you want. git checkout i62_eplusrunner

Install eppy (this might be the step you're missing). pip install .

Pip install doesn' t install anything just gave an error like :+1:

Barsa@Barsa1 MINGW64 ~/eppy (i62_eplusrunner) $ pip install https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz Collecting https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz Using cached pyparsing-1.5.7.tar.gz Requirement already satisfied (use --upgrade to upgrade): pyparsing==1.5.7 from https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz in c:\miniconda2\lib\site-packages Building wheels for collected packages: pyparsing Running setup.py bdist_wheel for pyparsing: started Running setup.py bdist_wheel for pyparsing: finished with status 'done' Stored in directory: C:\Users\Barsa\AppData\Local\pip\Cache\wheels\48\0b\b7\536d45affa3ff4d3eb34609b14ca55ad72a7a987838787f30c Successfully built pyparsing C:\Users\Barsa\AppData\Roaming\Python\Python27\site-packages\ndg\httpsclient\subj_alt_name.py:22: UserWarning: Error importing pyasn1, subjectAltName check for SSL peer verification will be disabled. Import error is: No module named pyasn1.type warnings.warn(import_error_msg) C:\Users\Barsa\AppData\Roaming\Python\Python27\site-packages\ndg\httpsclient\ssl_peer_verification.py:25: UserWarning: SubjectAltName support is disabled - check pyasn1 package installation to enable warnings.warn(SUBJ_ALT_NAME_SUPPORT_MSG)

So I have manually download from https://github.com/santoshphilip/eppy/tree/i62_eplusrunner installed successfully but as I highlighted above, when I run the code which gave an example with python IDE, I every time receive the the following error message:

Traceback (most recent call last): File "E:/pythonidf example/tests123/aaa.py", line 24, in from eppy.runner.runner import IDF6 as IDF ImportError: No module named runner.runner

I try to undersatnd the problem but cannot figure out . What do you suggest?

Bests

jamiebull1 commented 8 years ago

A few questions as I'm still not 100% sure what is happening at your end.

  1. How are you launching IDLE? Are you launching it using by typing idle at the command prompt of your eppy-dev environment?
  2. How are you installing the zip file you downloaded? Is it by unzipping it then running setup.py?
  3. What is the result if you run the following from a command line python shell (run python from the command line in your conda environment).
import inspect
import os
import eppy

os.path.abspath(inspect.getfile(eppy))
  1. What about if you run the same code in IDLE?
  2. Can you try deleting the conda environment using conda env remove eppy-dev and reinstalling?
barsa123 commented 8 years ago

Hi Jamie, Many thanks for your kind help, I m using PyCharm as IDLE. I installed miniConda as you suggested test was PASSED but whenever I use it on PyCharm, i received previous errors. Then I had to remove the miniConda. I then download zipfile from https://github.com/santoshphilip/eppy/tree/i62_eplusrunner and copied to my C drive as C:/eppy. Then I installed using command prompt with python while I am in C:/eppy directory with python setup.py install command It has been installed without any problem (I did this process since beginning and had the same error messages). I don't know what I am exactly missing. I have added :+1: import inspect import os import eppy

os.path.abspath(inspect.getfile(eppy)) It didnt make any chance still the same error message.

Traceback (most recent call last): File "E:/pythonidf example/tests123/aaa.py", line 30, in from eppy.runner.runner import IDF6 as IDF ImportError: No module named runner.runner

jamiebull1 commented 8 years ago

Ok. What output do you get when you run os.path.abspath(inspect.getfile(eppy))? It should tell you where the version of eppy the version of Python in the conda env is using is installed. We can then look at the same thing from IDLE and see if it's the same version.

barsa123 commented 8 years ago

It shows : C:\Python27\lib\site-packages\eppy-0.5-py2.7.egg\eppyinit.pyc

jamiebull1 commented 8 years ago

Is that from the command line or idle?

barsa123 commented 8 years ago

it is from my Idle (PyCharm)

jamiebull1 commented 8 years ago

Ok, that makes sense. It's picking up your main installation so I guess you're using the default project interpreter in PyCharm. What you need to do is set the interpreter in PyCharm to the interpreter in your eppy-dev conda env. Once you've done that you should be all set.

barsa123 commented 8 years ago

Hey Jamie,

Yes I did update it, now it is working, Many thanks mate. Appreciated all your countless helps.

Regards

Barsa

jamiebull1 commented 8 years ago

It took me a long time to realise you were using PyCharm. Glad it's working for you now! All the best.

barsa123 commented 8 years ago

Cheers, Jamie.Thank you again mate...

nancynanxiaodan commented 8 years ago

Hello Jamie, many thx for your update.

I've download the source code of i62_eplusrunner. However, every time I tried to install it in the site-packages. It installed the eppy 0.5. After I download I run from the command within the eppy folder: python -m pip install . and python setup.py install They all give me: eppy 0.5. And I checked the folder site-packages, there is only eppy-0.5-py2.7.egg in there.

I am using python 2.7.11 and Pycharm.

May ask for your some suggestions please. thanks Nancy

jamiebull1 commented 8 years ago

Hi Nancy. The version installed will still be 0.5 as it's not a new release, just a feature branch. edit: And was branched before 0.5.1.

Are you using a virtual environment to keep this version separate from any other installations? If you're not then you'll probably find it easier if you follow the steps to use Miniconda that I gave above. If you are already then you may need to set the interpreter in PyCharm to point to the right installation of Python.

nancynanxiaodan commented 8 years ago

Hey Jamie, it works now :) and I could call EP from eppy. Many thx!!

jamiebull1 commented 8 years ago

Need to fix the AppVeyor CI to download and install EnergyPlus as we do with Travis CI.

jamiebull1 commented 8 years ago

Closing as implemented in #101

liq2519 commented 6 years ago

Hi Jamie, I recently started to use Eppy and it is really awesome! I noticed some issues in running E+ from Eppy and thought it might be helpful to mention them in the documentation.

  1. I've installed E+ in a different directory rather than the default and then encountered an error running E+ from Eppy. It turns out that the E+ directory is hard-coded in run_functions.py. It might be helpful to mention this in the documentation. Perhaps a feature that reads the path of the .idd file to determine the E+ directory could be useful in the future?
  2. I've also found out that the statement "if __name__ == '__main__':" is needed in the main script for running E+ in parallel processes with runIDFs. Perhaps it is a standard approach in Python scripting. but might still be useful to let Python newbies like me to know about it.
jamiebull1 commented 6 years ago

@liqi08thu

  1. We did do some work towards this at some point. I've just had another look and will raise an issue as I have a solution in place.

  2. I'll leave that up to @santoshphilip to decide how much spoon-feeding is appropriate. I'd say quite a lot, since lots of people come to eppy with little to no experience of Python.

santoshphilip commented 6 years ago

@jamiebull1 , I can update the documentation when this feature is added.

liq2519 commented 6 years ago

Total GitHub newbie here and just saw your response. Thank you so much, Jamie!