How to Troubleshoot Python Software in Anaconda Distribution

Below is a question that was recently asked on StackOverflow and I decided it would be helpful to publish an answer explaining the various ways in which to troubleshoot a problem you may be having in Anaconda.

The Question

I’m trying to use Anaconda Distribution to run some Python software, but I just get an error message when I try to start Jupyter, Spyder, or R Studio. Something like the following:

The error text is:

 Traceback (most recent call last): File "/Users/ijstokes/anaconda/envs/spyder/lib/python3.6/site-packages/qtpy/", line 148, in from PySide import __version__ as PYSIDE_VERSION # analysis:ignore ModuleNotFoundError: No module named 'PySide' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/ijstokes/anaconda/envs/spyder/bin/spyder", line 6, in sys.exit( File "/Users/ijstokes/anaconda/envs/spyder/lib/python3.6/site-packages/spyder/app/", line 103, in main from import mainwindow File "/Users/ijstokes/anaconda/envs/spyder/lib/python3.6/site-packages/spyder/app/", line 49, in requirements.check_qt() File "/Users/ijstokes/anaconda/envs/spyder/lib/python3.6/site-packages/spyder/", line 39, in check_qt import qtpy File "/Users/ijstokes/anaconda/envs/spyder/lib/python3.6/site-packages/qtpy/", line 154, in raise PythonQtError('No Qt bindings could be found') qtpy.PythonQtError: No Qt bindings could be found 

What can I do to fix this?

The Answer

This can be frustrating and there are a few steps you can take to try and resolve it. Usually, it is because of a broken software version and less frequently due to conflicting software or libraries on your system.

Update the Package (GUI)

Try to update Spyder (or Jupyter) in Navigator.

  1. Select “Environments”
  2. Search for “Spyder”
  3. If an update is possible it will show a blue arrow, click on this; if you have the latest version it will be a green checkbox
  4. This green checkbox will turn into a blue arrow
  5. Click on the “Apply” button at the bottom right
  6. Try again!

Create a Test Environment

If that doesn’t resolve the problem try creating a minimal test environment:

  1. Select “Environments”
  2. Click on “+ Create”
  3. Give your test environment a name, such as “mytest”
  4. Decide which version of Python or R it should be based on
  5. Click on the “Create” button at the bottom right of the dialog box

When the environment creation is complete, select the environment and install the package you’re having trouble with:

  1. Select “Environments”
  2. Select “mytest,” the environment you just created
  3. Select “All” for the search scope
  4. Search for “Spyder”
  5. Click the box beside the package name to select it for installation
  6. Click on the “Apply” button at the bottom right
  7. Try again!

If it now works, then you’ve established that the problem is with some mix-up in the main environment you’re using. To resolve that, you’ll need to refer to the command line “force update” strategy described below.

Alternatively you can create a fresh environment using the strategy above, but include in it the “anaconda” package so you’ll have a full featured set of tools.

Try From the Command Line

Sometimes, you get more details regarding what’s going wrong if you run the program from the command line. You can get to the command line as follows:

  1. Select “Environments”
  2. Select the environment you are trying to use (if in doubt, use root or base, which are the defaults)
  3. Select the triangle/arrow
  4. Select “Open Terminal”

Now from the command line you should try doing:

<pre class=”language-python”><code>conda update conda conda update anaconda-navigator conda update spyder </code></pre>

This will update the Spyder package (execute conda update jupyter if you want to update Jupyter Notebook)

Now try to run Spyder by executing this command:

<pre class=”language-python”><code>spyder</code></pre>

If it doesn’t work, you should have more useful information as to the cause of the problem (the command for Jupyter Notebook is jupyter notebook, with a space between the two parts).

But Even Anaconda Navigator Isn’t Working

If you can’t successfully start Anaconda Navigator, then you should get to the command line ( in macOS, Start->cmd.exe on Windows), then navigate to where Anaconda Distribution is installed (often in /Anaconda, $HOME/Anaconda or /opt/anaconda). From there, go to the Scripts directory (Windows) or the bin directory (macOS, Linux). Now, execute the three conda commands above (for macOS and Linux users you may need to use ./conda instead of just conda). Once you’ve done that, try launching Anaconda Navigator with the command anaconda-navigator.

Force a Package Reinstall

Sometimes the software package, even if it’s up to date, can be corrupted. This can happen if you’ve blended pip install spyder or similar commands that have changed the conda package software. To try and fix that, you can do a force reinstall as follows:

conda install --force spyder 

If it appears there are problems with any of the dependencies, then you can try and force install those.

Talk to an Expert

Talk to one of our financial services and banking industry experts to find solutions for your AI journey.

Talk to an Expert