ScientificPythonNovice
ScientificPythonNovice

Reputation: 133

Anaconda/Spyder sudden crash and startup error: Socket issue and/or ImportError

I have been using Anaconda distribution with Spyder IDE for some months without any problem. This morning, my system froze while a Python program was running and I had to restart. (Cause of freezing is unknown, but not program-related, since I checked it on multiple other systems.)

Since then, I am unable to start Spyder.

(1) On opening Spyder directly, I get:

"An error occured while creating a socket needed by Spyder".

(2)On opening through Anaconda prompt I get:

"ImportError: cannot import name '_overlapped'"

and

"OSError: [WinError 10022] An invalid argument was supplied" The full output is attached below.

(3) Anaconda Navigator freezes and closes on opening

I have tried the following steps without success:

(1) Restarting Spyder, restarting system.

(2) Resetting Spyder settings and restarting system.

(3) Resetting network settings using "netsh winsock reset"

I will be very grateful for any direction and suggestions to solve this problem and get Spyder running again.

(base) C:\Users\igc10740>spyder
Traceback (most recent call last):
  File "H:\Anaconda\lib\asyncio\__init__.py", line 16, in <module>
    from . import _overlapped
ImportError: cannot import name '_overlapped'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "H:\Anaconda\lib\site-packages\spyder\app\mainwindow.py", line 3208, in main
    mainwindow = run_spyder(app, options, args)
  File "H:\Anaconda\lib\site-packages\spyder\app\mainwindow.py", line 3084, in run_spyder
    main.setup()
  File "H:\Anaconda\lib\site-packages\spyder\app\mainwindow.py", line 835, in setup
    from spyder.plugins.help import Help
  File "H:\Anaconda\lib\site-packages\spyder\plugins\help.py", line 32, in <module>
    from spyder.utils.help.sphinxify import (CSS_PATH, generate_context,
  File "H:\Anaconda\lib\site-packages\spyder\utils\help\sphinxify.py", line 30, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "H:\Anaconda\lib\site-packages\jinja2\__init__.py", line 82, in <module>
    _patch_async()
  File "H:\Anaconda\lib\site-packages\jinja2\__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
  File "H:\Anaconda\lib\site-packages\jinja2\asyncsupport.py", line 13, in <module>
    import asyncio
  File "H:\Anaconda\lib\asyncio\__init__.py", line 18, in <module>
    import _overlapped  # Will also be exported.
OSError: [WinError 10022] An invalid argument was supplied

Upvotes: 1

Views: 1093

Answers (2)

Carlos Cordoba
Carlos Cordoba

Reputation: 34156

(Spyder maintainer here) I'd say the freeze you mention corrupted your H:\ partition, so I think you need to reinstall Anaconda to fix this problem.

Upvotes: 1

Anton Petrov
Anton Petrov

Reputation: 46

Is this on Windows or are you using Wine?

In any case, try the following: 1) remove old Python and old virtual environment using

conda list 

to see what environments you already have then

deactivate

followed by

conda remove --name myenv --all

2) install new Python version (64 bit would be recommended) https://www.python.org/getit/

3) add new env

conda create -n myenv python=3.6.5 #version of Python you installed

More conda commands here: https://conda.io/docs/user-guide/tasks/manage-environments.html

Upvotes: 1

Related Questions