Anaconda Spyder doesn't launch - python

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.

Related

TypeError: unhashable type: 'Path' (Importing any package)

EDIT: I've narrowed this down to django rest framework, but not exactly why. About to start deep package debugging :/
I've got a weird one here. I've setup a mini Django project, and in the urls.py file, if I try any "from package import X", it results in an exception: TypeError: unhashable type: 'Path'
With no imports in this file, it all works perfectly and the server starts etc.
File "/app/app/urls.py", line 2, in <module>
2023-01-21T04:41:15.890469838Z from rest_framework.response import Response
2023-01-21T04:41:15.890486088Z File "/usr/local/lib/python3.8/site-packages/rest_framework/response.py", line 11, in <module>
2023-01-21T04:41:15.890490338Z from rest_framework.serializers import Serializer
2023-01-21T04:41:15.890492504Z File "/usr/local/lib/python3.8/site-packages/rest_framework/serializers.py", line 27, in <module>
2023-01-21T04:41:15.890516629Z from rest_framework.compat import postgres_fields
2023-01-21T04:41:15.890534421Z File "/usr/local/lib/python3.8/site-packages/rest_framework/compat.py", line 33, in <module>
2023-01-21T04:41:15.890571546Z import coreapi
2023-01-21T04:41:15.890591004Z File "/usr/local/lib/python3.8/site-packages/coreapi/__init__.py", line 2, in <module>
2023-01-21T04:41:15.890598088Z from coreapi import auth, codecs, exceptions, transports, utils
2023-01-21T04:41:15.890600588Z File "/usr/local/lib/python3.8/site-packages/coreapi/auth.py", line 1, in <module>
2023-01-21T04:41:15.890602963Z from coreapi.utils import domain_matches
2023-01-21T04:41:15.890605254Z File "/usr/local/lib/python3.8/site-packages/coreapi/utils.py", line 5, in <module>
2023-01-21T04:41:15.890724213Z import pkg_resources
2023-01-21T04:41:15.890736088Z File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3249, in <module>
2023-01-21T04:41:15.891071296Z def _initialize_master_working_set():
2023-01-21T04:41:15.891081671Z File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3223, in _call_aside
2023-01-21T04:41:15.891363838Z f(*args, **kwargs)
2023-01-21T04:41:15.891371088Z File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3261, in _initialize_master_working_set
2023-01-21T04:41:15.891722921Z working_set = WorkingSet._build_master()
2023-01-21T04:41:15.891733421Z File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 608, in _build_master
2023-01-21T04:41:15.891780379Z ws = cls()
2023-01-21T04:41:15.891790796Z File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 601, in __init__
2023-01-21T04:41:15.891883463Z self.add_entry(entry)
2023-01-21T04:41:15.891889546Z File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 655, in add_entry
2023-01-21T04:41:15.892080713Z self.entry_keys.setdefault(entry, [])
2023-01-21T04:41:15.892097713Z TypeError: unhashable type: 'Path'
Here is the full repo ready to run https://gitlab.com/mainmast/import-issue/-/tree/main
You will need to add an .env file in services/shared/ folder. Then you can run "make up"
POSTGRES_PASSWORD=ai
POSTGRES_USER=ai
POSTGRES_DBNAME=ai
POSTGRES_HOST=postgres-ai
POSTGRES_TEST=test_ai
SECRET_KEY=%&jxaf6ijs36d82#r+^hq%=d7w8*2)r9afv*z#5y=(vt$h38m5
REGISTRATION_SALT=sx<)XYH.G0\"3GhqGLfY7~3Nt'63\"Yp
DJANGO_DEBUG=True
DEBUG_DB=True
ALLOWED_HOSTS=*
CORS_ORIGIN_WHITELIST=http://0.0.0.0
CORS_ALLOWED_ORIGINS=http://0.0.0.0
WEB_SERVER=app.myapp.co
WEB_APP_URL=app.myapp.co
EMAIL_URL=
AXES_BEHIND_REVERSE_PROXY=off
SITE_ID=3
ACCESS_TOKEN_EXPIRE_SECONDS=600
SUPPORT_EMAIL=
ACCOUNT_ACTIVATION_DAYS=2
SENTRY_ID=
SENTRY_ENDPOINT=
SENTRY_ENVIRONMENT=SomeEnv
MAX_IMAGE_UPLOAD_SIZE_BYTES=10000000
# Application environment settings
APP_ENV=local
APP_USE_AWS_S3_STATIC=False
APP_USE_AWS_S3_MEDIA=False
SSL_CERT_CHAIN=ssl\/local.crt
SSL_CERT_KEY=ssl\/local.key
SSL_CERT_DHPARAM=ssl\/dhparams.local.pem
I've never come across this before, although this is the first time I'm doing experimenting with sharing Django code across smaller independent container services.
Any help would be greatly appreciated. I see that something around coreapi dies, and no matter what I import, coreapi seems to be there as the last thing trying to import pkg_resources - but I can't figure out why?

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"

When trying to run a pyglet window, I get this error: "AttributeError: 'scipy.spatial.transform._rotation.Rotation' object has no attribute 'as_dcm'"

This is all my code
import pyglet
import ratcave as rc
window = pyglet.window.Window()
pyglet.app.run()
When running this, the following shows in terminal
Traceback (most recent call last):
File "c:\CODING\pyopengl\Mudge-David-Homework-8.py", line 14, in <module>
import ratcave as rc
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\__init__.py", line 5, in <module>
from . import resources
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\resources.py", line 40, in <module>
default_camera = Camera()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 260, in __init__
self.projection = PerspectiveProjection() if not projection else projection
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\utils\observers.py", line 56, in __setattr__
super(AutoRegisterObserver, self).__setattr__(key, value)
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 299, in projection
self.reset_uniforms()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 302, in reset_uniforms
self.uniforms['projection_matrix'] = self.projection_matrix.view()
PS C:\Users\David> & C:/Users/David/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/CODING/pyopengl/Mudge-David-Homework-8.py
Traceback (most recent call last):
File "c:\CODING\pyopengl\Mudge-David-Homework-8.py", line 14, in <module>
import ratcave as rc
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\__init__.py", line 5, in <module>
from . import resources
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\resources.py", line 40, in <module>
default_camera = Camera()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 260, in __init__
self.projection = PerspectiveProjection() if not projection else projection
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\utils\observers.py", line 56, in __setattr__
super(AutoRegisterObserver, self).__setattr__(key, value)
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 299, in projection
self.reset_uniforms()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 302, in reset_uniforms
self.uniforms['projection_matrix'] = self.projection_matrix.view()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\shader.py", line 139, in uniforms
self.update()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\utils\observers.py", line 47, in update
self.on_change()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\physical.py", line 186, in on_change
Physical.on_change(self)
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\physical.py", line 138, in on_change
self.model_matrix = np.dot(self.position.to_matrix(), self.rotation.to_matrix())
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\coordinates.py", line 126, in to_matrix
return self.to_radians().to_matrix()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\coordinates.py", line 95, in to_matrix
mat[:3, :3] = R.from_euler(self.axes[1:],self._array,degrees=False).as_dcm() # scipy as_matrix() not available
AttributeError: 'scipy.spatial.transform._rotation.Rotation' object has no attribute 'as_dcm'
With seemingly the error being that final line
AttributeError: 'scipy.spatial.transform._rotation.Rotation' object has no attribute 'as_dcm'
Im trying to follow this tutorial
The code should create a new window, which in turn means Pyglet is working.
From what I have researched, this has been solved through SciPy methods being changed, which I have attempted with no luck. Another thread of this issue resolved it by installing the correct version, which would correct these methods. However I have attempted to install different versions of SciPy and still get the same error.
The as_dcm() method of the Rotation class was deprecated in SciPy version 1.4.0 and removed from SciPy version 1.6.0. You'll have to use an older version of SciPy, or find out if there is a version of ratcave that works with the latest version of SciPy.

Thonny py5-mode Error when running a code

I just tried to use py5 in thonny, but everytime i have the py5 mode on and try to run a code i get a bunch of error messeges, i dont really know what they mean so maybe somebody can help me out ?
thanks in advance
This is the error im always getting
Traceback (most recent call last):
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\tools\run_sketch.py", line 52, in <module>
main()
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\tools\run_sketch.py", line 44, in main
imported.run_code(
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\imported.py", line 135, in run_code
_run_code(
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\imported.py", line 259, in _run_code
_run_sketch(sketch_path, classpath, exit_if_error)
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\imported.py", line 196, in _run_sketch
import py5
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5\__init__.py", line 84, in <module>
from py5_tools.magics import load_ipython_extension # noqa
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\magics\__init__.py", line 22, in <module>
from .drawing import DrawingMagics, DXFDrawingMagic
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\magics\drawing.py", line 27, in <module>
from IPython.display import display, SVG, Image
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\__init__.py", line 51, in <module>
from .core.application import Application
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\core\application.py", line 26, in <module>
from IPython.core import release, crashhandler
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\core\crashhandler.py", line 27, in <module>
from IPython.core import ultratb
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\core\ultratb.py", line 101, in <module>
import stack_data
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\stack_data\__init__.py", line 1, in <module>
from .core import Source, FrameInfo, markers_from_ranges, Options, LINE_GAP, Line, Variable, RangeInLine, \
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\stack_data\core.py", line 19, in <module>
from stack_data.utils import (
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\stack_data\utils.py", line 11, in <module>
from asttokens import ASTText
ImportError: cannot import name 'ASTText' from 'asttokens' (C:\Users\schwe\AppData\Local\Programs\Thonny\lib\site-packages\asttokens\__init__.py)
I received a response from the py5 developer via Github. They also provided an explanation but it goes over my head, something about "The Python library asttokens is used for parsing syntax trees and syntax highlighting. It is not used by py5 but it might be used by Jupyter Notebook and/or JupyterLab.". They also provided a solution here:
enter link description here

Unable to Import Spacy or Download Models

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

Categories

Resources