mbakker7 / ttim

MIT License
34 stars 23 forks source link

Support for OSX and Linux on master branch #13

Closed rosskush closed 5 years ago

rosskush commented 5 years ago

I am not able to install ttim on linux or mac, it has to do with bessel.f95 and invlap.f95, but I was able to use someone else's forked version that supports these. however, the fork is from some time ago and is not up to date with the current master. Will it ever be added to the master branch?

This is the branch I took from to get it to work on Mac and Linux https://github.com/jentjr/ttim/tree/ci_build_branch

mbakker7 commented 5 years ago

The current installer works for Python 3.6 and not for Python 3.7. So if you can downgrade to 3.6 (or make virtualenv) then you can run the latest release!

I am in the process of re-writing the FORTRAN extension to Numba. When that is completed, TTim will be pure Python and installation will be much easier. Sorry for the trouble.

mbakker7 commented 5 years ago

Oh, just noticed, you said linux and mac. For those you need to compile the fortran extension. It is easy if you have a fortran compiler installed. Let me know if you do and I can send you instructions.

rosskush commented 5 years ago

Oh may just wait it out for a pure python version then, but here is an example of what's happening.

I am using conda and I made a new environment with 3.6 and I am running this on Ubuntu for Windows 10, (the same issue happens on my mac too)

I also use gcc for my Fortran compiler and I have it in my path environments so I think it should be able to read those 2 Fortran files.

(py36ttim) rkushnereit@AUS-Thorium:~$ conda list
# packages in environment at /home/rkushnereit/anaconda3/envs/py36ttim:
#
# Name                    Version                   Build  Channel
asteval                   0.9.13                    <pip>
ca-certificates           2019.1.23                     0
certifi                   2019.3.9                 py36_0
cycler                    0.10.0                    <pip>
kiwisolver                1.0.1                     <pip>
libedit                   3.1.20181209         hc058e9b_0
libffi                    3.2.1                hd88cf55_4
libgcc-ng                 8.2.0                hdf63c60_1
libstdcxx-ng              8.2.0                hdf63c60_1
lmfit                     0.9.13                    <pip>
matplotlib                3.0.3                     <pip>
ncurses                   6.1                  he6710b0_1
numpy                     1.16.3                    <pip>
openssl                   1.1.1b               h7b6447c_1
pip                       19.0.3                   py36_0
pyparsing                 2.4.0                     <pip>
python                    3.6.8                h0371630_0
python-dateutil           2.8.0                     <pip>
readline                  7.0                  h7b6447c_5
scipy                     1.2.1                     <pip>
setuptools                41.0.0                   py36_0
six                       1.12.0                    <pip>
sqlite                    3.27.2               h7b6447c_0
tk                        8.6.8                hbc83047_0
ttim                      0.4.0                     <pip>
uncertainties             3.0.3                     <pip>
wheel                     0.33.1                   py36_0
xz                        5.2.4                h14c3975_4
zlib                      1.2.11               h7b6447c_3

#Then I try to run an import on ttim and get this.  

(py36ttim)` rkushnereit@AUS-Thorium:~$ python -c "import ttim"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/rkushnereit/anaconda3/envs/py36ttim/lib/python3.6/site-packages/ttim/__init__.py", line 17, in <module>
    from .model import ModelMaq, Model3D
  File "/home/rkushnereit/anaconda3/envs/py36ttim/lib/python3.6/site-packages/ttim/model.py", line 3, in <module>
    from .invlap import *
ModuleNotFoundError: No module named 'ttim.invlap'
(py36ttim) rkushnereit@AUS-Thorium:~$

But when I pull the repo I linked above and run a python setup.py install on it, I can get it working out of the box.

Maybe it has to do with my conda paths? But I don't see how. Appreciate the help

jentjr commented 5 years ago

I believe it has to do with the setup.py file. You could use f2py to compile the module directly by trying something like python -m numpy.f2py -c -m invlap invlap.f95 for each of the source files.

I also just merged the recent changes from the master branch to my fork if you need it before the re-write to numba is complete.

rosskush commented 5 years ago

Awesome!

using

python -m numpy.f2py -c -m invlap invlap.f90
python -m numpy.f2py -c -m bessel bessel.f95

then running python setup.py install seems to work.

at least it is letting me import ttim when I run python -c "import ttim"

Thanks for the help, and hopefully this helps others with a similar issue.