[Tutor] Python Help

Cameron Simpson cs at zip.com.au
Sat Jul 22 21:34:59 EDT 2017


On 23Jul2017 00:20, Alan Gauld <alan.gauld at yahoo.co.uk> wrote:
>On 22/07/17 19:14, Winonah Ojanen wrote:
>> using python with anaconda in jupiter notebook. However, I am having
>
>Usual caveat: The tutor list is targeted at the standard library
>so any help for non standard library modules is best sought from
>the library support fora. In this case that includes the SciPy forum
>and any illustris one.

Though arguably the OP's problem is an import issue, not really module 
specific.

>That having been said, I'll take a guess...
>> $ mkdir Illustris-3
>> $ mkdir Illustris-3/groups_135
>Are these folders in your PYTHONPATH? If not Python will not find them.
>
>> import illustris_python as il
>> ---------------------------------------------------------------------------
>> ModuleNotFoundError                       Traceback (most recent call last)

The OP cded into the new dir; I'd normally expect things to be found if the 
module was a local file/dir. However...

>> For some reason the computer is not recognizing this as a file on my
>> computer. The CCA folks says this is a coding problem and not an illustris
>> problem. any ideas to get me past this? I may also need help getting
>> farther into the download process.

I just ran the OP's download command:

  wget -nd -nc -nv -e robots=off -l 1 -r -A hdf5 --content-disposition --header="API-Key: d522db2e1b33e36d3b365cc9ac1c2c5d" "http://www.illustris-project.org/api/Illustris-3/files/groupcat-135/?format=api"

This doesn't seem to download any Python code at all. It does get a couple of 
HDF files, presumably with data to work with.

So the issue is initially that the module isn't present anywhere. Looking at 
the instructions cited <http://www.illustris-project.org/data/docs/scripts/>, 
they only cover fetching som data and working; they presume the software is 
already present. I don't immediately see actual software installation 
instructions, and it is not presented in PyPI.

Most like the OP will have to install the software directly from:

  https://bitbucket.org/illustris/illustris_python

This command:

  hg clone https://bitbucket.org/illustris/stris_pythonillustris_python

should produce an "illustris_python" in the current directory, and then her 
import command will find it.

However, there are other prerequisites. This pip command:

  pip install h5py numpy

seems to resolve them. The OP will need to use Python 2 because the module 
seems to rely on a relative import (for its "util.py" file).

Cheers,
Cameron Simpson <cs at zip.com.au>


More information about the Tutor mailing list