can't import holoviews, error: ImportError: cannot import name 'Column' from 'bokeh.models' (unknown location) - sympy

When i try to import holoviews i get a error. I have installed it in my prompt with pip install holoviews and
jupyter labextension install #pyviz/jupyterlab_pyviz
But when i use the command:
import holoviews as hv
hv.extension('bokeh')
i get the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 import holoviews as hv
2 hv.extension('bokeh')
File ~\calculus\simpy\lib\site-packages\holoviews\__init__.py:85, in <module>
81 __version__ = str(param.version.Version(fpath=__file__, archive_commit="$Format:%h$",
82 reponame="holoviews"))
84 from . import util # noqa (API import)
---> 85 from .annotators import annotate # noqa (API import)
86 from .core import archive, config # noqa (API import)
87 from .core.boundingregion import BoundingBox # noqa (API import)
File ~\calculus\simpy\lib\site-packages\holoviews\annotators.py:8, in <module>
4 from inspect import getmro
6 import param
----> 8 from panel.pane import PaneBase
9 from panel.layout import Row, Tabs
10 from panel.util import param_name
File ~\calculus\simpy\lib\site-packages\panel\__init__.py:48, in <module>
1 """
2 Panel is a high level app and dashboarding framework
3 ====================================================
(...)
46 https://panel.holoviz.org/getting_started/index.html
47 """
---> 48 from . import layout # noqa
49 from . import links # noqa
50 from . import pane # noqa
File ~\calculus\simpy\lib\site-packages\panel\layout\__init__.py:31, in <module>
1 """
2 Layout
3 ======
(...)
29 https://panel.holoviz.org/getting_started/index.html
30 """
---> 31 from .accordion import Accordion # noqa
32 from .base import ( # noqa
33 Column, ListLike, ListPanel, Panel, Row, WidgetBox,
34 )
35 from .card import Card # noqa
File ~\calculus\simpy\lib\site-packages\panel\layout\accordion.py:7, in <module>
3 from typing import TYPE_CHECKING, ClassVar, Mapping
5 import param
----> 7 from bokeh.models import Column as BkColumn, CustomJS
9 from .base import NamedListPanel
10 from .card import Card
ImportError: cannot import name 'Column' from 'bokeh.models' (unknown location)
I dont know how to fix this can anyone help?
The command used to work fine but I reinstalled jupiter notebook because the program wouldn't start. After reinstalling it I can't use holoviews anymore.

Related

AttributeError: module 'google.cloud.bigquery._helpers' has no attribute 'PYARROW_VERSIONS'

While running the below import command in GCP jupyterlab getting an error:
Code:
from google.cloud import storage
from google.cloud import bigquery
import pandas as pd
from sklearn import datasets
Error:
AttributeError Traceback (most recent call last)
/tmp/ipykernel_5450/3407211047.py in
1 from google.cloud import storage
2 from google.cloud import bigquery
3
4 import pandas as pd
5 from sklearn import datasets
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/init.py in
33 version = bigquery_version.version
34
35 from google.cloud.bigquery.client import Client
36 from google.cloud.bigquery.dataset import AccessEntry
37 from google.cloud.bigquery.dataset import Dataset
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/client.py in
74
75
76 from google.cloud.bigquery import _job_helpers
77 from google.cloud.bigquery._job_helpers import make_job_id as _make_job_id
78 from google.cloud.bigquery._helpers import _get_sub_prop
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/_job_helpers.py in
22 from google.api_core import retry as retries
23
24 from google.cloud.bigquery import job
25
26 # Avoid circular imports
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/job/init.py in
25 from google.cloud.bigquery.job.base import TransactionInfo
26 from google.cloud.bigquery.job.base import UnknownJob
27 from google.cloud.bigquery.job.copy_ import CopyJob
28 from google.cloud.bigquery.job.copy_ import CopyJobConfig
29 from google.cloud.bigquery.job.copy_ import OperationType
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/job/copy_.py in
19 from google.cloud.bigquery.encryption_configuration import EncryptionConfiguration
20 from google.cloud.bigquery import _helpers
21 from google.cloud.bigquery.table import TableReference
22
23 from google.cloud.bigquery.job.base import _AsyncJob
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/table.py in
55 import google.cloud._helpers # type: ignore
56 from google.cloud.bigquery import _helpers
57 from google.cloud.bigquery import _pandas_helpers
58 from google.cloud.bigquery.exceptions import LegacyBigQueryStorageError
59 from google.cloud.bigquery.schema import _build_schema_resource
/opt/conda/lib/python3.7/site-packages/google/cloud/bigquery/_pandas_helpers.py in
49 date_dtype_name = time_dtype_name = "" # Use '' rather than None because pytype
50
51 pyarrow = _helpers.PYARROW_VERSIONS.try_import()
52
53 try:
AttributeError: module 'google.cloud.bigquery._helpers' has no attribute 'PYARROW_VERSIONS'
tried installing pyparrow
conda install -c conda-forge pyarrow
Tried upgrading bigquery storage
pip install --upgrade --force-reinstall google-cloud-bigquery-storage
!pip install --upgrade google-cloud-bigquery
!pip install --upgrade google-cloud-storage
Found the answer, restarting kernel and re-running
!pip install --upgrade google-cloud-bigquery
!pip install --upgrade google-cloud-storage
It worked.

aws sagemaker cannot import TensorFlowModel

from sagemaker.tensorflow import TensorFlowModel
throws
ImportError: cannot import name 'is_pipeline_variable' from 'sagemaker.workflow'
full error stack is:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-54-e8eac6a9c02f> in <module>
----> 1 from sagemaker.tensorflow import TensorFlowModel
/opt/conda/lib/python3.7/site-packages/sagemaker/tensorflow/__init__.py in <module>
14 from __future__ import absolute_import
15
---> 16 from sagemaker.tensorflow.estimator import TensorFlow # noqa: F401 (imported but unused)
17 from sagemaker.tensorflow.model import TensorFlowModel, TensorFlowPredictor # noqa: F401
18 from sagemaker.tensorflow.processing import TensorFlowProcessor # noqa: F401
/opt/conda/lib/python3.7/site-packages/sagemaker/tensorflow/estimator.py in <module>
23 import sagemaker.fw_utils as fw
24 from sagemaker.tensorflow import defaults
---> 25 from sagemaker.tensorflow.model import TensorFlowModel
26 from sagemaker.transformer import Transformer
27 from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
/opt/conda/lib/python3.7/site-packages/sagemaker/tensorflow/model.py in <module>
22 from sagemaker.predictor import Predictor
23 from sagemaker.serializers import JSONSerializer
---> 24 from sagemaker.workflow import is_pipeline_variable
25
26
ImportError: cannot import name 'is_pipeline_variable' from 'sagemaker.workflow' (/opt/conda/lib/python3.7/site-packages/sagemaker/workflow/__init__.py)
following amazon's own documentation here:
https://aws.amazon.com/blogs/machine-learning/deploy-trained-keras-or-tensorflow-models-using-amazon-sagemaker/
trying to accommodate the v2 api change documented here:
https://sagemaker.readthedocs.io/en/stable/v2.html
TensorFlow Serving Model
sagemaker.tensorflow.serving.Model has been renamed to sagemaker.tensorflow.model.TensorFlowModel. (For the previous implementation of that class, see Remove Legacy TensorFlow).

ImportError: cannot import name 'get_unsupported_framework_version_error'

I am trying to learn AWS Machine Learning from this AWS tutorial
I have not changed any code.
When I execute the line below
from sagemaker.sklearn.processing import SKLearnProcessor
I get error:
ImportError Traceback (most recent call last)
<ipython-input-13-dd0123cd2e7d> in <module>
----> 1 from sagemaker.sklearn.processing import SKLearnProcessor
2
3 sklearn_processor = SKLearnProcessor(framework_version='0.20.0',
4 role=role,
5 instance_type='ml.c4.xlarge',
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/sklearn/__init__.py in <module>
14 from __future__ import absolute_import
15
---> 16 from sagemaker.sklearn.estimator import SKLearn # noqa: F401
17 from sagemaker.sklearn.model import SKLearnModel, SKLearnPredictor # noqa: F401
18 from sagemaker.sklearn.processing import SKLearnProcessor # noqa: F401
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/sklearn/estimator.py in <module>
18 from sagemaker.estimator import Framework
19 from sagemaker.fw_registry import default_framework_uri
---> 20 from sagemaker.fw_utils import (
21 framework_name_from_image,
22 get_unsupported_framework_version_error,
ImportError: cannot import name 'get_unsupported_framework_version_error'
I had the same problem. The issue with the tutorial itself and this part at the beginning:
if int(sagemaker.__version__.split('.')[0]) == 2:
!{sys.executable} -m pip install sagemaker==1.72.0
print("Installing previous SageMaker Version. Please restart the kernel")
else:
print("Version is good")
It uses the old version of sagemaker library, at the same time this commit removed 'get_unsupported_framework_version_error' https://github.com/aws/sagemaker-python-sdk/commit/e4485b77991041b214e4860f3999addfee8898fa
just upgrade sagemaker to a newer version, e.g: 2.6.0

sklearn.decomposition.KernelPCA

I have a following problem when i am running the below piece of code. (Fyi.. I have already installed scikit-learn using GIT Shell with the following command pip install -U scikit-learn)
import pandas as pd
import pandas.io.data as web
from sklearn.decomposition import KernelPCA
I get the following error
ImportError Traceback (most recent call last)
<ipython-input-1-8cac97052fa7> in <module>()
2 import pandas as pd
3 import pandas.io.data as web
----> 4 from sklearn.decomposition import KernelPCA
C:\Users\Alpha\Anaconda2\lib\site-packages\sklearn\__init__.py in <module>()
55 else:
56 from . import __check_build
---> 57 from .base import clone
58 __check_build # avoid flakes unused variable error
59
11 from .externals import six
12 from .utils.fixes import signature
---> 13 from .utils.deprecation import deprecated
14 from .exceptions import ChangedBehaviorWarning as _ChangedBehaviorWarning
15 from . import __version__
ImportError: No module named deprecation

Matplotlib import error ft2font

I have Python 2.7.6 installed under Canopy on a 64 bit Mac with Ipython version 2.1.0. This is a really odd problem and I'm not sure if it is a path file problem. Whenever I import matplotlib.pyplot (not just matplotlib), I receive the following error:
In [2]: import matplotlib.pyplot as plt
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt
/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
22
23 import matplotlib
---> 24 import matplotlib.colorbar
25 from matplotlib import _pylab_helpers, interactive
26 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike
/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()
27 import matplotlib.artist as martist
28 import matplotlib.cbook as cbook
---> 29 import matplotlib.collections as collections
30 import matplotlib.colors as colors
31 import matplotlib.contour as contour
/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/collections.py in <module>()
21 import matplotlib.artist as artist
22 from matplotlib.artist import allow_rasterization
---> 23 import matplotlib.backend_bases as backend_bases
24 import matplotlib.path as mpath
25 from matplotlib import _path
/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()
48
49 import matplotlib.tight_bbox as tight_bbox
---> 50 import matplotlib.textpath as textpath
51 from matplotlib.path import Path
52 from matplotlib.cbook import mplDeprecation
/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()
9 from matplotlib.path import Path
10 from matplotlib import rcParams
---> 11 import matplotlib.font_manager as font_manager
12 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
13 from matplotlib.ft2font import LOAD_TARGET_LIGHT
/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/font_manager.py in <module>()
51 import matplotlib
52 from matplotlib import afm
---> 53 from matplotlib import ft2font
54 from matplotlib import rcParams, get_cachedir
55 from matplotlib.cbook import is_string_like
ImportError: dlopen(/Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _inflateReset2
Referenced from: /Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/../../../../lib/libpng16.dylib
Expected in: /usr/lib/libz.1.dylib
in /Users/rpatel/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/../../../../lib/libpng16.dylib
I can't seem to figure out what is missing or what I need to install. Matplotlib is from the canopy distribution so I can assume it installed correctly.
I had the identical problem, and submitted a request to Enthought for help with this and got the following solution (from Jonathan March who commented above).
From the Canopy Tools menu, open a Canopy Terminal window and call:
enpkg --no-deps matplotlib 1.2.1
enpkg --no-deps libpng 1.2.40
enpkg --no-deps freetype 2.4.4
Apparently the issue, at least for my case, is that matplotlib 1.3 refers to a library which is not in OS X 10.6. So the workaround is to downgrade matplotlib.