i am stuck in this error, i know the function "clock" has removed, but the problem is, i cant find the function code in the code
code:
import imageio
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from skimage.transform import resize
from IPython.display import HTML
import warnings
warnings.filterwarnings("ignore")
source_image =imageio.imread(r"C:\Users\jpdyb\Documents\first-order\workspace\02.png")
reader =imageio.get_reader(r"C:\Users\jpdyb\Documents\first-order\workspace\04.mp4")
#Resize image and video to 256x256
source_image = resize(source_image, (256, 256))[..., :3]
fps = reader.get_meta_data()['fps']
driving_video = [r"C:\Users\jpdyb\Documents\first-order\workspace\04.mp4"]
try:
for im in reader:
driving_video.append(im)
except RuntimeError:
pass
reader.close()
driving_video = [resize(frame, (256, 256))[..., :3] for frame in driving_video]
def display(source, driving, generated=None):
fig = plt.figure(figsize=(8 + 4 * (generated is not None), 6))
ims = []
for i in range(len(driving)):
cols = [source]
cols.append(driving[i])
if generated is not None:
cols.append(generated[i])
im = plt.imshow(np.concatenate(cols, axis=1), animated=True)
plt.axis('off')
ims.append([im])
ani = animation.ArtistAnimation(fig, ims, interval=50, repeat_delay=1000)
plt.close()
return ani
HTML(display(source_image, driving_video).to_html5_video())
error (python):
Traceback (most recent call last):
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\utils\timing.py", line 27, in <module>
import resource
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'resource'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\jpdyb\Documents\first-order\python system\load images.py", line 6, in <module>
from IPython.display import HTML
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\terminal\ipapp.py", line 30, in <module>
from IPython.core.magics import ScriptMagics
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\core\magics\__init__.py", line 21, in <module>
from .execution import ExecutionMagics
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\core\magics\execution.py", line 46, in <module>
from IPython.utils.timing import clock, clock2
File "C:\Users\jpdyb\AppData\Roaming\Python\Python39\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\jpdyb\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\utils\timing.py", line 64, in <module>
clocku = clocks = clock = time.clock
AttributeError: module 'time' has no attribute 'clock'
my setup is
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
I have scipy 0.17 and cartopy '0.14.2'.
All I'm trying to do is
plt.axes(projection=ccrs.PlateCarree())
and it leads to this:
Traceback (most recent call last):
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-93-636aeb1a7fc6>", line 1, in <module>
plt.axes(projection=ccrs.PlateCarree())
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/matplotlib/pyplot.py", line 867, in axes
return subplot(111, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/matplotlib/pyplot.py", line 1022, in subplot
a = fig.add_subplot(*args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/matplotlib/figure.py", line 987, in add_subplot
self, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/matplotlib/projections/__init__.py", line 100, in process_projection_requirements
projection_class, extra_kwargs = projection._as_mpl_axes()
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/cartopy/crs.py", line 150, in _as_mpl_axes
import cartopy.mpl.geoaxes as geoaxes
File "/opt/pycharm-2016.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/cartopy/mpl/geoaxes.py", line 52, in <module>
from cartopy.vector_transform import vector_scalar_to_grid
File "/opt/pycharm-2016.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/cartopy/vector_transform.py", line 26, in <module>
from scipy.interpolate import griddata
File "/opt/pycharm-2016.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/scipy/interpolate/__init__.py", line 158, in <module>
from .interpolate import *
File "/opt/pycharm-2016.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/scipy/interpolate/interpolate.py", line 12, in <module>
import scipy.special as spec
File "/opt/pycharm-2016.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/scipy/special/__init__.py", line 629, in <module>
from .basic import *
File "/opt/pycharm-2016.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/usr/local/anaconda2/envs/myenv3/lib/python3.5/site-packages/scipy/special/basic.py", line 14, in <module>
from ._ufuncs import (ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma, psi, zeta,
ImportError: cannot import name 'zeta'
Deep down this appears to be a scipy problem, but I have the newest there - what's going on here?
It turned out to be a problem with the scipy installation coming from conda. Creating a new environment and freshly installing scipy solved the issue.
I want to create an executable file from pyqtgraph,
finally I tried this tutorial
http://www.pyqtgraph.org/Bundling%20applications%20with%20PyQtGraph_R16.pdf
After the first run of the compiled code in the example the tutorial says that there should be an error message like
Traceback (most recent call last):
File "simpleApp.pyw", line 6, in <module>
File "pyqtgraph\__init__.pyc", line 107, in <module>
File "pyqtgraph\__init__.pyc", line 89, in importAll
WindowsError: [Error 3] The system cannot find the path specified:
'D:\\xxxxxx\\SandBox\\src\\dist\\library.zip\\pyqtgraph\\graphicsItems/*.*'
But I got that
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 246, in <module>
File "scipy\stats\distributions.pyc", line 16, in <module>
File "scipy\optimize\__init__.pyc", line 148, in <module>
File "scipy\optimize\_root.pyc", line 20, in <module>
File "scipy\optimize\nonlin.pyc", line 122, in <module>
File "scipy\sparse\__init__.pyc", line 193, in <module>
File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path
(scipy\sparse \csgraph\_shortest_path.c:14224)
ImportError: No module named _validation
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\HistogramLUTItem.pyc", line 10, in <module>
File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
File "pyqtgraph\colormap.pyc", line 2, in <module>
File "scipy\interpolate\__init__.pyc", line 160, in <module>
File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
File "scipy\interpolate\interpnd.pyc", line 12, in <module>
File "scipy\interpolate\interpnd.pyc", line 10, in __load
File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
File "scipy\spatial\__init__.pyc", line 87, in <module>
File "scipy\spatial\kdtree.pyc", line 8, in <module>
File "scipy\sparse\__init__.pyc", line 193, in <module>
File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse
\csgraph\_shortest_path.c:14224)
ImportError: No module named _validation
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\GraphicsLayout.pyc", line 6, in <module>
File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
File "pyqtgraph\colormap.pyc", line 2, in <module>
File "scipy\interpolate\__init__.pyc", line 160, in <module>
File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
File "scipy\interpolate\interpnd.pyc", line 12, in <module>
File "scipy\interpolate\interpnd.pyc", line 10, in __load
File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
File "scipy\spatial\__init__.pyc", line 87, in <module>
File "scipy\spatial\kdtree.pyc", line 8, in <module>
File "scipy\sparse\__init__.pyc", line 193, in <module>
File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse
\csgraph\_shortest_path.c:14224)
ImportError: No module named _validation
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\ScatterPlotItem.pyc", line 7, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 178, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\widgets\PlotWidget.pyc", line 10, in <module>
File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 178, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\widgets\GradientWidget.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
File "pyqtgraph\colormap.pyc", line 2, in <module>
File "scipy\interpolate\__init__.pyc", line 160, in <module>
File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
File "scipy\interpolate\interpnd.pyc", line 12, in <module>
File "scipy\interpolate\interpnd.pyc", line 10, in __load
File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
File "scipy\spatial\__init__.pyc", line 87, in <module>
File "scipy\spatial\kdtree.pyc", line 8, in <module>
File "scipy\sparse\__init__.pyc", line 193, in <module>
File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse
\csgraph\_shortest_path.c:14224)
ImportError: No module named _validation
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 178, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\widgets\GraphicsLayoutWidget.pyc", line 2, in <module>
File "pyqtgraph\graphicsItems\GraphicsLayout.pyc", line 6, in <module>
File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 178, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\widgets\HistogramLUTWidget.pyc", line 8, in <module>
File "pyqtgraph\graphicsItems\HistogramLUTItem.pyc", line 10, in <module>
File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
File "pyqtgraph\colormap.pyc", line 2, in <module>
File "scipy\interpolate\__init__.pyc", line 160, in <module>
File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
File "scipy\interpolate\interpnd.pyc", line 12, in <module>
File "scipy\interpolate\interpnd.pyc", line 10, in __load
File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
File "scipy\spatial\__init__.pyc", line 87, in <module>
File "scipy\spatial\kdtree.pyc", line 8, in <module>
File "scipy\sparse\__init__.pyc", line 193, in <module>
File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse
\csgraph\_shortest_path.c:14224)
ImportError: No module named _validation
Traceback (most recent call last):
File "pyqtgraph_test.pyw", line 8, in <module>
File "pyqtgraph\__init__.pyc", line 180, in <module>
File "pyqtgraph\imageview\__init__.pyc", line 6, in <module>
File "pyqtgraph\imageview\ImageView.pyc", line 20, in <module>
File "pyqtgraph\imageview\ImageViewTemplate_pyqt.pyc", line 159, in <module>
File "pyqtgraph\widgets\PlotWidget.pyc", line 10, in <module>
File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 320, in <module>
File "scipy\stats\stats.pyc", line 245, in <module>
ImportError: cannot import name futil
What am i doing wrong ?
Every version of scipy seems to have a different set of bugs that make py2exe fail. For the latest version (0.12.0), I have found that I need these two lines somewhere in my program so that py2exe will include them in the build:
from scipy.stats import futil
from scipy.sparse.csgraph import _validation
For some reason it does not seem to work to simply put these in the py2exe 'includes' option in the setup script.