COSMIC-PopSynth / COSMIC

COSMIC (Compact Object Synthesis and Monte Carlo Investigation Code)
GNU General Public License v3.0
47 stars 59 forks source link

Error on installation #67

Closed astroJeff closed 5 years ago

astroJeff commented 5 years ago

After a successful installation of cosmic (both with and without conda), I run into a problem when python tries to compile cosmic.evolve upon testing:

.. ipython::

In [1]: from cosmic.sample.initialbinarytable import InitialBinaryTable

In [2]: from cosmic.evolve import Evolve

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-7a3a9e49da00> in <module>()
----> 1 from cosmic.evolve import Evolve

/Users/jeffandrews/Research/COSMIC/cosmic/evolve.py in <module>()
     22 import numpy as np
     23 from gwpy.utils import mp as mp_utils
---> 24 from cosmic import _evolvebin
     25 import pandas as pd
     26 from astropy.table import Table

ImportError: cannot import name '_evolvebin'

I suspect I am missing a step in either creating or linking the fortran executable to be run by the python wrapper. Any suggestions?

michaelzevin commented 5 years ago

Hi Jeff,

This happened to me too. The solution is initiating your ipython session outside of the main github repo’s base directory. Then it should work fine.

We should open up an issue for this.

Best, mike

On Mon, Nov 12, 2018 at 05:48 Jeff Andrews notifications@github.com wrote:

After a successful installation of cosmic (both with and without conda), I run into a problem when python tries to compile cosmic.evolve upon testing:

.. ipython::

In [1]: from cosmic.sample.initialbinarytable import InitialBinaryTable

In [2]: from cosmic.evolve import Evolve


ImportError Traceback (most recent call last)

in () ----> 1 from cosmic.evolve import Evolve /Users/jeffandrews/Research/COSMIC/cosmic/evolve.py in () 22 import numpy as np 23 from gwpy.utils import mp as mp_utils ---> 24 from cosmic import _evolvebin 25 import pandas as pd 26 from astropy.table import Table ImportError: cannot import name '_evolvebin' I suspect I am missing a step in either creating or linking the fortran executable to be run by the python wrapper. Any suggestions? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or mute the thread . --

Michael Zevin PhD Candidate - Northwestern University Department of Physics and Astronomy CIERA - Center for Interdisciplinary Exploration and Research in Astrophysics

astroJeff commented 5 years ago

That makes sense. I feel like I should have realized that sooner.

So the problem is that when we open up (I)python within the base directory, it searches /COSMIC/cosmic/ for the fortran executable. I am putting together a script to the end of setup.py that creates a symbolic link to the fortran executable and places it in COSMIC/cosmic/, but it's a bit ugly.

If this is something we think is important, I am happy to finish up the script and submit a pull request.

scottcoughlin2014 commented 5 years ago

@astroJeff To be honest, I am not sure what the proper software protocol is here. I will like check with stack exchange of PyPi or whatever on setup.py again about compiling fortran wrapper and see what they say to do and get back to you about that PR.

scottcoughlin2014 commented 5 years ago

Closing because one can run python setup.py build_ext --inplace and get it built in GITHUB folder.