tflorac
tflorac

Reputation: 67

IPython notebook in zc.buildout not using eggs path

I've build an environment with zc.buildout including IPython script.

My problem is simple:

Is there any way to include all my eggs while starting notebook?

Regards,

Thierry

Upvotes: 1

Views: 228

Answers (1)

Chris Withers
Chris Withers

Reputation: 11111

So, I guess somewhere in the notebook startup a process is forked, which means sys.path will get reset and buildout's tricks won't help.

I solved the problems as follows, although it's a bit dirty:

  1. Create an entry point as follows:

    setup(...
          entry_points = {
              'console_scripts': ['ipython = <yourpackage>.ipython:main']
          })
    
  2. Put the following in /ipython.py:

    from IPython.frontend.terminal.ipapp import launch_new_instance
    import os
    import sys
    
    def main():
        os.environ['PYTHONPATH']=':'.join(sys.path)
        sys.exit(launch_new_instance())
    

Now, running bin/ipython notebook will give you the sys.path you expect.

Upvotes: 1

Related Questions