Spyder doesn't load after the update 4.2.1 - python

I updated the anaconda Navigator and the Spyder.
But now when I try to launch it, there is the following message:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 210, in main
from spyder.app import mainwindow
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 119, in
from spyder.utils.environ import WinUserEnvDialog
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\environ.py", line 19, in
from spyder.plugins.variableexplorer.widgets.collectionseditor import (
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 57, in
from spyder.plugins.variableexplorer.widgets.collectionsdelegate import (
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\collectionsdelegate.py", line 31, in
from spyder.plugins.variableexplorer.widgets.objectexplorer.attribute_model \
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\objectexplorer\__init__.py", line 23, in
from .objectexplorer import ObjectExplorer
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\objectexplorer\objectexplorer.py", line 33, in
from spyder.plugins.editor.widgets.codeeditor import CodeEditor
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 70, in
from spyder.plugins.editor.panels import (ClassFunctionDropdown,
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\panels\__init__.py", line 13, in
from .codefolding import FoldingPanel
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\panels\codefolding.py", line 32, in
from spyder.plugins.editor.panels.utils import (
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\panels\utils.py", line 15, in
import textdistance
ModuleNotFoundError: No module named 'textdistance'
Can someone please suggest me what should I do
EDIT
I followed what "CanciuCostin" suggested in the comment.
And now I'm getting the following:
I tried conda install -c anaconda qtconsole and conda update qtconsole as well. But still the message is there.. :/

I had the same error today - with the last line about textdistance. I used conda to install text distance from the same environment as spyder and now I can open Spyder again.
conda install textdistance
My anaconda environment uses Python 3.

Well.. I used conda uninstall qtconsole and then once the uninstallation is complete, I installed it again by the command conda install qtconsole. But then I had to install spyder as well ( conda install sypder ).
Then it worked. But I had to install some libraries like scipy ( conda install scipy )

Related

Cannot install Python 2 kernel in Jupyter Notebook

I am trying to use a Python program written for Python 2.7. I am using a Macbook Pro running Catalina. The program is here: https://github.com/geoss/censumander. The program has two Jupyter Notebooks to practice with. I have Anaconda 4.9.2 installed and pip 20.2.4. When I open Jupyter Notebook it defaults to Python 3 and has no kernel option to change to Python 2. I have used the guide here to try to install the Python 2 kernel: https://ipython.readthedocs.io/en/latest/install/kernel_install.html.
When I run
python2 -m pip install ipykernel
I get back
Could not find a version that satisfies the requirement ipykernel (from versions: )
No matching distribution found for ipykernel.
I am pretty new to using Python (typically use R) and am trying to get the hang of stuff like this, so apologies if the answer here is obvious. I've tried the solutions here to no avail: Jupyter notebook with Python 2 and Python3 Kernel
I have also tried the solutions here: Jupyter Notebook - install python 2. The first solution
$ python2 /path/to/jupyter-notebook
is unclear to me as I don't understand to what file path the code points (for jupyter_notebook). (This is likely a consequence of my noobiness.)
The second,
conda create -n ipykernel_py2 python=2 ipykernel
conda activate ipykernel_py2
python -m ipykernel install --user
triggers the following traceback after the third line:
Traceback (most recent call last):
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 16, in <module>
from prompt_toolkit.document import Document
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/__init__.py", line 16, in <module>
from .interface import CommandLineInterface
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 19, in <module>
from .application import Application, AbortAction
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/application.py", line 3, in <module>
from .buffer import Buffer, AcceptAction
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/buffer.py", line 7, in <module>
from .auto_suggest import AutoSuggest
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/auto_suggest.py", line 13, in <module>
from .filters import to_cli_filter
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/filters/__init__.py", line 33, in <module>
from .base import *
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/filters/base.py", line 5, in <module>
from prompt_toolkit.utils import test_callable_args
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/utils.py", line 9, in <module>
from wcwidth import wcwidth
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/wcwidth/__init__.py", line 12, in <module>
from .wcwidth import ZERO_WIDTH # noqa
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/wcwidth/wcwidth.py", line 79, in <module>
from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache
Thanks, all.
From version 5.0 ipykernel only runs on Python 3.4+ (from version 5.2 — 3.5+). To install ipykernel` for Python 2.7 you need an older version:
python2 -m pip install 'ipykernel<5.0'
For backports.functools-lru-cache install or force-reinstall it:
pip install -U backports.functools-lru-cache
or
pip install --ignore-installed backports.functools-lru-cache

Cannot launch specific applications on Anaconda

The problem is:
I cannot launch applications like Spyder, Glueviz, Jupyter Notebook and JupyterLab from Anaconda.
I however can launch VS code but I suspect this is because I already had it previously installed.
However typing "jupyter notebook" or "jupyter lab" on the windows command prompt would launch it well, but this is not using Anaconda. I think this is because I have previously installed jupyter using pip.
First time I installed Anaconda, I checked the add to path option and a while later I had to uninstall it because I couldn't run python applications outside of anaconda. I checked my environment path variables and there are no references to Anaconda in it. So I guess this solution is out of the way.
This time when installing Anaconda, I made sure not to check the add to path option.
Sometimes, I would think this is an installation error, let's uninstall it then reinstall it, but that didn't work. I am using a freshly installed version of Anaconda now and the problem is persisting.
Here is an error that displays when I try to launch Spyder
Traceback (most recent call last):
File "C:\Users\saife\anaconda3\Scripts\spyder-script.py", line 6, in
from spyder.app.start import main
File "C:\Users\saife\anaconda3\lib\site-packages\spyder\app\start.py", line 22, in
import zmq
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\__init__.py", line 47, in
from zmq import backend
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from 'zmq.backend.cython' (C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython\__init__.py)
Try this instead of pip, conda install -c anaconda "IDE you want"

Juypter will not launch from Anaconda

When launching Juypter from Anaconda I receive the following error message:
Traceback (most recent call last):
File "C:\Users\ceo20\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\ceo20\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 80, in
from .services.kernels.kernelmanager import MappingKernelManager
File "C:\Users\ceo20\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 19, in
from jupyter_client.session import Session
File "C:\Users\ceo20\Anaconda3\lib\site-packages\jupyter_client__init__.py", line 4, in
from .connect import *
File "C:\Users\ceo20\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 35, in
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
ImportError: cannot import name 'secure_write' from 'jupyter_core.paths' (C:\Users\ceo20\Anaconda3\lib\site-packages\jupyter_core\paths.py)
Any thoughts?
Try this in Anaconda prompt
pip install --upgrade jupyter_client
pip install --upgrade jupyter_client
This package provides the Python API for starting, managing and communicating with Jupyter kernels. The above code will upgrade jupyter client.

Jupyter notebook not opening in VS Code

While setting up my new system, I am trying to run my notebook file on VS Code but as soon as I open VS Code it give me this error
Failed to detect Jupyter Notebook. Please use 'Select Jupyter Notebook' command
in the output:
Unable to determine version of Jupyter, Traceback (most recent call last):
File "C:\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 46, in <module>
from zmq.eventloop import ioloop
File "C:\Anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Anaconda3\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
I have installed all the plugins which were necessary, ran various commands, I also updated the notebook.
conda install notebook
I am using:
anaconda 3
vs code 1.26.1
windows 10
I cant start new notebooks or use an existing one either.
Please help, and let me know if any more information is required.
Check the required extensions installed in vscode.
install jupyter and ipython packages in your python venv using pip:
pip install jupyter
pip install ipython
If its still not working try to change the python kernal in the top right corner of ipynb notebook.
This is due to running jupyter without first activating the environment for Python 3.7. This was fixed in the 2018.12.0 release of the extension.
When it fails with this response you can uninstall conda and jupyter and install python from VS Code and then update. Don't necessarily install conda and jupyter.

running pyinstaller after Anaconda install results in ImportError: no Module named 'pefile'

I did conda install -c acellera pyinstaller=3.2.3 as per Anaconda's website and it looks like it installed correctly but I get the following if I try to run it via cmd:
C:\Users\Cornelis Dirk Haupt\PycharmProjects\Mesoscale-Brain-Explorer\src>pyinstaller
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\pyinstaller-script.py", line 9, in <module>
load_entry_point('PyInstaller==3.3.dev0+g8756735', 'console_scripts', 'pyinstaller')()
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 542, in load_entry_point
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2569, in load_entry_point
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2229, in load
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2235, in resolve
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 21, in <module>
import PyInstaller.building.build_main
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 34, in <module>
from .api import PYZ, EXE, COLLECT, MERGE
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\api.py", line 38, in <module>
from PyInstaller.utils.win32 import winmanifest, icon, versioninfo, winresource
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\win32\versioninfo.py", line 17, in <module>
import pefile
ImportError: No module named 'pefile'
What's going on? Pyinstaller works fine with python 2.7 without Anaconda. But I've recently decided to make the jump to Anaconda + 3.5. I cant find any module named pefile or how to install it with Anaconda. I can install pefile easily using pip3 though.
You can use Anaconda's pip to install it, just go to the Script folder in Anaconda and execute:
pip.exe install pefile
install this instead:
conda install -c conda-forge pyinstaller=3.2.1
working fine for me after a couple of tries!

Categories

Resources