Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spyder encounters a problems when launching seems complete #14012

Closed
france5co opened this issue Oct 19, 2020 · 15 comments
Closed

Spyder encounters a problems when launching seems complete #14012

france5co opened this issue Oct 19, 2020 · 15 comments

Comments

@france5co
Copy link

france5co commented Oct 19, 2020

Description

What steps will reproduce the problem?

  1. Open the MacOS Terminal.app and set in the base enviroment of Anaconda
  2. Launch spyder

What is the expected output? What do I see instead?

Spyder is opened, but an error pops up "spyder has encountered a problem", and freezes in "connecting to kernel" forever.

Additional information

The following is the message I get from the spyder Issue reporter every time the app seems ready to work ( at the bottom of the spyder IDE appears the message "LSP Python: ready" ).
I work with MacOS and the fv directory is my user directory (it's where I installed Anaconda).

I want to warn you that:
(1) I launch spyder from my base enviroment in the terminal.app but I get the same message also if I launch it from Anaconda,
(2) I've already tried resetting all the spyder settings and reinstalling the Anaconda app,
(3) Despite in the spyder IDE appears the message "LSP Python: ready" the terminal.app is still working on the simple initial command (>>spyder) I used to launch the application. As a matter of fact, when I force the the terminal with the command ^C the spyder app closes.

What can I do?
Thanks for the help

File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/base.py", line 327, in
toggled=lambda checked: self.toggle_view(checked),
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 214, in toggle_view
self.create_new_client(give_focus=False)
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 713, in create_new_client
self.register_client(client)
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 935, in register_client
shellwidget.set_cwd(cwd_path)
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/widgets/shell.py", line 221, in set_cwd
self.call_kernel(interrupt=True).set_cwd(dirname)
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder_kernels/comms/commbase.py", line 549, in call
return self._comms_wrapper._get_call_return_value(
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 149, in _get_call_return_value
with self.comm_channel_manager(
File "/Users/fv/opt/anaconda3/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 86, in comm_channel_manager
self._wait(self.comm_channel_connected,
File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 205, in _wait
raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.
WARNING:traitlets:kernel died: 24.999602794647217
WARNING:traitlets:kernel died: 25.188823223114014
WARNING:traitlets:kernel died: 25.00175380706787
WARNING:traitlets:kernel died: 24.99987816810608

Traceback

  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/base.py", line 327, in <lambda>
    toggled=lambda checked: self.toggle_view(checked),
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 214, in toggle_view
    self.create_new_client(give_focus=False)
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 713, in create_new_client
    self.register_client(client)
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 935, in register_client
    shellwidget.set_cwd(cwd_path)
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/widgets/shell.py", line 221, in set_cwd
    self.call_kernel(interrupt=True).set_cwd(dirname)
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder_kernels/comms/commbase.py", line 549, in __call__
    return self._comms_wrapper._get_call_return_value(
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 149, in _get_call_return_value
    with self.comm_channel_manager(
  File "/Users/fv/opt/anaconda3/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 86, in comm_channel_manager
    self._wait(self.comm_channel_connected,
  File "/Users/fv/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 205, in _wait
    raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.
WARNING:traitlets:kernel died: 24.999602794647217
WARNING:traitlets:kernel died: 25.188823223114014
WARNING:traitlets:kernel died: 25.00175380706787
WARNING:traitlets:kernel died: 24.99987816810608

Versions

  • Spyder version: 4.1.5
  • Python version: 3.8.1
  • Qt version: 5.9.7
  • PyQt5 version: 5.9.2
  • Operating System: Darwin 19.6.0

Dependencies


# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.18.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  6.0.7 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.7.1 (OK)
pylint >=1.0                   :  2.6.0 (OK)
pyls >=0.34.0;<1.0.0           :  0.35.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  1.0.1 (OK)
qtconsole >=4.6.0              :  4.7.7 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  0.29.21 (OK)
matplotlib >=2.0.0             :  3.3.1 (OK)
numpy >=1.7                    :  1.19.1 (OK)
pandas >=0.13.1                :  1.1.3 (OK)
scipy >=0.17.0                 :  1.5.0 (OK)
sympy >=0.7.3                  :  1.6.2 (OK)
@spyder-bot
Copy link
Collaborator

Thanks for reporting. This issue is a duplicate of #13288. Please keep track of that issue as it will be fixed in a future release.

@ccordoba12
Copy link
Member

Hey @france5co, thanks for reporting. Please open Terminal.app, run there

python -m spyder_kernels.console

and report any errors you see printed there.

@france5co
Copy link
Author

france5co commented Oct 19, 2020

When you say "run there" you mean in my starting (standard) terminal page or in the base environment in which I launch spyder?
Anyway I tried both. In the first case the terminal.app prints the following message
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named spyder_kernels
In the second case:
NOTE: When using the ipython kernel entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see ipython/ipython#2049

To connect another client to this kernel, use:
--existing kernel-12252.json

Thanks a lot for the help

@ccordoba12
Copy link
Member

I meant the second case. Thanks for running it.

Please create a new conda environment to install Spyder on it, to see if that helps. For that, please run the following commands:

  • conda create -n clean-env python=3.7 spyder
  • conda activate clean-env
  • spyder

@france5co
Copy link
Author

I did what you suggested me. After the first activation of the new conda environment, the spyder IDE opened correctly and no message from the Issue reporter appeared. Once I noticed that the terminal was still running, I decided to try the command cmd-\ to see if that could help, as read in the ipython/ipython#2049. This brought the terminal in its beginning status and forced the spyder IDE to close. Unfortunately, the error message box sill pops up at every new launching of the spyder IDE.
The following is the last message I got from the Issue reporter:

File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/base.py", line 327, in
toggled=lambda checked: self.toggle_view(checked),
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 214, in toggle_view
self.create_new_client(give_focus=False)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 713, in create_new_client
self.register_client(client)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 935, in register_client
shellwidget.set_cwd(cwd_path)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/shell.py", line 221, in set_cwd
self.call_kernel(interrupt=True).set_cwd(dirname)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 550, in call
call_dict, call_data, self._comm_id)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 150, in _get_call_return_value
comm_id, queue_message=not interrupt):
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/contextlib.py", line 112, in enter
return next(self.gen)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 89, in comm_channel_manager
timeout)
File "/Users/fv/opt/anaconda3/envs/clean-env/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 205, in _wait
raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.
WARNING:traitlets:kernel died: 34.99949812889099

I want to add that, when I first opened spyder in the clean-env, I decided to put it to test with the simple command "import numpy as np" in the IPython console. I got another error message, which sad that "ModuleNotFoundError: No module named 'numpy' ". Could this be somehow linked to the original problem or this could be solved installing the libraries I need in the new environment?

@ccordoba12
Copy link
Member

After the first activation of the new conda environment, the spyder IDE opened correctly and no message from the Issue reporter appeared

That sounded promising.

Unfortunately, the error message box sill pops up at every new launching of the spyder IDE.

I really don't understand why things worked for you the first time, but not after that.

I want to add that, when I first opened spyder in the clean-env, I decided to put it to test with the simple command "import numpy as np" in the IPython console. I got another error message, which sad that "ModuleNotFoundError: No module named 'numpy' ". Could this be somehow linked to the original problem or this could be solved installing the libraries I need in the new environment?

Yeah, that's solved by installing numpy in the environment.

@ccordoba12
Copy link
Member

Could you run these commands to see what you get now?

  • conda activate clean-env
  • python -m spyder_kernels.console

@france5co
Copy link
Author

I really don't understand why things worked for you the first time, but not after that.

Neither do I. I'm really confused too.

Could you run these commands to see what you get now?

Just did it, here is what I got:

NOTE: When using the ipython kernel entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see ipython/ipython#2049

To connect another client to this kernel, use:
--existing kernel-1472.json

@ccordoba12
Copy link
Member

I'm sorry but I really don't understand why this error happens. Could you try to run

spyder --reset

and start Spyder in your clean-env environment?

@france5co
Copy link
Author

Unfortunately your suggestion didn't work completely. Here's what I did and what happened:

  1. I run the command 'spyder --reset' and then started Spyder in the clean-env environment.
  2. The terminal immediately after shows the unusual message "Update LANGUAGE_CODES (inside config/base.py) if a new translation has been added to Spyder" and then the spyder app opens correctly.
  3. Since everything seem to work fine I decide to install in the current environment numpy, scipy and all the other packages I need, make a few adjustments in the Preferences and start spider again.
  4. When launching seems complete the Issue reporter pops up saying "Spyder has encountered an internal problem!".
    The traceback that it shows is always the same (do you want to see it anyway?).

A good thing is that I can use Python anyway, despite the terminal is useless and the signs in the IPython console are big and with a strange font. Let the me now if the problems is somehow solvable. If not, I can adapt myself to this.

@ccordoba12
Copy link
Member

A good thing is that I can use Python anyway, despite the terminal is useless and the signs in the IPython console are big and with a strange font. Let the me now if the problems is somehow solvable. If not, I can adapt myself to this.

What do you mean by this? I don't understand.

@france5co
Copy link
Author

My fault, when I wrote Python I was thinking about the Spyder IDE. I can use it somehow. Since the two bugs I was talking about are not a huge obstacle and the features of Spyder that I need work, I can live with the Issue that is reported everytime.

@ccordoba12
Copy link
Member

Ok, sorry for the inconvenience. I'll close this in favor of #13288. We'll try to fix this problem in the next couple of months.

@SanjuMLGeek
Copy link

I have all options in thread but I have issues launching Spyder 4.1.5 from Navigator or command line.
I have tried both 4.1.3 and 4.1.5 in new conda environment and it throws same error as I see while launching Spyder IDE from navigator.

File "/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/console/widgets/shell.py", line 71, in init
self.history = self.load_history()
File " ", line 499, in load_history
if rawhistory[1] != self.INITHISTORY[1]:
IndexError: list index out of range

Spyder version: 4.1.5
Python version: 3.8.5
Qt version: 5.9.7
PyQt version: 5.9.2
Operating System: MacOD Catalina 10.15.7

@ccordoba12
Copy link
Member

This problem was fixed in Spyder 4.2.1, so you need to update with the following commands:

conda update anaconda
conda install spyder=4.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants