I'm using IPython and pandas to work with Google Bigquery. I installed pandas using 'condas install pandas'. And I believe Miniconda stalled all dependencies. But when I tried to import pandas in IPython notebook, it gave me the following errors:
>
> ---------------------------------------------------------------------------
> ImportError Traceback (most recent call last)
> <ipython-input-1-a3826df0a77b> in <module>()
> ----> 1 import pandas as pd
> 2
> 3 projectid = "geotab-bigdata-test"
> 4 data_frame = pd.read_gbq('SELECT * FROM RawVin.T20141201', project_id = projectid)
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\__init__.pyc
> in <module>()
> 45
> 46 # let init-time option registration happen
> ---> 47 import pandas.core.config_init
> 48
> 49 from pandas.core.api import *
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\config_init.py
> in <module>()
> 15 is_instance_factory, is_one_of_factory,
> 16 get_default_val)
> ---> 17 from pandas.core.format import detect_console_encoding
> 18
> 19
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\format.py
> in <module>()
> 7 from pandas.core.base import PandasObject
> 8 from pandas.core.common import adjoin, notnull
> ----> 9 from pandas.core.index import Index, MultiIndex, _ensure_index
> 10 from pandas import compat
> 11 from pandas.compat import(StringIO, lzip, range, map, zip, reduce, u,
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\index.py
> in <module>()
> 13 import pandas.algos as _algos
> 14 import pandas.index as _index
> ---> 15 from pandas.lib import Timestamp, Timedelta, is_datetime_array
> 16 from pandas.core.base import PandasObject, FrozenList, FrozenNDArray, IndexOpsMixin, _shared_docs
> 17 from pandas.util.decorators import (Appender, Substitution, cache_readonly,
>
> ImportError: cannot import name Timedelta
Found solutions myself. When install pandas using Miniconda, we should make sure all python threads have been stopped. Otherwise, it'll messed up the installation and bring such errors.
I just stopped all python threads, re-install pandas by 'conda install -f pandas', and the errors gone
Related
Thank you for your help in advance!
I had the following error, for example, when running the first cell in pose.ipynb. I have tried reinstalling drake and manipulation on my local machine with the newest version, but I still have the same problem. Can you please help me out with it?
ImportError Traceback (most recent call last)
Cell In [1], line 23
9 from pydrake.all import (AbstractValue, AddMultibodyPlantSceneGraph, AngleAxis,
10 BaseField, ConstantValueSource, CsdpSolver,
11 DepthImageToPointCloud, DiagramBuilder,
(...)
19 RollPitchYaw, RotationMatrix, Simulator, StartMeshcat,
20 ge)
22 from manipulation import running_as_notebook
---> 23 from manipulation.scenarios import (AddIiwaDifferentialIK, AddMultibodyTriad,
24 AddRgbdSensor, MakeManipulationStation)
25 from manipulation.meshcat_utils import AddMeshcatTriad, draw_open3d_point_cloud
26 from manipulation.utils import AddPackagePaths, FindResource
File ~/manipulation-master/manipulation/scenarios.py:10
7 import warnings
9 import numpy as np
---> 10 from pydrake.all import (
11 AbstractValue, Adder, AddMultibodyPlantSceneGraph, BallRpyJoint, BaseField,
12 Box, CameraInfo, ClippingRange, CoulombFriction, Cylinder, Demultiplexer,
13 DepthImageToPointCloud, DepthRange, DepthRenderCamera, DiagramBuilder,
14 FindResourceOrThrow, GeometryInstance, InverseDynamicsController,
15 LeafSystem, LoadModelDirectives, LoadModelDirectivesFromString,
16 MakeMultibodyStateToWsgStateSystem, MakePhongIllustrationProperties,
...
23 DifferentialInverseKinematicsIntegrator,
24 DifferentialInverseKinematicsParameters)
26 from manipulation.utils import AddPackagePaths, FindResource
ImportError: cannot import name 'LoadModelDirectivesFromString' from 'pydrake.all' (/home/obito/env_drake/lib/python3.8/site-packages/pydrake/all.py)
LoadModelDirectivesFromString was added to Drake only in the last few days. You just need to update your installation of Drake.
I am trying to open zarr file as,
import pandas as pd
import xarray as xr
xf = xr.open_zarr("../../data/processed/geolink_norge_dataset/geolink_norge_well_logs.zarr")
But there comes out the errors:
ValueError Traceback (most recent call last) <ipython-input-17-ff38d9c54463> in <module>
1 import pandas as pd
2 import xarray as xr
----> 3 xf = xr.open_zarr("../../data/processed/geolink_norge_dataset/geolink_norge_well_logs.zarr")
4
5 # We will use just the 30* wells
C:\ProgramData\Anaconda3\lib\site-packages\xarray\backends\zarr.py in open_zarr(store, group, synchronizer, chunks, decode_cf, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, consolidated, overwrite_encoded_chunks, chunk_store, storage_options, decode_timedelta, use_cftime, **kwargs)
685 }
686
--> 687 ds = open_dataset(
688 filename_or_obj=store,
689 group=group,
C:\ProgramData\Anaconda3\lib\site-packages\xarray\backends\api.py in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, backend_kwargs,
*args, **kwargs)
480 engine = plugins.guess_engine(filename_or_obj)
481
--> 482 backend = plugins.get_backend(engine)
483
484 decoders = _resolve_decoders_kwargs(
C:\ProgramData\Anaconda3\lib\site-packages\xarray\backends\plugins.py in get_backend(engine)
132 engines = list_engines()
133 if engine not in engines:
--> 134 raise ValueError(
135 f"unrecognized engine {engine} must be one of: {list(engines)}"
136 )
ValueError: unrecognized engine zarr must be one of: ['scipy','store']
Can anyone help to solve this problem?
I can confirm that I have installed the scipy and store packages.
You likely need to install the zarr package as well:
pip install zarr
If that doesn't work, try:
pip install xarray[complete]
See https://github.com/pydata/xarray/issues/5395#issuecomment-850483726 for more information.
I'm trying to run this code on jupyter notebook to work with geopandas for making geospatial analysis:
%matplotlib inline
import numpy as np, matplotlib.pyplot as plt, pandas as pd, geopandas as gpd
from mpl_toolkits.basemap import Basemap
from shapely.geometry import Point
from geopy.distance import great_circle
this is the error message I got after run the code:
ImportError Traceback (most recent call last)
<ipython-input-2-987457051b80> in <module>
1 # import necessary modules
----> 2 import numpy as np, matplotlib.pyplot as plt, pandas as pd, geopandas as gpd
3 from mpl_toolkits.basemap import Basemap
4 from shapely.geometry import Point
5 from geopy.distance import great_circle
C:\Anaconda\lib\site-packages\geopandas\__init__.py in <module>
2 from geopandas.geodataframe import GeoDataFrame
3
----> 4 from geopandas.io.file import read_file
5 from geopandas.io.sql import read_postgis
6 from geopandas.tools import sjoin
C:\Anaconda\lib\site-packages\geopandas\io\file.py in <module>
1 import os
2
----> 3 import fiona
4 import numpy as np
5 import six
C:\Anaconda\lib\site-packages\fiona\__init__.py in <module>
81 os.environ["PATH"] = os.environ["PATH"] + ";" + libdir
82
---> 83 from fiona.collection import BytesCollection, Collection
84 from fiona.drvsupport import supported_drivers
85 from fiona.env import ensure_env_with_credentials, Env
C:\Anaconda\lib\site-packages\fiona\collection.py in <module>
7
8 from fiona import compat, vfs
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
10 from fiona.ogrext import Session, WritingSession
11 from fiona.ogrext import buffer_to_virtual_file, remove_virtual_file, GEOMETRY_TYPES
ImportError: DLL load failed: El sistema operativo no puede ejecutar %1.
Can you provide any help?
I followed this notebook to try bokeh with iPyhton Notebook: https://github.com/bokeh/bokeh/blob/0.12.3/examples/howto/notebook_comms/Basic%20Usage.ipynb
I dont know how to interpret and fix those errors:
error 1:
from bokeh.io import push_notebook, show, output_notebook
from bokeh.layouts import row
from bokeh.plotting import figure
output_notebook()
ImportError Traceback (most recent call
last) in ()
3
4 from bokeh.io import push_notebook, show, output_notebook
----> 5 from bokeh.layouts import row
6 from bokeh.plotting import figure
7 output_notebook()
/opt/conda/lib/python2.7/site-packages/bokeh/layouts.py in ()
8 from future import absolute_import
9
---> 10 from .core.enums import Location, SizingMode
11 from .models.tools import ToolbarBox
12 from .models.plots import Plot
ImportError: cannot import name SizingMode
error 2:
from ipywidgets import interact
import numpy as np
from bokeh.io import push_notebook, show, output_notebook
from bokeh.plotting import figure
output_notebook()
ImportError Traceback (most recent call
last) in ()
6
7 from bokeh.io import push_notebook, show, output_notebook
----> 8 from bokeh.plotting import figure
9 output_notebook()
/opt/conda/lib/python2.7/site-packages/bokeh/plotting/init.py in
()
3
4 from ..models import ColumnDataSource; ColumnDataSource
----> 5 from ..models.layouts import Row, Column; Row, Column
6
7 from ..io import curdoc; curdoc
ImportError: cannot import name Row
bokeh : 0.12.3
tornado: 4.4.2
python: 2.7
the problem was that the iPython notebook kernel was out of sync. restarting the notebook server was the solution
Python 2.7.10 / Anaconda / windows 8.1
I have strange issue, the following code works on one solution file in the same working directory.
But when I copy call the exact same code to my sheet. I get this error, so I have no idea to fix this.
Here's the code:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.zeros(20)
x[:5] = 10
x[5:15] = np.arange(12,31,2)
x[15:] = 30
plt.plot(x)
plt.plot([4,4],[8,32],'k--')
plt.plot([14,14],[8,32],'k--')
plt.ylim(8,32)
Traceback (most recent call last)<ipython-input-65-6b573104eb1d> in <module>()
6 plt.plot([4,4],[8,32],'k--')
7 plt.plot([14,14],[8,32],'k--')
----> 8 plt.ylim(8,32)
TypeError: 'int' object is not callable