I tried to install the Spacy package using the conda terminal with the command:
"conda install -c conda-forge spacy"
Even though the installation seems to be working, when I use Jupyter Notebook and import spacy I get the following error:
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-1-76a01d9c502b> in <module>
----> 1 import spacy
~\anaconda3\lib\site-packages\spacy\__init__.py in <module>
9
10 # These are imported as part of the API
---> 11 from thinc.api import prefer_gpu, require_gpu, require_cpu # noqa: F401
12 from thinc.api import Config
13
~\anaconda3\lib\site-packages\thinc\__init__.py in <module>
3
4 from .about import __version__
----> 5 from .config import registry
~\anaconda3\lib\site-packages\thinc\config.py in <module>
11 from pydantic.main import ModelMetaclass
12 from pydantic.fields import ModelField
---> 13 from wasabi import table
14 import srsly
15 import catalogue
~\anaconda3\lib\site-packages\wasabi\__init__.py in <module>
10 from .about import __version__ # noqa
11
---> 12 msg = Printer()
~\anaconda3\lib\site-packages\wasabi\printer.py in __init__(self, pretty, no_print, colors, icons, line_max, animation, animation_ascii, hide_animation, ignore_warnings, env_prefix, timestamp)
54 self.pretty = pretty and not env_no_pretty
55 self.no_print = no_print
---> 56 self.show_color = supports_ansi() and not env_log_friendly
57 self.hide_animation = hide_animation or env_log_friendly
58 self.ignore_warnings = ignore_warnings
~\anaconda3\lib\site-packages\wasabi\util.py in supports_ansi()
262 if "ANSICON" in os.environ:
263 return True
--> 264 return _windows_console_supports_ansi()
265
266 return True
~\anaconda3\lib\site-packages\wasabi\util.py in _windows_console_supports_ansi()
234 raise ctypes.WinError()
235
--> 236 console = msvcrt.get_osfhandle(sys.stdout.fileno())
237 try:
238 # Try to enable ANSI output support
UnsupportedOperation: fileno
Related
I want to create a simple plotly chart from a .csv file that I fetched from an API.
I import the library, pass the dataframe, and get the error:
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
code:
import plotly.express as px
df=pd.read_csv('file.csv')
What might be the problem, and what does this error mean?
Full error traceback:
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_9952/1054373791.py in <module>
1 from dash import Dash, dcc, html, Input, Output
----> 2 import plotly.express as px
3 import pandas as pd
~\anaconda3\lib\site-packages\plotly\express\__init__.py in <module>
13 )
14
---> 15 from ._imshow import imshow
16 from ._chart_types import ( # noqa: F401
17 scatter,
~\anaconda3\lib\site-packages\plotly\express\_imshow.py in <module>
9
10 try:
---> 11 import xarray
12
13 xarray_imported = True
~\anaconda3\lib\site-packages\xarray\__init__.py in <module>
----> 1 from . import testing, tutorial
2 from .backends.api import (
3 load_dataarray,
4 load_dataset,
5 open_dataarray,
~\anaconda3\lib\site-packages\xarray\testing.py in <module>
7 import pandas as pd
8
----> 9 from xarray.core import duck_array_ops, formatting, utils
10 from xarray.core.dataarray import DataArray
11 from xarray.core.dataset import Dataset
~\anaconda3\lib\site-packages\xarray\core\duck_array_ops.py in <module>
24 from numpy import where as _where
25
---> 26 from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
27 from .nputils import nanfirst, nanlast
28 from .pycompat import cupy_array_type, dask_array_type, is_duck_dask_array
~\anaconda3\lib\site-packages\xarray\core\npcompat.py in <module>
70 List[Any],
71 # anything with a dtype attribute
---> 72 _SupportsDType[np.dtype],
73 ]
74 except ImportError:
~\anaconda3\lib\typing.py in inner(*args, **kwds)
273 except TypeError:
274 pass # All real errors (not unhashable args) are raised below.
--> 275 return func(*args, **kwds)
276 return inner
277
~\anaconda3\lib\typing.py in __class_getitem__(cls, params)
997 else:
998 # Subscripting a regular Generic subclass.
--> 999 _check_generic(cls, params, len(cls.__parameters__))
1000 return _GenericAlias(cls, params)
1001
~\anaconda3\lib\typing.py in _check_generic(cls, parameters, elen)
207 """
208 if not elen:
--> 209 raise TypeError(f"{cls} is not a generic class")
210 alen = len(parameters)
211 if alen != elen:
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
I got the same error, it is dependency issue, plotly.express (5.9.0) is not working with numpy==1.20, if you upgrade numpy==1.21.6 it will solve your error.
pip install numpy==1.21.6
I was having same issue when I updated xarray. I tried updating numpy but conda environment was restricting it. Updating the whole conda environment helped me resolve this error.
conda update --all
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4960/3694415272.py in <module>
----> 1 plotly.express.__version__
~\anaconda3\lib\site-packages\_plotly_utils\importers.py in __getattr__(import_name)
37 return getattr(class_module, class_name)
38
---> 39 raise AttributeError(
40 "module {__name__!r} has no attribute {name!r}".format(
41 name=import_name, __name__=parent_name
AttributeError: module 'plotly' has no attribute 'express'
I am running this on Jupyter Notebook with Python 3.9.12 and TensorFlow 2.6.0
Specs:
Windows 10
Python: 3.9.12
TF: 2.6.0
Keras: 2.6.0
IPython: 7.18.1
I resolved another AlreadyExistsError, which was Keras not being the same version as TensorFlow. But for this, I couldn't find an answer in particular.
Here are the simple import statements:
#import os
from object_detection.utils import label_map _util
from object_detection.builders import model_builder
#from object_detection.utils import visualization_utils as viz_utils
Here's the description of the error. What have I been doing wrong? How can I fix this?
---------------------------------------------------------------------------
AlreadyExistsError Traceback (most recent call last)
<ipython-input-1-23c38f3704f8> in <module>
1 #import os
2 from object_detection.utils import label_map_util
----> 3 from object_detection.builders import model_builder
4 #from object_detection.utils import visualization_utils as viz_utils
~\github clones boi\RealTimeObjectDetection\Tensorflow\models\research\object_detection\builders\model_builder.py in <module>
35 from object_detection.meta_architectures import center_net_meta_arch
36 from object_detection.meta_architectures import context_rcnn_meta_arch
---> 37 from object_detection.meta_architectures import deepmac_meta_arch
38 from object_detection.meta_architectures import faster_rcnn_meta_arch
39 from object_detection.meta_architectures import rfcn_meta_arch
~\github clones boi\RealTimeObjectDetection\Tensorflow\models\research\object_detection\meta_architectures\deepmac_meta_arch.py in <module>
26
27 if tf_version.is_tf2():
---> 28 import tensorflow_io as tfio # pylint:disable=g-import-not-at-top
29
30
~\anaconda3\envs\tfgpu\lib\site-packages\tensorflow_io\__init__.py in <module>
15 """tensorflow_io"""
16
---> 17 from tensorflow_io.python.api import * # pylint: disable=wildcard-import
18 from tensorflow_io.python.api.version import VERSION as __version__
~\anaconda3\envs\tfgpu\lib\site-packages\tensorflow_io\python\api\__init__.py in <module>
17
18 # tensorflow_io.core.python.ops is implicitly imported (along with file system)
---> 19 from tensorflow_io.python.ops.io_dataset import IODataset
20 from tensorflow_io.python.ops.io_tensor import IOTensor
21
~\anaconda3\envs\tfgpu\lib\site-packages\tensorflow_io\python\ops\__init__.py in <module>
94 core_ops = LazyLoader("core_ops", "libtensorflow_io.so")
95 try:
---> 96 plugin_ops = _load_library("libtensorflow_io_plugins.so", "fs")
97 except NotImplementedError as e:
98 warnings.warn(f"unable to load libtensorflow_io_plugins.so: {e}")
~\anaconda3\envs\tfgpu\lib\site-packages\tensorflow_io\python\ops\__init__.py in _load_library(filename, lib)
62 for f in filenames:
63 try:
---> 64 l = load_fn(f)
65 if l is not None:
66 return l
~\anaconda3\envs\tfgpu\lib\site-packages\tensorflow_io\python\ops\__init__.py in <lambda>(f)
54 load_fn = lambda f: ctypes.CDLL(f, mode=ctypes.RTLD_GLOBAL)
55 elif lib == "fs":
---> 56 load_fn = lambda f: tf.experimental.register_filesystem_plugin(f) is None
57 else:
58 load_fn = lambda f: tf.compat.v1.load_file_system_library(f) is None
~\anaconda3\envs\tfgpu\lib\site-packages\tensorflow\python\framework\load_library.py in register_filesystem_plugin(plugin_location)
216 """
217 if os.path.exists(plugin_location):
--> 218 py_tf.TF_RegisterFilesystemPlugin(plugin_location)
219
220 else:
AlreadyExistsError: File system for s3 already registered
Thanks in advance!
I download the theano from github, and install it.
But when I try to import the theano in ipython, I meet this problem
In [1]: import theano
ImportError Traceback (most recent call last)
<ipython-input-1-3397704bd624> in <module>()
----> 1 import theano
C:\Anaconda3\lib\site-packages\theano\__init__.py in <module>()
40 from theano.version import version as version
41
---> 42 from theano.configdefaults import config
43
44 # This is the api version for ops that generate C code. External ops
C:\Anaconda3\lib\site-packages\theano\configdefaults.py in <module>()
14
15 import theano
---> 16 from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr,
17 FloatParam, IntParam, StrParam,
18 TheanoConfigParser, THEANO_FLAGS_DICT)
C:\Anaconda3\lib\site-packages\theano\configparser.py in <module>()
13
14 import theano
---> 15 from theano.compat import configparser as ConfigParser
16 from six import string_types
17
C:\Anaconda3\lib\site-packages\theano\compat\__init__.py in <module>()
4 # Python 3.x compatibility
5 from six import PY3, b, BytesIO, next
----> 6 from six.moves import configparser
7 from six.moves import reload_module as reload
8 import collections
C:\Anaconda3\lib\site-packages\six.py in __get__(self, obj, tp)
90
91 def __get__(self, obj, tp):
---> 92 result = self._resolve()
93 setattr(obj, self.name, result) # Invokes __set__.
94 try:
C:\Anaconda3\lib\site-packages\six.py in _resolve(self)
113
114 def _resolve(self):
--> 115 return _import_module(self.mod)
116
117 def __getattr__(self, attr):
C:\Anaconda3\lib\site-packages\six.py in _import_module(name)
80 def _import_module(name):
81 """Import module, returning the module after the last dot."""
---> 82 __import__(name)
83 return sys.modules[name]
84
C:\Anaconda3\Lib\site-packages\theano\configparser.py in <module>()
13
14 import theano
---> 15 from theano.compat import configparser as ConfigParser
16 from six import string_types
17
When I get into the files, I indeed can not find configparser.py in the directory, but the original file do not have it neither.
ImportError: cannot import name 'configparser'
Just found the temperary solution , rename configparser.py to config_parser or any other name that are not confilct .
and change name of each module include it to config_parser .
I am trying to replicate the example
Getting Started PyMC3.
on Windows 2012 R2.
The step
from pymc3 import Model, Normal, HalfNormal
gives
D:\Anaconda3\libs/python35.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
D:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
64 if version != getattr(lazylinker_ext, '_version', None):
---> 65 raise ImportError()
66 except ImportError:
ImportError:
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
D:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
81 if version != getattr(lazylinker_ext, '_version', None):
---> 82 raise ImportError()
83 except ImportError:
ImportError:
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
<ipython-input-4-582c90a634a6> in <module>()
----> 1 from pymc3 import Model, Normal, HalfNormal
D:\Anaconda3\lib\site-packages\pymc3\__init__.py in <module>()
1 __version__ = "3.0"
2
----> 3 from .core import *
4 from .distributions import *
5 from .math import *
D:\Anaconda3\lib\site-packages\pymc3\core.py in <module>()
1 from .vartypes import *
----> 2 from .model import *
3 from .theanof import *
4 from .blocking import *
5 import numpy as np
D:\Anaconda3\lib\site-packages\pymc3\model.py in <module>()
1 from .vartypes import *
2
----> 3 from theano import theano, tensor as t, function
4 from theano.tensor.var import TensorVariable
5
D:\Anaconda3\lib\site-packages\theano\__init__.py in <module>()
53 object2, utils
54
---> 55 from theano.compile import \
56 SymbolicInput, In, \
57 SymbolicOutput, Out, \
D:\Anaconda3\lib\site-packages\theano\compile\__init__.py in <module>()
7 SpecifyShape, specify_shape, register_specify_shape_c_code)
8
----> 9 from theano.compile.function_module import *
10
11 from theano.compile.mode import *
D:\Anaconda3\lib\site-packages\theano\compile\function_module.py in <module>()
16 from theano import gof
17 from theano.compat.python2x import partial
---> 18 import theano.compile.mode
19 from theano.compile.io import (
20 In, SymbolicInput, SymbolicInputKit, SymbolicOutput)
D:\Anaconda3\lib\site-packages\theano\compile\mode.py in <module>()
9 import theano
10 from theano import gof
---> 11 import theano.gof.vm
12 from theano.configparser import config, AddConfigVar, StrParam
13 from theano.compile.ops import register_view_op_c_code, _output_guard
D:\Anaconda3\lib\site-packages\theano\gof\vm.py in <module>()
566
567 try:
--> 568 from . import lazylinker_c
569
570 class CVM(lazylinker_c.CLazyLinker, VM):
D:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
115 args = cmodule.GCC_compiler.compile_args()
116 cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
--> 117 preargs=args)
118 # Save version into the __init__.py file.
119 init_py = os.path.join(loc, '__init__.py')
D:\Anaconda3\lib\site-packages\theano\gof\cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module)
2008 # difficult to read.
2009 raise Exception('Compilation failed (return status=%s): %s' %
-> 2010 (status, compile_stderr.replace('\n', '. ')))
2011 elif config.cmodule.compilation_warning and compile_stderr:
2012 # Print errors just below the command line.
I have for gcc
C:\>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lt
o-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --e
nable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable
-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC -
-disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-d
ebug --enable-threads=posix --enable-version-specific-runtime-libs --enable-full
y-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-l
d --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm -
-with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://td
m-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm64-1)
what am i missing?
thanks
Whatever the issue was creating a python 3.4 environment together with
conda install mingw libpython
solved it.
What solved my issue is installing Python 2.7 version of anaconda
I got the same error using ipython. Using just python I imported theano without problem. Subsequent uses with ipython worked fine after the first compilation with just python.
After some fixing my PATH variable to get some library installs to work , I'm finding that my IPython Notebook (Enthought Canopy on Ubuntu 14.04) throws the following error when using the %matplotlib magic command:
ImportError: /home/joe/Enthought/Canopy_64bit/User/bin/../lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
I'm also getting this error when trying to install python-bio-formats, pims, and pylibtiff.
Again, any ideas are appreciated.
EDIT: Full error traceback:
ImportError Traceback (most recent call last)
<ipython-input-1-3042faeb62d7> in <module>()
----> 1 get_ipython().magic(u'matplotlib')
2 #import cv2
3 #import numpy as np
4 #import pandas as pd
5 #import os
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
78 """
79 args = magic_arguments.parse_argstring(self.matplotlib, line)
---> 80 gui, backend = self.shell.enable_matplotlib(args.gui)
81 self._show_matplotlib_backend(args.gui, backend)
82
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
2929 """
2930 from IPython.core import pylabtools as pt
-> 2931 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
2932
2933 if gui != 'inline':
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in find_gui_and_backend(gui, gui_select)
250 """
251
--> 252 import matplotlib
253
254 if gui and gui != 'auto':
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/__init__.py in <module>()
177 # cbook must import matplotlib only within function
178 # definitions, so it is safe to import from it here.
--> 179 from matplotlib.cbook import is_string_like
180 from matplotlib.compat import subprocess
181
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/cbook.py in <module>()
30 from weakref import ref, WeakKeyDictionary
31
---> 32 import numpy as np
33 import numpy.ma as ma
34
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.pyc in <module>()
168 return loader(*packages, **options)
169
--> 170 from . import add_newdocs
171 __all__ = ['add_newdocs',
172 'ModuleDeprecationWarning',
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
16
17 from . import scimath as emath
---> 18 from .polynomial import *
19 #import convertcode
20 from .utils import *
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/polynomial.py in <module>()
17 from numpy.lib.function_base import trim_zeros, sort_complex
18 from numpy.lib.type_check import iscomplex, real, imag
---> 19 from numpy.linalg import eigvals, lstsq, inv
20
21 class RankWarning(UserWarning):
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/__init__.py in <module>()
49 from .info import __doc__
50
---> 51 from .linalg import *
52
53 from numpy.testing import Tester
/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/linalg.py in <module>()
27 )
28 from numpy.lib import triu, asfarray
---> 29 from numpy.linalg import lapack_lite, _umath_linalg
30 from numpy.matrixlib.defmatrix import matrix_power
31 from numpy.compat import asbytes
ImportError: /home/joe/Enthought/Canopy_64bit/User/bin/../lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
Full PATH (from echo $PATH):
/home/joe/Enthought/Canopy_64bit/User/bin:
/home/joe/Enthought/Canopy_64bit/User/bin:
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games
sys.path:
['', '/home/joe/Enthought/Canopy_64bit/User/src/svn',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pims',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python27.zip',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/plat-linux2',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-tk',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-old',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-dynload',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PIL',
'/home/joe/opencv-2.4.9',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages']
I was able to resolve this error by following the steps outlined here (specifically, steps 3-5): https://support.enthought.com/entries/23580651-Uninstalling-and-resetting-Canopy.
When re-attempting to install pims (https://github.com/soft-matter/pims) using pip (command: pip install --upgrade http://github.com/soft-matter/pims/zipball/master), the problem is able to be replicated. Odd.
I'm also getting a problem when trying to install pylibtiff via its setup.py script, but I will post this in another SO post, further detailing the error.
This might be late, but you can try the following thread
https://github.com/ContinuumIO/anaconda-issues/issues/686
Specifically the one by Zarhid:
conda remove libgfortran
conda install libgcc --force
replace conda with pip and modify accordingly. Worked for me