My python import statements have become extremely slow. I am using python 2.7 locally using the Anaconda package. After importing the modules, the code that I wrote runs very quickly, it's just an import that takes forever.
As an example, I ran the file "tester.py" with the following code:
import timeit x = timeit.timeit('import numpy as np') print 'imported numpy in %s seconds'%x x = timeit.timeit('import pandas as pd') print 'imported pandas in %s seconds'%x x = timeit.timeit('from Tkinter import Frame,Tk, Label, Checkbutton') print 'imported Tkinter in %s seconds'%x x = timeit.timeit('from tkFileDialog import askopenfilenames, asksaveasfilename') print 'imported tkFileDialog in %s seconds'%x x = timeit.timeit('import tkMessageBox') print 'imported tkMessageBox in %s seconds'%x x = timeit.timeit('import os') print 'imported os in %s seconds'%x
Exit from the command line:
C:\Users\***\AppData\Local\Continuum\Anaconda>C:\Users\***\Desktop\tester.py imported numpy in 5.22607264113 seconds imported pandas in 13.7990192174 seconds imported Tkinter in 3.95690550577 seconds imported tkFileDialog in 3.62803133249 seconds imported tkMessageBox in 1.50766849631 seconds imported os in 1.87009742139 seconds
How can I diagnose what is happening and / or speed up import? I'm not quite sure where to start ... Maybe reinstall Anaconda? Any ideas or ideas are greatly appreciated.
source share