Unable to Import Spacy or Download Models - python

I recently tried to install the spaCy module for Python 3.7. The installation looks like it runs successfully (shows no errors), but when I try to import spaCy, or when I try to install spaCy models, I get the error below. I'm totally lost; please help!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\__init__.py", line 14, in <module>
from . import pipeline # noqa: F401
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\pipeline\__init__.py", line 1, in <module>
from .attributeruler import AttributeRuler
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\pipeline\attributeruler.py", line 6, in <module>
from .pipe import Pipe
File "spacy\pipeline\pipe.pyx", line 1, in init spacy.pipeline.pipe
File "spacy\strings.pyx", line 15, in init spacy.strings
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\site-packages\spacy\util.py", line 1635, in <module>
default_error_handler: Callable[[str, "Pipe", List["Doc"], Exception], NoReturn],
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\typing.py", line 755, in __getitem__
return self.__getitem_inner__(params)
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\typing.py", line 251, in inner
return func(*args, **kwds)
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\typing.py", line 774, in __getitem_inner__
result = _type_check(result, msg)
File "C:\Users\mjrei\AppData\Local\Programs\Python\Python37\lib\typing.py", line 135, in _type_check
raise TypeError(f"Plain {arg} is not valid as type argument")
TypeError: Plain typing.NoReturn is not valid as type argument

Related

Chialisp environment set up

I'm following along with this video:
https://www.youtube.com/watch?v=y8Thrrw25rQ&list=PLmnzWPUjpmaGzFNq2PeMljHNrXGwj2TDY&index=1
trying to set up my dev environment for chialisp.
Installed python, created virtual environment, ran pip install chia-dev-tools (got this working after installing c++ buildtools). All looks to work fine but when i run the chia --help command I'm getting errors
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\chialisp\chiatest1\venv\Scripts\chia.exe_main.py", line 4, in
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\cmds\chia.py", line 18, in
from chia.cmds.peer import peer_cmd
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\cmds\peer.py", line 7, in
from chia.cmds.cmds_util import NODE_TYPES
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\cmds\cmds_util.py", line 17, in
from chia.rpc.wallet_rpc_client import WalletRpcClient
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\rpc\wallet_rpc_client.py", line 3, in
from chia.data_layer.data_layer_wallet import Mirror, SingletonRecord
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\data_layer\data_layer_wallet.py", line 42, in
from chia.wallet.outer_puzzles import AssetType
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\wallet\outer_puzzles.py", line 8, in
from chia.wallet.cat_wallet.cat_outer_puzzle import CATOuterPuzzle
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\wallet\cat_wallet\cat_outer_puzzle.py", line 11, in
from chia.wallet.cat_wallet.cat_utils import (
File "C:\chialisp\chiatest1\venv\Lib\site-packages\chia\wallet\cat_wallet\cat_utils.py", line 24, in
#dataclasses.dataclass
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tony\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1220, in dataclass
return wrap(cls)
^^^^^^^^^
File "C:\Users\tony\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1210, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tony\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tony\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'chia.types.blockchain_format.program.Program'> for field limitations_solution is not allowed: use default_factory
Any thoughts on where I might be going wrong??
For future reference I had to run this command
Set-Alias -Name chia "C:\Users[insert user here]\AppData\Local\Programs\Chia\resources\app.asar.unpacked\daemon\chia.exe"

Anaconda Spyder doesn't launch

I'm trying to open Spyder and I have deleted multiple times the "spyder.lock" folder in user/directory but it doesn't work. This is the error:
File "C:\Users\pc-acer\anaconda3\envs\EnvTest\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\app\start.py", line 212, in main
mainwindow.main(options, args)
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py", line 3685, in main
mainwindow = run_spyder(app, options, args)
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py", line 3571, in run_spyder
main.setup()
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py", line 886, in setup
from spyder.plugins.completion.plugin import CompletionManager
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\plugins\completion\plugin.py", line 22, in <module>
from spyder.plugins.completion.languageserver.plugin import (
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\plugins\completion\languageserver\plugin.py", line 31, in <module>
from spyder.plugins.completion.languageserver.confpage import (
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\plugins\completion\languageserver\confpage.py", line 31, in <module>
from spyder.plugins.completion.languageserver.widgets.snippetsconfig import (
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\spyder\plugins\completion\languageserver\widgets\snippetsconfig.py", line 17, in <module>
from jsonschema import validate as json_validate
File "C:\Users\pc-acer\Anaconda3\Lib\site-packages\jsonschema\__init__.py", line 34, in <module>
__version__ = metadata.version("jsonschema")
File "C:\Users\pc-acer\anaconda3\envs\EnvTest\lib\importlib\metadata.py", line 531, in version
return distribution(distribution_name).version
File "C:\Users\pc-acer\anaconda3\envs\EnvTest\lib\importlib\metadata.py", line 236, in version
return self.metadata['Version']
File "C:\Users\pc-acer\anaconda3\envs\EnvTest\lib\importlib\metadata.py", line 224, in metadata
self.read_text('METADATA')
File "C:\Users\pc-acer\anaconda3\envs\EnvTest\lib\importlib\metadata.py", line 491, in read_text
return self._path.joinpath(filename).read_text(encoding='utf-8')
AttributeError: 'WindowsPath' object has no attribute 'read_text'
I don't know what i have to do. Please help!
There might be 2 situation
You are using older version of python or something messed up so try reinstalling newer version of python
conda missing some dependencies.
conda upgrade spyder
Check this thread.

ImportError: cannot import name 'dump_csp_header' from 'werkzeug.http' (C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\http.py)

I am getting this error by running tenserbord
(base) C:\Users\karan\TF_2_Notebooks_and_Data\03-ANNs>tensorboard
--logdir logs\fit Traceback (most recent call last): File "C:\Users\karan\Anaconda3\Scripts\tensorboard-script.py", line 5, in
from tensorboard.main import run_main File "C:\Users\karan\Anaconda3\lib\site-packages\tensorboard\main.py", line
40, in
from tensorboard import default File "C:\Users\karan\Anaconda3\lib\site-packages\tensorboard\default.py",
line 38, in
from tensorboard.plugins.audio import audio_plugin File "C:\Users\karan\Anaconda3\lib\site-packages\tensorboard\plugins\audio\audio_plugin.py",
line 23, in
from werkzeug import wrappers File "C:\Users\karan\Anaconda3\lib\site-packages\werkzeug__init__.py",
line 151, in
import('werkzeug.exceptions') File "C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\exceptions.py",
line 71, in
from werkzeug.wrappers import Response File "C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\wrappers__init__.py",
line 26, in
from .common_descriptors import CommonRequestDescriptorsMixin File
"C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\wrappers\common_descriptors.py",
line 7, in
from ..http import dump_csp_header ImportError: cannot import name 'dump_csp_header' from 'werkzeug.http'
(C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\http.py)
and also by running,
board = TensorBoard(log_dir=log_directory,histogram_freq=1,
write_graph=True,
write_images=True,
update_freq='epoch',
profile_batch=2,embeddings_freq=1)
if I put embeddings_freq=1 instead of embeddings_freq=0 then I get an error
Train on 426 samples, validate on 143 samples Traceback (most recent
call last):
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\callbacks.py",
line 1561, in _configure_embeddings
from tensorboard.plugins import projector
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorboard\plugins\projector__init__.py",
line 32, in
from tensorboard.plugins.projector import projector_plugin as _projector_plugin
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorboard\plugins\projector\projector_plugin.py",
line 30, in
from werkzeug import wrappers
File
"C:\Users\karan\Anaconda3\lib\site-packages\werkzeug__init__.py",
line 151, in
import('werkzeug.exceptions')
File
"C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\exceptions.py",
line 71, in
from werkzeug.wrappers import Response
File
"C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\wrappers__init__.py",
line 26, in
from .common_descriptors import CommonRequestDescriptorsMixin
File
"C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\wrappers\common_descriptors.py",
line 7, in
from ..http import dump_csp_header
ImportError: cannot import name 'dump_csp_header' from 'werkzeug.http'
(C:\Users\karan\Anaconda3\lib\site-packages\werkzeug\http.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 5, in
callbacks=[board,early_stop]
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\engine\training.py",
line 819, in fit
use_multiprocessing=use_multiprocessing)
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py",
line 307, in fit
mode=ModeKeys.TRAIN)
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\callbacks.py",
line 107, in configure_callbacks
callback_list.set_model(callback_model)
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\callbacks.py",
line 222, in set_model
callback.set_model(model)
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\callbacks.py",
line 1549, in set_model
self._configure_embeddings()
File
"C:\Users\karan\Anaconda3\lib\site-packages\tensorflow_core\python\keras\callbacks.py",
line 1563, in _configure_embeddings
raise ImportError('Failed to import TensorBoard. Please make sure that '
ImportError: Failed to import TensorBoard. Please make sure that
TensorBoard integration is complete."
What should I do> I am not an expert just a beginner, and I didn't create an anaconda env, I am running it in a (base), can someone please reply it fast? My exams are coming and I need to resolve this as fast it could be, my thanks to the community.

Unable to load the package 'enthought.mayavi.mlab'

I'm trying to load the package enthought.mayavi.mlab in python's spider enviorment:
import enthought.mayavi.mlab as mlb
And I get the following error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 487, in runfile
execfile(filename, namespace)
File "C:\Users\Eytan\Desktop\Mah\PyBrainTraining.py", line 2, in <module>
import enthought.mayavi.mlab as mlb
File "C:\Python27\lib\site-packages\enthought\mayavi\mlab.py", line 3, in <module>
from mayavi.mlab import *
File "C:\Python27\lib\site-packages\mayavi\mlab.py", line 27, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "C:\Python27\lib\site-packages\mayavi\tools\camera.py", line 25, in <module>
from engine_manager import get_engine
File "C:\Python27\lib\site-packages\mayavi\tools\engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "C:\Python27\lib\site-packages\mayavi\preferences\api.py", line 4, in <module>
from preference_manager import preference_manager
File "C:\Python27\lib\site-packages\mayavi\preferences\preference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "C:\Python27\lib\site-packages\traitsui\api.py", line 35, in <module>
from .editors.api import (ArrayEditor, BooleanEditor, ButtonEditor,
File "C:\Python27\lib\site-packages\traitsui\editors\__init__.py", line 22, in <module>
from .api import (toolkit, ArrayEditor, BooleanEditor, ButtonEditor,
File "C:\Python27\lib\site-packages\traitsui\editors\api.py", line 10, in <module>
from .code_editor import CodeEditor
File "C:\Python27\lib\site-packages\traitsui\editors\code_editor.py", line 36, in <module>
class ToolkitEditorFactory ( EditorFactory ):
File "C:\Python27\lib\site-packages\traitsui\editors\code_editor.py", line 48, in ToolkitEditorFactory
mark_color = Color( 0xECE9D8 )
File "C:\Python27\lib\site-packages\traits\traits.py", line 487, in __call__
return self.maker_function( *args, **metadata )
File "C:\Python27\lib\site-packages\traits\traits.py", line 1183, in Color
return ColorTrait( *args, **metadata )
File "C:\Python27\lib\site-packages\traitsui\toolkit_traits.py", line 7, in ColorTrait
return toolkit().color_trait( *args, **traits )
File "C:\Python27\lib\site-packages\traitsui\toolkit.py", line 109, in toolkit
_toolkit = _import_toolkit(ETSConfig.toolkit)
File "C:\Python27\lib\site-packages\traitsui\toolkit.py", line 51, in _import_toolkit
return __import__( name, globals=globals(), level=1 ).toolkit
File "C:\Python27\lib\site-packages\traitsui\qt4\__init__.py", line 18, in <module>
import pyface.qt
File "C:\Python27\lib\site-packages\pyface\qt\__init__.py", line 35, in <module>
prepare_pyqt4()
File "C:\Python27\lib\site-packages\pyface\qt\__init__.py", line 17, in prepare_pyqt4
sip.setapi('QString', 2)
ValueError: API 'QString' has already been set to version 1
anyone knows how to fix it?
Edit: If it will help, I see think that the problem is explained in the last column:
ValueError: API 'QString' has already been set to version 1
Edit: I tried changing API selection for QString and QVariant objects to Api #1,#2. didn't help.
Tried either to set the "Ignore API change errors" to true, didn't help.
Tried EST_TOOLKIT from 'qt4' to 'wx'.
It might be because spider itself uses the QT library and has already initialized it.
According to this http://pythonhosted.org/spyder/installation.html you could use PySide instead of PyQt4 (but i don't know if that's a configuation option or a fallback).

Importing a resource file

I'm having trouble removing a resource file in a pyqt document, I'm also using monkeystudio IDE. I madea program with images and all linked to a resource file called "resources.qyc" and now I get the error
Traceback (most recent call last):
File "main.py", line 9, in <module>
from Login import Login
File "J:\Newone\Login.py", line 3, in <module>
import mainwindow
File "J:\Newone\mainwindow.py", line 2, in <module>
import Addcadet
File "J:\Newone\Addcadet.py", line 6, in <module>
( Ui_Addcadet, QDialog ) = uic.loadUiType( 'Addcadet.ui' )
File "C:\Python32\lib\site-packages\PyQt4\uic\__init__.py", line 203, in loadUiType
exec(code_string.getvalue(), ui_globals)
File "<string>", line 179, in <module>
ImportError: No module named resources_rc
You'll first have to compile the resource file using pyrcc4. You'll run something like this from command line:
pyrcc4 ResourceFile.qrc -o ui_ResourceFile.py

Categories

Resources