mbakker7 / timml

An analytic element model for steady multi-layer flow
MIT License
38 stars 21 forks source link

Installation #2

Closed astraiophos closed 8 years ago

astraiophos commented 8 years ago

This may be a user error, but I'm having trouble installing the software using the pip install instructions provided. My virtual machine is a Ubuntu 14.04 Linux operating system and I just recently installed the SciPy, numpy, and matplotlib dependencies. I use the command pip install timml and I get an ImportError as the following:

`pip install timml Downloading/unpacking timml Downloading timml-4.0.4.tar.gz (562kB): 562kB downloaded Running setup.py (path:/tmp/pip_build_jacobbf1/timml/setup.py) egg_info for package timml Traceback (most recent call last): File "", line 17, in File "/tmp/pip_build_jacobbf1/timml/setup.py", line 12, in from timml import version File "timml/init.py", line 22, in from mllinesink import LineSink, HeadLineSink, ResLineSink, LineSinkDitch File "timml/mllinesink.py", line 5, in from besselaes import * ImportError: timml/besselaes.so: invalid ELF header Complete output from command python setup.py egg_info: Traceback (most recent call last):

File "", line 17, in

File "/tmp/pip_build_jacobbf1/timml/setup.py", line 12, in

from timml import __version__

File "timml/init.py", line 22, in

from mllinesink import LineSink, HeadLineSink, ResLineSink, LineSinkDitch

File "timml/mllinesink.py", line 5, in

from besselaes import *

ImportError: timml/besselaes.so: invalid ELF header


Cleaning up... Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_jacobbf1/timml Storing debug log for failure in /home/jacobbf1/.pip/pip.log `

astraiophos commented 8 years ago

I believe that the only thing that would need to be included in the docs for an ubuntu install is to include a fortran compiler in the list of dependencies, but I'm still testing that out. If you have a suggestion or know of what is causing this issue I'd appreciate your help. Again, I'm convinced that the error I'm experiencing is of my own making, just not sure how to fix it yet.

astraiophos commented 8 years ago

I'm noticing that in the readme documents that linux is not mentioned at all. If Linus is not supported that's fine, might be good to include in the documentation for the installation files to prevent users like myself from incorrectly assuming. Going to try this source code using windows now.

astraiophos commented 8 years ago

So I have thus far only successfully installed and executed the source code using windows. Is there any way that the timml repository can be installed or run using ubuntu?

mbakker7 commented 8 years ago

Hey Jason,

The pre-compiled FORTRAN extensions are only pre-compiled for Windows and Mac. They work there.

On Linux, you need to compile the FORTRAN extensions yourself. You know how to do that? You have a FORTRAN and C compiler installed?

MB

On Mon, Aug 15, 2016 at 8:38 PM, Jacob Fullerton notifications@github.com wrote:

So I have thus far only successfully installed and executed the source code using windows. Is there any way that the timml repository can be installed or run using ubuntu?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-239888960, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyLOBSzf1w-1_UtShBFo-4ZPgT7ybks5qgLI-gaJpZM4JeC3f .

mbakker7 commented 8 years ago

TimML makes use of FORTRAN extensions. The FORTRAN extensions are pre-compiled for Windows and Mac (for 64 bits Python 2.X). For Linux or any other OS/Python combo, the file besselaes.f90 needs to compiled into a FORTRAN extension using f2py.

astraiophos commented 8 years ago

I will compile that today and see what I get. Just realized that the fortran objects are platform dependent. I'm still learning about fortran, I'm a little better with python.

mbakker7 commented 8 years ago

You realize you need to use f2py?

On Tue, Aug 16, 2016 at 6:00 PM, Jacob Fullerton notifications@github.com wrote:

I will compile that today and see what I get. Just realized that the fortran objects are platform dependent. I'm still learning about fortran, I'm a little better with python.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-240148884, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyLW5OLQUQAZiQdoih8_QjBTOGOzTks5qgd6WgaJpZM4JeC3f .

astraiophos commented 8 years ago

trying to get f2py to work, I need to install an earlier version of python since the keynote 'as' was reserved for python 2.6+ (or so it seems).

astraiophos commented 8 years ago

Does the besselaes.f95 need to be compiled? I have a working version, but I'm wondering if there will be problems down the road as I start actively using the software in this repository

mbakker7 commented 8 years ago

Yes, only the besselaes.f90 file. If you got it to work, then you should be good.

MB

On Tue, Aug 16, 2016 at 10:51 PM, Jacob Fullerton notifications@github.com wrote:

Does the besselaes.f95 need to be compiled? I have a working version, but I'm wondering if there will be problems down the road as I start actively using the software in this repository

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-240234519, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyPEbALvcUt37wFcuSVuSw8fuE0gUks5qgiLOgaJpZM4JeC3f .

astraiophos commented 8 years ago

Awesome! Thank you for your help, got it up and running On Aug 17, 2016 1:27 AM, mbakker7 notifications@github.com wrote:Yes, only the besselaes.f90 file. If you got it to work, then you should be good.

MB

On Tue, Aug 16, 2016 at 10:51 PM, Jacob Fullerton notifications@github.com wrote:

Does the besselaes.f95 need to be compiled? I have a working version, but I'm wondering if there will be problems down the road as I start actively using the software in this repository

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-240234519, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyPEbALvcUt37wFcuSVuSw8fuE0gUks5qgiLOgaJpZM4JeC3f .

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.

jentjr commented 8 years ago

I opened a pull request that uses setup utilities from numpy for building and distributing fortran extensions. That should help in the future for anyone trying to install TimML from source.

from __future__ import division, absolute_import, print_function  
from timml import __version__  
from numpy.distutils.core import Extension  

ext = Extension(name = 'besselaes',  
                sources = ['src/besselaes.f90'])  

if __name__ == "__main__":  
    from numpy.distutils.core import setup  
    setup(name = 'timml',  
          version=__version__,  
          packages = ['timml'],  
          install_requires = ['numpy>=1.9', 'scipy', 'matplotlib>=1.4'],  
          description = "TimML, A Multi-Layer, Analytical Element Model",  
          author = 'Mark Bakker',  
          author_email = 'mark.bakker@tudelft.nl',  
          url = 'https://github.com/mbakker7/timml',  
          license = 'MIT',  
          ext_modules = [ext]  
          )  
mbakker7 commented 8 years ago

Dear Justin,

Thanks for the PR. Any way it can be modified so that it installs the pre-compiled FORTRAN extension when people have either Windows or Mac (with 64 bits Python)?

Mark

On Wed, Aug 17, 2016 at 5:47 PM, Justin Jent notifications@github.com wrote:

I opened a pull request https://github.com/mbakker7/timml/pull/3 that uses setup utilities from numpy for building and distributing fortran extensions. That should help in the future for anyone trying to install TimML from source.

from future import division, absolute_import, print_function from timml import version from numpy.distutils.core import Extension

ext = Extension(name = 'besselaes', sources = ['src/besselaes.f90'])

if name == "main": from numpy.distutils.core import setup setup(name = 'timml', version=version, packages = ['timml'], install_requires = ['numpy>=1.9', 'scipy', 'matplotlib>=1.4'], description = "TimML, A Multi-Layer, Analytical Element Model", author = 'Mark Bakker', author_email = 'mark.bakker@tudelft.nl', url = 'https://github.com/mbakker7/timml', license = 'MIT', ext_modules = [ext] )

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-240455300, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyPAvWeqtqOsfn-0J9c-ggoTYI8iiks5qgy0sgaJpZM4JeC3f .

jentjr commented 7 years ago

Dear Mark,

I am not sure, but perhaps the best way to do this would be to use conda to build and distribute the package for all platforms. I do not believe the pre-compiled fortran extensions can be installed through setup.py. As you pointed out the user must have f2py installed to compile from sourece.

Justin

mbakker7 commented 7 years ago

I was thinking the same, Justin.

Just haven't found the time to dive into conda-forge to get it up and running. You don't happen to have an example do you (-:

Best regards,

Mark

On Sun, Mar 19, 2017 at 9:22 PM, Justin Jent notifications@github.com wrote:

Dear Mark,

I am not sure, but perhaps the best way to do this would be to use conda to build and distribute the package https://conda.io/docs/building/bpp.html for all platforms. I do not believe the pre-compiled fortran extensions can be installed through setup.py. As you pointed out the user must have f2py installed to compile from sourece.

Justin

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-287644552, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyMWUtNaV2unPhL2-boq6T16G_9J4ks5rnY6DgaJpZM4JeC3f .

jentjr commented 7 years ago

I messed around and was able to start a build recipe, and pushed it here. In the meta.yaml file I had to use the fork of timml in my repo since it has the setup.py file, and I bumped the version number to 4.0.5. The package can be installed with conda install -c jentjr timml. I had to use the force flag with anaconda convert to build the package for windows and osx, and I have no idea if they will work. I can test it tomorrow.

mbakker7 commented 7 years ago

Thanks, Justin!

If you can test it, that would be awesome! I can test it here too, but not until Wednesday (when I have access to PCs). Will try a Mac today.

Mark

On Mon, Mar 20, 2017 at 1:17 AM, Justin Jent notifications@github.com wrote:

I messed around and was able to start a build recipe, and pushed it here https://github.com/jentjr/staged-recipes/tree/master/recipes/timml. In the meta.yaml file I had to use the fork of timml in my repo since it has the setup.py file, and I bumped the version number to 4.0.5. The package can be installed with conda install -c jentjr timml. I had to use the force flag with anaconda convert to build the package for windows and osx, and I have no idea if they will work. I can test it tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-287659885, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyPHkG9sdHwrtGjto9PiimdVGHoRvks5rncWcgaJpZM4JeC3f .

mbakker7 commented 7 years ago

Hey Justin,

Doesn't work on a Mac, unfortunately, While loading the bessel.so file, I get

from besselaes import *

ImportError: dlopen(/Users/mark/anaconda/lib/python2.7/site-packages/besselaes.so, 2): no suitable image found. Did find:

/Users/mark/anaconda/lib/python2.7/site-packages/besselaes.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

So it looks for besselaes.so in ../sitepackages/ while it should look in ../sitepackages/timml.

But the additional problem is that besselaes.so cannot be opened. I located the file and it does indeed not import. I am not sure how this file was created. How did you do that and can do you have any idea how to fix it?

Thanks,

Mark

On Mon, Mar 20, 2017 at 10:20 AM, Mark Bakker markbak@gmail.com wrote:

Thanks, Justin!

If you can test it, that would be awesome! I can test it here too, but not until Wednesday (when I have access to PCs). Will try a Mac today.

Mark

On Mon, Mar 20, 2017 at 1:17 AM, Justin Jent notifications@github.com wrote:

I messed around and was able to start a build recipe, and pushed it here https://github.com/jentjr/staged-recipes/tree/master/recipes/timml. In the meta.yaml file I had to use the fork of timml in my repo since it has the setup.py file, and I bumped the version number to 4.0.5. The package can be installed with conda install -c jentjr timml. I had to use the force flag with anaconda convert to build the package for windows and osx, and I have no idea if they will work. I can test it tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-287659885, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyPHkG9sdHwrtGjto9PiimdVGHoRvks5rncWcgaJpZM4JeC3f .

jentjr commented 7 years ago

Mark,

Thanks for the feedback. I modified the setup.py file so now besselaes.so is under the timml directory. I ran the example on linux and the imports worked correctly.

To build the conda package I ran conda build timml --numpy=1.12 --python=2.7 inside the recipes directory of my staged-recipes fork. Then, I created a new environment coda create -n timml_test python=2.7, activated the environment with source activate timml_test, then installed the local build with conda install --use-local timml to test it.

I uploaded the new package to my Anaconda.org channel, but I again had to use the -force flag to convert to other platforms, and that is probably why you are not able to open the besselaes.so file. conda convert --platform all /home/jentjr/anaconda3/conda-bld/linux-64/timml-4.0.5-py27_0.tar.bz2 -f

I am having trouble specifying the fortran compiler on my windows machine at work to build the package, but from the conda-forge getting started section copied below, it looks like if you submit a pull request for the staged-recipe, it will be built and tested on windows, linux, and osx. So, I wonder if it would pass.

** Getting started

Fork this repository. Make a new folder in recipes for your package. Look at the example recipe and our FAQ for help. Open a pull request. Building of your package will be tested on Windows, Mac and Linux. When your pull request is merged a new repository, called a feedstock, will be created in the github conda-forge organization, and build/upload of your package will automatically be triggered. Once complete, the package is available on conda-forge. **

Would you want to accept my changes to timml, and modify the staged-recipe to point towards your account, then submit the pull request to see if the builds would work? Or, if it is okay with you, I could submit the pull request to make sure before you merge my changes. I'll keep trying to build on windows too.

Thanks,

Justin

mbakker7 commented 7 years ago

Thanks, Justin.

I will tend to this next week. Gotta finish some other stuff first.

So I'll get back to you about this,

Mark

On Wed, Mar 22, 2017 at 5:52 AM, Justin Jent notifications@github.com wrote:

Mark,

Thanks for the feedback. I modified the setup.py file so now besselaes.so is under the timml directory. I ran the example on linux and the imports worked correctly.

To build the conda package I ran conda build timml --numpy=1.12 --python=2.7 inside the recipes directory of my staged-recipes https://github.com/jentjr/staged-recipes fork. Then, I created a new environment coda create -n timml_test python=2.7, activated the environment with source activate timml_test, then installed the local build with conda install --use-local timml to test it.

I uploaded the new package to my Anaconda.org channel, but I again had to use the -force flag to convert to other platforms, and that is probably why you are not able to open the besselaes.so file. conda convert --platform all /home/jentjr/anaconda3/conda- bld/linux-64/timml-4.0.5-py27_0.tar.bz2 -f

I am having trouble specifying the fortran compiler on my windows machine at work to build the package, but from the conda-forge getting started section copied below, it looks like if you submit a pull request for the staged-recipe, it will be built and tested on windows, linux, and osx. So, I wonder if it would pass.

** Getting started

Fork this repository. Make a new folder in recipes for your package. Look at the example recipe and our FAQ for help. Open a pull request. Building of your package will be tested on Windows, Mac and Linux. When your pull request is merged a new repository, called a feedstock, will be created in the github conda-forge organization, and build/upload of your package will automatically be triggered. Once complete, the package is available on conda-forge. **

Would you want to accept my changes to timml, and modify the staged-recipe to point towards your account, then submit the pull request to see if the builds would work? Or, if it is okay with you, I could submit the pull request to make sure before you merge my changes. I'll keep trying to build on windows too.

Thanks,

Justin

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mbakker7/timml/issues/2#issuecomment-288298184, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTNyBHY66enVkO1HhvnGTnEZcxIy3iDks5roKkBgaJpZM4JeC3f .