novelistparty
novelistparty

Reputation: 404

Ipython notebook. %pylab load error in Windows 7

I run Windows 7, Enthought Python Distribution 7.3-2 Academic.
I open a command prompt, change to my code directory and type

U:\rsch>ipython notebook

In a new notebook, I type %pylab and receive the following error:

In [1]: %pylab

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
U:\rsch\<ipython-input-1-5c1faa999e5b> in <module>()
----> 1 get_ipython().magic(u'pylab')

D:\Python27\lib\site-packages\IPython\core\interactiveshell.pyc in magic(self, arg_s, next_input)
   1983                 self._magic_locals = sys._getframe(1).f_locals
   1984             with self.builtin_trap:
-> 1985                 result = fn(magic_args)
   1986             # Ensure we're not keeping object references around:

   1987             self._magic_locals = {}

D:\Python27\lib\site-packages\IPython\core\magic.pyc in magic_pylab(self, s)
   3471             import_all_status = True
   3472 
-> 3473         self.shell.enable_pylab(s, import_all=import_all_status)
   3474 
   3475     def magic_tb(self, s):

D:\Python27\lib\site-packages\IPython\core\interactiveshell.pyc in enable_pylab(self, gui, import_all)
   2592         ns = {}
   2593         try:
-> 2594             gui = pylab_activate(ns, gui, import_all, self)
   2595         except KeyError:
   2596             error("Backend %r not supported" % gui)

D:\Python27\lib\site-packages\IPython\core\pylabtools.pyc in pylab_activate(user_ns, gui, import_all, shell)
    327     itself, and will be needed next to configure IPython's gui integration.
    328     """
--> 329     gui, backend = find_gui_and_backend(gui)
    330     activate_matplotlib(backend)
    331     import_pylab(user_ns, import_all)

D:\Python27\lib\site-packages\IPython\core\pylabtools.pyc in find_gui_and_backend(gui)
    194     """
    195 
--> 196     import matplotlib
    197 
    198     if gui and gui != 'auto':

D:\Python27\lib\site-packages\matplotlib\__init__.py in <module>()
    131 import sys, os, tempfile
    132 
--> 133 from matplotlib.rcsetup import (defaultParams,
    134                                 validate_backend,
    135                                 validate_toolbar,

D:\Python27\lib\site-packages\matplotlib\rcsetup.py in <module>()
     17 import warnings
     18 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
---> 19 from matplotlib.colors import is_color_like
     20 
     21 #interactive_bk = ['gtk', 'gtkagg', 'gtkcairo', 'fltkagg', 'qtagg', 'qt4agg',


D:\Python27\lib\site-packages\matplotlib\colors.py in <module>()
     50 """
     51 import re
---> 52 import numpy as np
     53 from numpy import ma
     54 import matplotlib.cbook as cbook

D:\Python27\lib\site-packages\numpy\__init__.pyc in <module>()
    141         return loader(*packages, **options)
    142 
--> 143     import add_newdocs
    144     __all__ = ['add_newdocs']
    145 

D:\Python27\lib\site-packages\numpy\add_newdocs.py in <module>()
      7 #       core/fromnumeric.py, core/defmatrix.py up-to-date.

      8 
----> 9 from numpy.lib import add_newdoc
     10 
     11 ###############################################################################


D:\Python27\lib\site-packages\numpy\lib\__init__.py in <module>()
     11 
     12 import scimath as emath
---> 13 from polynomial import *
     14 #import convertcode

     15 from utils import *

D:\Python27\lib\site-packages\numpy\lib\polynomial.py in <module>()
     15 from numpy.lib.function_base import trim_zeros, sort_complex
     16 from numpy.lib.type_check import iscomplex, real, imag
---> 17 from numpy.linalg import eigvals, lstsq
     18 
     19 class RankWarning(UserWarning):

D:\Python27\lib\site-packages\numpy\linalg\__init__.py in <module>()
     46 from info import __doc__
     47 
---> 48 from linalg import *
     49 
     50 from numpy.testing import Tester

D:\Python27\lib\site-packages\numpy\linalg\linalg.py in <module>()
     21         isfinite, size, finfo, absolute, log, exp
     22 from numpy.lib import triu
---> 23 from numpy.linalg import lapack_lite
     24 from numpy.matrixlib.defmatrix import matrix_power
     25 from numpy.compat import asbytes

ImportError: DLL load failed: The specified path is invalid.

Not sure what to do. Thanks.

Upvotes: 1

Views: 1503

Answers (4)

Adam
Adam

Reputation: 11

I experienced the same problem and here is what worked for me:

  1. I made sure I call the IPython without "pylab"
  2. I then made sure all sessions/instances (excuse me but I'm new to this :) are closed. You can do this by ctrl-C in all Terminals and in the Notebook dashboard press "shutdown" if possible.

There are probably more elegant ways to do this but this is what worked for me.

Developers, take note that many newbies might get very frustrated when the first notebook they try to run gives them an error.

Adam

Upvotes: 1

Rutger Kassies
Rutger Kassies

Reputation: 64443

Unfortunately these error messages arent really useful. From the message you only know that 'some dll' fails to import during the import of "lapack_lite" (part of Numpy).

You can use Dependency Walker to see which specific DLL is causing the problem, opening "D:\Python27\Lib\site-packages\numpy\linalg\lapack_lite.pyd" might reveal some more information.

Upvotes: 0

Jonathan March
Jonathan March

Reputation: 5810

EPD shipped with ipython 0.12. Ipython has developed a lot since then. You should update to ipython 0.13.1 by entering "enpkg ipython", as described in more detail here: https://support.enthought.com/entries/22415022-Using-enpkg-to-update-EPD-packages

Upvotes: 0

Tony S Yu
Tony S Yu

Reputation: 3173

It's likely that you're missing the Scripts directory in your system path. To check, run

echo %PATH%

from the command prompt and look for D:\Python27\Scripts. If it's missing, you can add it manually from the Control Panel, or using a utility like Rapid Environment Editor.

Upvotes: 0

Related Questions