question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spyder crashes on start ("no module named..." errors)

See original GitHub issue

Description

What steps will reproduce the problem?

OMEN by HP Laptop 15-dc1xxx Windows 10 Home 64-bit Version 1809 Build 17763.1158 Intel Core i7-9750H CPU @ 2.60 GHz 2.59 16.0 GB RAM

I feel I should mention I’m a relative Anaconda beginner and have been using it since fall 2019, but I get how Python libraries generally work. I really like the Anaconda suite for development, and while I’m still trying to figure out some things, I can generally solve my own problems by doing a quick Google search. Today I finally have run up against a problem which has brought my development to a halt.

This issue started for me yesterday after I naively did a mass update to my base environment’s packages, trying to get a package called Basecamp to run in a Python script. I kept getting an error “raise keyerror(key) from none os.environ PROJ_LIB” due to what seemed to be a missing library. I tried a few other things but ultimately ended up updating everything with ‘conda update --all’ as noted below, and briefly, Spyder ran my code, and Basecamp seemed to be working. I could produce maps and everything seemed okay, save for a few minor warnings.

Then today I got a kernel error trying to start Spyder after a computer restart: “ModuleNotFoundError: No module named ‘urllib.request’; ‘urllib’ is not a package”

I consulted the comprehensive Troubleshooting Guide, and proceeded through each step. Ultimately, I have:

  1. Tried restarting Spyder. Kernel failure again, and every time.
  2. Ran ‘conda update --all’. Many packages were updated, but still kernel failure with the same error code.
  3. Restarted the computer. No change.
  4. Reset Spyder with ‘spyder --reset’. No change.
  5. Removed Anaconda3 from my system using Windows 10’s built-in software removal utility.
  6. Downloaded and installed Anaconda3-2020.02-Windows-x86_64.exe.
  7. Created a new environment with Python 3.8 and various Spyder versions, including the latest (4.1.2). Continue to receive ‘urllib’ module missing error, preventing kernel start.
  8. Created an environment with Python 3.7 and various Spyder versions, including the latest. Now received a warning that jedi and parso were missing dependencies, even though I confirmed they were both installed by attempting to install them using pip and conda. Each said requirements were already satisfied, and matched the required versions of the respective packages. Currently, the error message on kernel failure is the same ‘no module’ error but for psutil.
  9. Finally, I attempted to start Spyder again, and in addition to the jedi and parso warning I was also prompted with this Issue reporter so I decided to give it a shot.

I think that’s everything I can think of. I’d really appreciate some help. Spyder is such a great solution for Python programming.

Thanks for all the great work so far!

Traceback

  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\_pswindows.py", line 679, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\_pswindows.py", line 933, in create_time
    user, system, created = cext.proc_times(self.pid)
ProcessLookupError: [Errno 3] No such process (originated from GetExitCodeProcess != STILL_ACTIVE)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\__init__.py", line 373, in _init
    self.create_time()
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\__init__.py", line 723, in create_time
    self._create_time = self._proc.create_time()
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\_pswindows.py", line 681, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=3916)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ryanl\Anaconda3\envs\ryans_37playground\lib\site-packages\qtconsole\manager.py", line 27, in poll
    super(QtKernelRestarter, self).poll()
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\jupyter_client\restarter.py", line 113, in poll
    self.kernel_manager.restart_kernel(now=True, newports=newports)
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\jupyter_client\manager.py", line 411, in restart_kernel
    self.shutdown_kernel(now=now, restart=True)
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\jupyter_client\manager.py", line 371, in shutdown_kernel
    self._kill_kernel()
  File "C:\Users\ryanl\Anaconda3\envs\ryans_37playground\lib\site-packages\spyder\plugins\ipythonconsole\utils\manager.py", line 78, in _kill_kernel
    self.kill_proc_tree(self.kernel.pid)
  File "C:\Users\ryanl\Anaconda3\envs\ryans_37playground\lib\site-packages\spyder\plugins\ipythonconsole\utils\manager.py", line 44, in kill_proc_tree
    parent = psutil.Process(pid)
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\__init__.py", line 346, in __init__
    self._init(pid)
  File "C:\Users\ryanl\Anaconda3\Lib\site-packages\psutil\__init__.py", line 386, in _init
    raise NoSuchProcess(pid, None, msg)
psutil.NoSuchProcess: psutil.NoSuchProcess no process found with pid 3916
WARNING:traitlets:kernel died: 45.000070095062256
WARNING:traitlets:kernel died: 45.00038528442383
WARNING:traitlets:kernel died: 45.000828981399536
WARNING:traitlets:kernel died: 45.000654458999634
WARNING:traitlets:kernel died: 45.000643491744995
WARNING:traitlets:kernel died: 45.00087356567383
WARNING:traitlets:kernel died: 45.00032997131348
WARNING:traitlets:kernel died: 45.00034737586975
WARNING:traitlets:kernel died: 45.00120234489441
WARNING:traitlets:kernel died: 45.00158214569092
WARNING:traitlets:kernel died: 45.000662088394165
WARNING:traitlets:kernel died: 45.0007483959198
WARNING:traitlets:kernel died: 45.000096559524536
WARNING:traitlets:kernel died: 45.00024151802063
WARNING:traitlets:kernel died: 45.00011467933655
WARNING:traitlets:kernel died: 45.000279664993286
WARNING:traitlets:kernel died: 45.00091862678528
WARNING:traitlets:kernel died: 45.00119209289551
WARNING:traitlets:kernel died: 45.00102758407593
WARNING:traitlets:kernel died: 45.00018239021301
WARNING:traitlets:kernel died: 45.00015616416931
WARNING:traitlets:kernel died: 45.00012397766113
WARNING:traitlets:kernel died: 45.000683069229126
WARNING:traitlets:kernel died: 45.000020027160645
WARNING:traitlets:kernel died: 45.00082850456238
WARNING:traitlets:kernel died: 45.000876665115356
WARNING:traitlets:kernel died: 45.00003099441528
WARNING:traitlets:kernel died: 45.000847578048706
WARNING:traitlets:kernel died: 45.000925064086914
WARNING:traitlets:kernel died: 45.00168204307556
WARNING:traitlets:kernel died: 45.000365257263184
WARNING:traitlets:kernel died: 45.0008430480957
WARNING:traitlets:kernel died: 45.00123143196106
WARNING:traitlets:kernel died: 45.00008940696716
WARNING:traitlets:kernel died: 45.00031876564026
WARNING:traitlets:kernel died: 45.000794410705566
WARNING:traitlets:kernel died: 45.00072264671326
WARNING:traitlets:kernel died: 45.00028991699219
WARNING:traitlets:kernel died: 45.00027298927307
WARNING:traitlets:kernel died: 45.000853061676025
WARNING:traitlets:kernel died: 45.00008225440979
WARNING:traitlets:kernel died: 45.00027871131897
WARNING:traitlets:kernel died: 45.00042366981506
WARNING:traitlets:kernel died: 45.00086712837219
WARNING:traitlets:kernel died: 45.000532388687134
WARNING:traitlets:kernel died: 45.0004768371582
WARNING:traitlets:kernel died: 45.00119423866272
WARNING:traitlets:kernel died: 45.000115394592285
WARNING:traitlets:kernel died: 45.00082302093506
WARNING:traitlets:kernel died: 45.00052618980408
WARNING:traitlets:kernel died: 45.00098514556885
WARNING:traitlets:kernel died: 45.00031924247742
WARNING:traitlets:kernel died: 45.00026750564575
WARNING:traitlets:kernel died: 45.00020623207092
WARNING:traitlets:kernel died: 45.000269412994385
WARNING:traitlets:kernel died: 45.0006468296051
WARNING:traitlets:kernel died: 45.00080060958862
WARNING:traitlets:kernel died: 45.0009331703186
WARNING:traitlets:kernel died: 45.00025820732117
WARNING:traitlets:kernel died: 45.00003457069397
WARNING:traitlets:kernel died: 45.000239610672
WARNING:traitlets:kernel died: 45.00125694274902
WARNING:traitlets:kernel died: 45.00019550323486
WARNING:traitlets:kernel died: 45.00058460235596
WARNING:traitlets:kernel died: 44.99979639053345
WARNING:traitlets:kernel died: 45.00083827972412
WARNING:traitlets:kernel died: 45.000418186187744
WARNING:traitlets:kernel died: 45.000229597091675
WARNING:traitlets:kernel died: 45.00095796585083
WARNING:traitlets:kernel died: 45.00028657913208
WARNING:traitlets:kernel died: 45.00106358528137
WARNING:traitlets:kernel died: 45.00000357627869
WARNING:traitlets:kernel died: 45.00052881240845
WARNING:traitlets:kernel died: 45.000163078308105
WARNING:traitlets:kernel died: 45.000466108322144

Versions

  • Spyder version: 4.1.1
  • Python version: 3.7.7
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.3.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.15.2                   :  0.16.0 (NOK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.5.2                   :  0.6.2 (NOK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.3 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.4.4 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  None (OK)
numpy >=1.7                    :  None (OK)
pandas >=0.13.1                :  None (OK)
scipy >=0.17.0                 :  None (OK)
sympy >=0.7.3                  :  None (OK)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Apr 25, 2020

I’m glad you were able to figure out how to solve this issue.

1reaction
rytzcommented, Apr 25, 2020

One final (hopefully) comment to put this issue to rest. I’ve found that I fundamentally misunderstood the PYTHONPATH function. I was adding directories which contained some scripts which included some functions I had personally written and wanted to use. When Spyder started, it was running all scripts in those directories, some of which contained import calls which were outdated, and those were breaking the system on kernel startup.

I guess I don’t really understand how to keep personal libraries for use in Spyder, but I’ll make an effort to figure that out. If anyone sees this soon and has any helpful feedback, I’m all ears.

Sorry for reporting this newb issue, but it’s all part of the learning process for me. Have a nice day.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spyder crashes on startup and the reset command doesn't ...
On startup, it said to please use python spyder --reset. if the problem persists. However when I run this command I get the...
Read more >
Spyder crashes at launch: "python.exe has stopped working"
1. Uninstalling and reinstalling · 2. Resetting spyder (spyder --reset) · 3. deleting the .spyder2 directory · 4. changing the spyder config file,...
Read more >
spyder-ide/public - Gitter
DataFrames are not opening in Variable Explorer.Error message is ImportError(No module named managers.) +Note : Spyder was unable to retrieve the value of ......
Read more >
Common Illnesses — Spyder 5 documentation
If so, the the error is likely due to your file being named the same as a Python standard library module, such as...
Read more >
2021 How to Fix "No Module Named..." Error in Python
2021 How to Fix ImportError " No Module Named pkg_name" in Python! First, download the package using a terminal outside of python.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found