keflavich / pyradex

Python interface to RADEX
BSD 3-Clause "New" or "Revised" License
18 stars 12 forks source link

Installing, when python3 is the default system python #6

Closed privong closed 9 years ago

privong commented 9 years ago

I have been unsuccessfully trying to install pyradex. I am on Arch Linux, which uses python3 as the system default (/usr/bin/python --version is "Python 3.4.2"), yet I use python2 for my astronomy installs, since it seems to be more widely useful. Following the instructions in INSTALL.rst, I try something like the following:

$ python2 setup.py install_radex install_myradex install

The build fails (for reasons which I have not yet ascertained), but from the log it is fairly clear that it is attempting to build against python3.4 instead of python2.7, despite the invocation. I tried changing the #!/usr/bin/env python to #!/usr/bin/env python2, where I could find them, but it still seems to build against python3.4. Any ideas as to how to force python2 for the install?

keflavich commented 9 years ago

This probably has to do with one of the system calls, which I hadn't realized would be an issue. A quick fix might be to try:

PATH=/path/to/python2/:$PATH python2 setup.py install_radex install_myradex install

i.e., put python2 on your path ahead of python3, but... if they're in the same directory, that won't work. I'll have a look at the install scripts; it might be helpful if you put the full failure information into a pastebin.

privong commented 9 years ago

Yeah, python2 and python3 are in the same directory.

Here's the radex_build.log file: http://pastebin.com/DvgxJSjx

It does create a "radex.cpython-34m.so" file, but then fails because it cannot find "radex.so" file to install. Is that the same file, but created with the wrong name?

Other potentially useful info

$ python2 -c "import sys, astropy, numpy; print(sys.version); print(numpy.__version__,astropy.__version__)"
2.7.8 (default, Sep 24 2014, 18:26:21) 
[GCC 4.9.1 20140903 (prerelease)]
('1.9.0', '0.4.2')
$ gfortran --version
GNU Fortran (GCC) 4.9.2
keflavich commented 9 years ago

OK, thanks.

I'm trying to dig into this problem, which is essentially that I was calling os.system('f2py ...') but f2py is remarkably badly documented so I'm having trouble.

privong commented 9 years ago

Manually changing the relevant lines in install_radex.py from "f2py" to "f2py2" seems to get me a bit farther in the install. But then I encounter:

running install_myradex
make: *** No rule to make target 'wrapper'.  Stop.
keflavich commented 9 years ago

@privong - try the attached installer. It should use the appropriate compiler and source now.

keflavich commented 9 years ago

I don't think it will work for myradex though. That's going to take a little more work.

privong commented 9 years ago

Thanks @keflavich. That installer worked for me.

Is there any additional info I can provide for myradex?

keflavich commented 9 years ago

No, the problem for myRadex is that it's built with a Makefile at the moment. The best thing would be to replace the f2py command in https://github.com/fjdu/myRadex/blob/master/makefile#L15 with a python version. Now that I look, though, I think I changed f2py-2.7 in the original to f2py for my own system; you could edit myRadex/makefile and change f2py to f2py-2.7 (or whatever yours is called) and see if that works.

privong commented 9 years ago

Great, thanks. That worked, and it seems to have installed properly.

As an aside, I was installing from a cloned repo so I also needed to clone myRadex into pyradex/myRadex. I am not sure if it was mentioned elsewhere, but it might be worth adding to INSTALL.rst.

keflavich commented 9 years ago

OK, great.

That last bit is included in the install instructions in the README: https://github.com/keflavich/pyradex#installation-procedure-for-the-f2py-wrapped-version but the instructions are different if you had cloned this repository previously, so I'll add that

privong commented 9 years ago

Oops, I'd missed that. Sorry.

keflavich commented 9 years ago

Since this worked, I'll merge it and open a fresh Issue for the installation instructions