[IPython-dev] %install_ext question
Tue Apr 9 11:56:41 CDT 2013
Ah, sorry, I had got confused. Python can *run* a zip file containing a
__main__.py file. It can't import a zip file.
So, for now, carry on using pip to install anything bigger than a single
On 9 April 2013 17:43, Greg Novak <email@example.com> wrote:
> Sorry for the delay in responding to this.
> If I just put the zip file in a directory on sys.path, I can't import it.
> I tried it both where the zip file contained the leading directory (so
> grasp/grasp.py and grasp/__init__.py) and also where the zip file just
> contained grasp.py and __init__.py at the top level.
> But if I put the zip file itself on the path via sys.path +=
> ['blah/blah/grasp.zip'] then I can import grasp using either of the two zip
> file structures above.
> On Wed, Apr 3, 2013 at 2:36 PM, Thomas Kluyver <firstname.lastname@example.org> wrote:
>> On 3 April 2013 13:12, Greg Novak <email@example.com> wrote:
>>> It does indeed put the file into .ipython/extensions, but then to use it
>>> I need to put the zip file in sys.path explicitly. Just having the zip
>>> file in the extensions directory isn't enough. So if I also do:
>>> import sys
>>> sys.path += ["/Users/novak/.ipython/extensions/grasp.zip"]
>> Is the zip file itself importable? i.e. if you put the directory
>> containing the zip file on your PYTHONPATH, can you do 'import grasp'? I
>> think it needs to be structured so that the top level of the zip file
>> contains an __init__.py file.
>> But it's fine to install using pip instead - it's a deliberate feature
>> that an extension is simply any importable module with a
>> load_ipython_extension() function at the top level. Sympy, for example,
>> includes an IPython extension as part of its installation.
>> IPython-dev mailing list
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev