[Tutor] Fwd: Re: Python Help
Alan Gauld
alan.gauld at yahoo.co.uk
Sun Jul 23 16:45:45 EDT 2017
Forwarding to list,
please use ReplyAll or ReplyList when responding to the list.
-------- Forwarded Message --------
I also tried the correct command for the mac ox s in terminal shell,
running:
Jims-MacBook-Pro-2:~ Jim$
PYTHONPATH="/Users/Jim/Documents/illustris_python:$PYTHONPATH
> export PYTHONPATH
no error messages there but it is still not finding the module through
python.
Winonah
On Sun, Jul 23, 2017 at 1:34 PM, Winonah Ojanen <winonah1992 at gmail.com
<mailto:winonah1992 at gmail.com>> wrote:
I did use the pip command and am attempting to add the files to my
python path. I used
import sys
sys.path.append("/Users/Jim/Documents/illustris_python")
and that worked. I even checked to make sure the files were there
import sys
print (sys.path)
['', '/Users/Jim/anaconda/lib/python36.zip',
'/Users/Jim/anaconda/lib/python3.6',
'/Users/Jim/anaconda/lib/python3.6/lib-dynload',
'/Users/Jim/anaconda/lib/python3.6/site-packages',
'/Users/Jim/anaconda/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg',
'/Users/Jim/anaconda/lib/python3.6/site-packages/aeosa',
'/Users/Jim/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg',
'/Users/Jim/anaconda/lib/python3.6/site-packages/IPython/extensions',
'/Users/Jim/.ipython', 'Users/Jim/Documents/illustris_python']
the file is clearly there but when i try to do import
illustris_python as il it still can't find the module.
Note that only shows the folder is in the path.
What does an 'ls' listing reveal as to the contents of the folder?
Is there a file called illustris_python.py? or maybe illustris_python.pyc?
I also figured that I need to manually export to python path so i tried:
export PYTHONPATH=$PYTHONPATH:/Users/Jim/Documents/illustris_python/
File "<ipython-input-14-30d153a77da5>", line 1
export PYTHONPATH=$PYTHONPATH:/Users/Jim/Documents/illustris_python/
^
SyntaxError: invalid syntax
I got invalid syntax... using a mac os x
I tried typing in terminal open .bash_profile and telling it to
export the python path in there like some others recommended but in
terminal it is giving me an error message for that... it must not be
the right command for the shell.
Winonah
On Sat, Jul 22, 2017 at 9:34 PM, Cameron Simpson <cs at zip.com.au
<mailto:cs at zip.com.au>> wrote:
On 23Jul2017 00:20, Alan Gauld <alan.gauld at yahoo.co.uk
<mailto: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
<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/
<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
<https://bitbucket.org/illustris/illustris_python>
This command:
hg clone
https://bitbucket.org/illustris/stris_pythonillustris_python
<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 <mailto:cs at zip.com.au>>
_______________________________________________
Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
<https://mail.python.org/mailman/listinfo/tutor>
More information about the Tutor
mailing list