Reading csv file into Pycharm incurred error - python

I just want to read a csv file into Pycharm but due to some reason it's not doing it properly.
Here is my code:
import csv
import os
import pandas as pd
path = '/Users/amy/Desktop/data_analysis/additionaldata/df1.csv'
df=pd.read_csv('path', sep=',')
It returned error
Traceback (most recent call last):
File "<input>", line 3, in <module>
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/harper/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/__init__.py", line 55, in <module>
from pandas.core.api import (
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/harper/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/core/api.py", line 24, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/harper/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import ( # noqa: F401
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 44, in <module>
from pandas.core.frame import DataFrame
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/core/frame.py", line 114, in <module>
from pandas.core.series import Series
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/core/series.py", line 84, in <module>
import pandas.plotting
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/plotting/__init__.py", line 59, in <module>
from pandas.plotting._core import (
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/plotting/_core.py", line 17, in <module>
import pandas.plotting._matplotlib # noqa
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/plotting/_matplotlib/__init__.py", line 3, in <module>
from pandas.plotting._matplotlib.boxplot import (
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/pandas/plotting/_matplotlib/boxplot.py", line 4, in <module>
from matplotlib.artist import setp
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/amy/PycharmProjects/testing/venv/lib/python3.7/site-packages/matplotlib/__init__.py", line 5, in <module>
df=pd.read_csv('path', sep=',')
AttributeError: module 'pandas' has no attribute 'read_csv'
I also tried this
import csv
import os
import pandas as pd
path = '/Users/amy/Desktop'
df=pd.read_csv("df1.csv")
which didn't work either.
What's wrong? I have read a few other posts but still not sure how to do this. Any help is appreciated. Thanks

Simply add open() to open the file before passing it into pandas.read_csv():
import pandas as pd
path = '/Users/amy/Desktop/data_analysis/additionaldata/df1.csv'
df = pd.read_csv(open(path), sep=',')
(Note: 'path' is only a string with value 'path' if you want the actual path, there shouldn't be any brackets.)

Related

TypeError: expected string or bytes-like object while using a hugging face model

I am trying to us DiffusionPipeline from hugging face to generate Image from text but the following error is being generated:
TypeError: expected string or bytes-like object
The traceback:
File "c:\Users\BHAVYA SHAH\Desktop\Artificial Intelligence\app.py", line 9, in <module>
from diffusers import DiffusionPipeline
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\diffusers\__init__.py", line 26, in <module>
from .pipelines import DDIMPipeline, DDPMPipeline, KarrasVePipeline, LDMPipeline, PNDMPipeline, ScoreSdeVePipeline
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\diffusers\pipelines\__init__.py", line 11, in <module>
from .latent_diffusion import LDMTextToImagePipeline
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\diffusers\pipelines\latent_diffusion\__init__.py", line 6, in <module>
from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\diffusers\pipelines\latent_diffusion\pipeline_latent_diffusion.py", line 9, in <module>
from transformers.activations import ACT2FN
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\transformers\__init__.py", line 30, in <module>
from . import dependency_versions_check
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\transformers\dependency_versions_check.py", line 17, in <module>
from .utils.versions import require_version, require_version_core
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\transformers\utils\__init__.py", line 34, in <module>
from .generic import (
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\transformers\utils\generic.py", line 29, in <module>
from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\transformers\utils\import_utils.py", line 376, in <module>
torch_version = version.parse(importlib_metadata.version("torch"))
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\packaging\version.py", line 49, in parse
return Version(version)
File "C:\Users\BHAVYA SHAH\anaconda3\lib\site-packages\packaging\version.py", line 264, in __init__
match = self._regex.search(version)
TypeError: expected string or bytes-like object
Help to solve this error would be much appreciated.

module "time" has no attribute 'clock'

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'

python Multiple linear regression find pvalue

I need to find the pvalue. for a multiLinearRegression. However, I can not use import statsmodels.formula.api as sm. It throws a error for me :( is there a way to find the pvalue without using statsmodels? this is what I have so far.
import numpy
from scipy.stats import pearsonr
data = numpy.genfromtxt("2-2.4.txt",delimiter=",")
x = data[:,6]
x2 = data[:,7]
x3 = data[:,8]
x4 = data[:,9]
y = data[:,-1]
r, p = pearsonr(x,x2,x3,x4, y) # how do I find the pvalue when working with multiple variables
error I get with statsmodel when importing
File "C:\Python27\lib\site-packages\statsmodels\formula\__init__.py", line 4, in <module>
from formulatools import handle_formula_data
File "C:\Python27\lib\site-packages\statsmodels\formula\formulatools.py", line 1, in <module>
import statsmodels.tools.data as data_util
File "C:\Python27\lib\site-packages\statsmodels\tools\__init__.py", line 1, in <module>
from tools import add_constant, categorical
File "C:\Python27\lib\site-packages\statsmodels\tools\tools.py", line 14, in <module>
from pandas import DataFrame
File "C:\Python27\lib\site-packages\pandas\__init__.py", line 39, in <module>
from pandas.core.api import *
File "C:\Python27\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby import Grouper
File "C:\Python27\lib\site-packages\pandas\core\groupby.py", line 18, in <module>
from pandas.core.frame import DataFrame
File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 39, in <module>
from pandas.core.series import Series
File "C:\Python27\lib\site-packages\pandas\core\series.py", line 2995, in <module>
import pandas.tools.plotting as _gfx # noqa
File "C:\Python27\lib\site-packages\pandas\tools\plotting.py", line 134, in <module>
if _mpl_ge_1_5_0():
File "C:\Python27\lib\site-packages\pandas\tools\plotting.py", line 129, in _mpl_ge_1_5_0
return (matplotlib.__version__ >= LooseVersion('1.5') or
File "C:\Python27\lib\distutils\version.py", line 296, in __cmp__
return cmp(self.version, other.version)
AttributeError: 'unicode' object has no attribute 'version'

scipy.interpolate leads to ImportError

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.

pyqtgraph compile to executable file fails

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.

Categories

Resources