Repository: spyder-ide/spyder

Issue:
Spyder shows blank screen because of errors in QtAwesome
Running Windows 10 on a 64 Bit machine. 

**Steps:**
1. İnstall Anaconda (Anaconda3-4.2.0-Windows-x86_64.exe)
2. Launch Spyder 3.0.0 within Anaconda Navigator

_Note: At the very beginning -first time- spyder started succesfully. i could even install python modules and compiled a piece of code. After first restart of machine, problems started to occur as i mentioned below_

**Results:**
- Spyder crashes with lots of qt log in console.

- Spyder icon in Anaconda navigator also crashes.

`spyder --show-console`
```
Font is empty
Font is empty
Font is empty
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QWindowsWindow::setGeometry: Unable to set geometry 1260x1442+18+41 on QWidgetWindow/'MainWindowClassWindow'. Resulting geometry:  1260x1061+18+41 (frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 418x716, maximum size: 16777215x16777215).
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
```

It looks like a qt related thing. I searched existing issues and already tried:
`conda update qt pyqt` 
```
pyqt                      5.6.0                    py35_1
qt                        5.6.2                    vc14_0  [vc14]
```

`python` 
Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32

`ipython qtconsole` (works fine)
`python spyder --reset` 
`python spyder --new_instance` (same crash)

At last, i updated spyder to 3.0.2 but nothing changes.

I installed Anaconda (after uninstalling carefully -with anaconda clean-) at least 5 times. https://docs.continuum.io/anaconda/install

_Last edit before any comment_
_I'm able to run spyder (via anaconda) succefully on another windows 7 pc (64 bit) for a long time. The difference is: i installed theano and keras libraries on this mentioned machine after first installation and able to run codes from these libs succesfully till first shut down of machine._

Tried below solution and get spyder work at one time but without any icon in IDE:
`conda install qt=4.8.7=vc10_4` ( as mentioned here https://github.com/spyder-ide/spyder/issues/2858)

## Dependencies

```
#
_license                  1.1                      py35_1
_nb_ext_conf              0.3.0                    py35_0
alabaster                 0.7.9                    py35_0
anaconda                  4.2.0               np111py35_0
anaconda-clean            1.0.0                    py35_0
anaconda-client           1.5.1                    py35_0
anaconda-navigator        1.3.1                    py35_0
argcomplete               1.0.0                    py35_1
astroid                   1.4.7                    py35_0
astropy                   1.2.1               np111py35_0
babel                     2.3.4                    py35_0
backports                 1.0                      py35_0
beautifulsoup4            4.5.1                    py35_0
bitarray                  0.8.1                    py35_1
blaze                     0.10.1                   py35_0
bokeh                     0.12.2                   py35_0
boto                      2.42.0                   py35_0
bottleneck                1.1.0               np111py35_0
bzip2                     1.0.6                    vc14_3  [vc14]
certifi                   2016.2.28                py35_0
cffi                      1.7.0                    py35_0
chest                     0.2.3                    py35_0
click                     6.6                      py35_0
cloudpickle               0.2.1                    py35_0
clyent                    1.2.2                    py35_0
colorama                  0.3.7                    py35_0
comtypes                  1.1.2                    py35_0
conda                     4.2.13                   py35_0
conda-build               2.0.2                    py35_0
conda-env                 2.6.0                         0
configobj                 5.0.6                    py35_0
console_shortcut          0.1.1                    py35_1
contextlib2               0.5.3                    py35_0
cryptography              1.6                      py35_0
curl                      7.49.0                   vc14_0  [vc14]
cycler                    0.10.0                   py35_0
cython                    0.24.1                   py35_0
cytoolz                   0.8.0                    py35_0
dask                      0.11.0                   py35_0
datashape                 0.5.2                    py35_0
decorator                 4.0.10                   py35_0
dill                      0.2.5                    py35_0
docutils                  0.12                     py35_2
dynd-python               0.7.2                    py35_0
entrypoints               0.2.2                    py35_0
et_xmlfile                1.0.1                    py35_0
fastcache                 1.0.2                    py35_1
filelock                  2.0.6                    py35_0
flask                     0.11.1                   py35_0
flask-cors                2.1.2                    py35_0
freetype                  2.5.5                    vc14_1  [vc14]
get_terminal_size         1.0.0                    py35_0
gevent                    1.1.2                    py35_0
greenlet                  0.4.10                   py35_0
h5py                      2.6.0               np111py35_2
hdf5                      1.8.15.1                 vc14_4  [vc14]
heapdict                  1.0.0                    py35_1
icu                       57.1                     vc14_0  [vc14]
idna                      2.1                      py35_0
imagesize                 0.7.1                    py35_0
ipykernel                 4.5.0                    py35_0
ipython                   5.1.0                    py35_0
ipython_genutils          0.1.0                    py35_0
ipywidgets                5.2.2                    py35_0
itsdangerous              0.24                     py35_0
jdcal                     1.2                      py35_1
jedi                      0.9.0                    py35_1
jinja2                    2.8                      py35_1
jpeg                      8d                       vc14_2  [vc14]
jsonschema                2.5.1                    py35_0
jupyter                   1.0.0                    py35_3
jupyter_client            4.4.0                    py35_0
jupyter_console           5.0.0                    py35_0
jupyter_core              4.2.0                    py35_0
lazy-object-proxy         1.2.1                    py35_0
libdynd                   0.7.2                         0
libpng                    1.6.22                   vc14_0  [vc14]
libtiff                   4.0.6                    vc14_2  [vc14]
llvmlite                  0.13.0                   py35_0
locket                    0.2.0                    py35_1
lxml                      3.6.4                    py35_0
markupsafe                0.23                     py35_2
matplotlib                1.5.3               np111py35_0
menuinst                  1.4.1                    py35_0
mistune                   0.7.3                    py35_0
mkl                       11.3.3                        1
mkl-service               1.1.2                    py35_2
mpmath                    0.19                     py35_1
multipledispatch          0.4.8                    py35_0
nb_anacondacloud          1.2.0                    py35_0
nb_conda                  2.0.0                    py35_0
nb_conda_kernels          2.0.0                    py35_0
nbconvert                 4.2.0                    py35_0
nbformat                  4.1.0                    py35_0
nbpresent                 3.0.2                    py35_0
networkx                  1.11                     py35_0
nltk                      3.2.1                    py35_0
nose                      1.3.7                    py35_1
notebook                  4.2.3                    py35_0
numba                     0.28.1              np111py35_0
numexpr                   2.6.1               np111py35_0
numpy                     1.11.1                   py35_1
odo                       0.5.0                    py35_1
openpyxl                  2.3.2                    py35_0
openssl                   1.0.2j                   vc14_0  [vc14]
pandas                    0.18.1              np111py35_0
partd                     0.3.6                    py35_0
path.py                   8.2.1                    py35_0
pathlib2                  2.1.0                    py35_0
patsy                     0.4.1                    py35_0
pep8                      1.7.0                    py35_0
pickleshare               0.7.4                    py35_0
pillow                    3.3.1                    py35_0
pip                       8.1.2                    py35_0
pkginfo                   1.3.2                    py35_0
ply                       3.9                      py35_0
prompt_toolkit            1.0.3                    py35_0
psutil                    4.3.1                    py35_0
py                        1.4.31                   py35_0
pyasn1                    0.1.9                    py35_0
pycosat                   0.6.1                    py35_1
pycparser                 2.14                     py35_1
pycrypto                  2.6.1                    py35_4
pycurl                    7.43.0                   py35_0
pyflakes                  1.3.0                    py35_0
pygments                  2.1.3                    py35_0
pylint                    1.5.4                    py35_1
pyopenssl                 16.0.0                   py35_0
pyparsing                 2.1.4                    py35_0
pyqt                      5.6.0                    py35_1
pytables                  3.2.2               np111py35_4
pytest                    2.9.2                    py35_0
python                    3.5.2                         0
python-dateutil           2.5.3                    py35_0
pytz                      2016.6.1                 py35_0
pywin32                   220                      py35_1
pyyaml                    3.12                     py35_0
pyzmq                     15.4.0                   py35_0
qt                        5.6.2                    vc14_0  [vc14]
qtawesome                 0.3.3                    py35_0
qtconsole                 4.2.1                    py35_2
qtpy                      1.1.2                    py35_0
requests                  2.11.1                   py35_0
rope                      0.9.4                    py35_1
ruamel_yaml               0.11.14                  py35_0
scikit-image              0.12.3              np111py35_1
scikit-learn              0.17.1              np111py35_1
scipy                     0.18.1              np111py35_0
setuptools                27.2.0                   py35_1
simplegeneric             0.8.1                    py35_1
singledispatch            3.4.0.3                  py35_0
sip                       4.18                     py35_0
six                       1.10.0                   py35_0
snowballstemmer           1.2.1                    py35_0
sockjs-tornado            1.0.3                    py35_0
sphinx                    1.4.6                    py35_0
spyder                    3.0.2                    py35_0
sqlalchemy                1.0.13                   py35_0
statsmodels               0.6.1               np111py35_1
sympy                     1.0                      py35_0
tk                        8.5.18                   vc14_0  [vc14]
toolz                     0.8.0                    py35_0
tornado                   4.4.1                    py35_0
traitlets                 4.3.0                    py35_0
unicodecsv                0.14.1                   py35_0
vs2015_runtime            14.0.25123                    0
wcwidth                   0.1.7                    py35_0
werkzeug                  0.11.11                  py35_0
wheel                     0.29.0                   py35_0
widgetsnbextension        1.2.6                    py35_0
win_unicode_console       0.5                      py35_0
wrapt                     1.10.6                   py35_0
xlrd                      1.0.0                    py35_0
xlsxwriter                0.9.3                    py35_0
xlwings                   0.10.0                   py35_0
xlwt                      1.1.2                    py35_0
zlib                      1.2.8                    vc14_3  [vc14]
```



Discussion:
How did you install Theano and Keras?
_I had (and still have) some SSL issues._

I followed these guides to install tensorflow first:
- https://keras.io/#installation _(directions)_
- https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#pip-installation-on-windows _(tensorflow wheel)_
- https://www.continuum.io/downloads#windows _(Anaconda.exe)_

`conda create -n tensorflow python=3.5`
`C:\> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl` (link is updated, original was broken)

Tensorflow gave errors of missing/unfound modules (I spent quite good time to fix related issues and than gave up)
So I installed Theano successfully:
`conda config --set ssl_verify False`
`conda update openssl cryptography`
`conda install theano`

At last, Keras, successfully:
`pip install --trusted-host pypi.python.org keras --proxy=**.**.**.**`

That's the whole stroy. It looks like something has been broken in very beginning of this process. I tried to delete all configurations and packages as it has been explained in official tutorials (after all, i delete directories and hidden -.ext- files too). 
Currently i'm working on ipython console with Keras on Theano backend (installed gcc too) because the lack of time in work place.

Thanks in advance.
My Spyder also crash too. When I run it from Terminal, it's okay. But from Ubuntu launcher, it just crashes.
Ubuntu 16.10 x64
Spyder 3.0.2


@alibatuhandayioglugil, it's usually not a good idea to mix compiled packages from Anaconda and pip. Please try to install all packages with conda and try again.
@ccordoba12 , i gave up with Keras, Theano and Tensorflow for now and will try to install them later as you advised (only with conda). 

_Just a note, the only package that i installed via pip is Keras. As i know,It has no any relation with Qt packages and in the BE (Non IDE) side, over IPython console, everything (Keras+Theano) works fine. But as you said, it might broke something, that is another part that i have almost no knowledge in._

I just want to be able to install Spyder via Anaconda. That's what i tried for several times; without installing libraries mentioned above.
I am unable to install Spyder after uninstalling all the stuff (as mentioned in my first post) related to Anaconda and i need help with this. Can you tell me how to remove all and have a clean environment?
Thanks is advance. 

![spyder_crash](https://cloud.githubusercontent.com/assets/22787938/21304584/d5708fa8-c5ce-11e6-9e5b-bceae932ccd9.PNG)
My last option is formatting the disk. Any idea?
@alibatuhandayioglugil, it seems you're missing QtAwesome. Please install it with

    conda install qtawesome

and try again.
@ccordoba12 Already installed (In console logs-see previous comment-, there seems the error in _iconic_font.py_ file under qtawesome directory)

![qrawesome](https://cloud.githubusercontent.com/assets/22787938/21417499/aab43132-c823-11e6-8c6c-ce97a927c89e.PNG)

Might it be related to versions of the packages? I'm using also Qt5 (supported by windows 10)
Does it make any sense the cmd output?

```
spyder --show-console

Font is empty
Font is empty
Font is empty
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states
QPainter::end: Painter ended with 2 saved states

```

Then you have an installation problem. Please run

    conda install -f qtawesome

and try again.
Did that but unfortunately still the same error...
I'm getting the same error.  I just upgraded from windows 7 to windows 10 and did a clean install of Anaconda 4.2.0.

Even after reinstalling qtawesome as suggested, I get the same error messages
I tried to download the most recent tar.gz file for qtawesome and install it locally:

conda install --file=~\QtAwesome-0.3.3.tar.gz


This is a truncated and (slightly edited-full path has been shortened slightly) version of the error that was returned:

```
An unexpected error has occurred.

.....
Current conda install:

               platform : win-64
          conda version : 4.2.9
       conda is private : False
      conda-env version : 4.2.9
    conda-build version : 2.0.2
         python version : 3.5.2.final.0
       requests version : 2.11.1
........
Traceback (most recent call last):
      File "\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\exceptions.py", line 473, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\main.py", line 144, in _main
        exit_code = args.func(args, p)
      File "\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\install.py", line 189, in install
        specs.extend(common.specs_from_url(fpath, json=context.json))
      File "\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\common.py", line 520, in specs_from_url
        for line in open(path):
      File "\AppData\Local\Continuum\Anaconda3\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 92: character maps to <undefined>


I can also open this as a new issue in conda if necessary
```
> conda install --file=~\QtAwesome-0.3.3.tar.gz

This is not the way to install conda packages, hence the error. So please don't open a bug in conda.
This seems to be an error in QtAwesome, being unable to find FontAwesome, but I don't understand why that's happening.

@modigzd, does your username has non-ascii characters or something like a dot on it?
My username contains all ASCII characters (just letters and numbers).  The install works fine in the windows 7 environment, but I can't get it to install in any of our windows 10 environments.

Unfortunately our permissions do not allow conda to connect out of network.  We have a local PyPi mirror for using pip to install packages but anything like 'conda install ....' will timeout during the install process.


@alibatuhandayioglugil, do you also have restricted access to the Internet?
@ccordoba12 yes, this is my office environment and i have restricted access to the internet. Because of this, I'm using the proper http proxy before every package install/update operation and i haven't seen any connection/access errors. Are you suspicious of this probability?  If so in which manner and how can i track it?
It seems QtAwesome somehow needs access to the internet and it fails when it doesn't.

@dalthviz, please take a look at this one to see if you can reproduce it on Windows without internet access.
Just to be clear: i have _qtawesome_ folders under _site-packages_. I uninstalled and reinstalled them and saw the disappeared and reappeared folders. I mean, i do have internet access.
Hi @alibatuhandayioglugil I was able to recreate the last screenshot that you post:

![imagen](https://cloud.githubusercontent.com/assets/16781833/21465103/55f8249c-c962-11e6-8070-a344a183cc5e.png)

What I suspect that happens in your case is that the `.tff` files are empty or corrupt. Can you verify if the `.tff` files (`elusiveicons-webfont.ttf` and `fontawesome-webfont.ttf`) are empty in the route where `qtawesome` was install?, you can find them in `...site-packages\qtawesome\fonts`. Also, can you try to copy-paste these `.tff` files in your fonts directory from [here](https://github.com/spyder-ide/qtawesome/tree/master/qtawesome/fonts) to discard any kind of corruption?, or try these commands:
```
conda uninstall qtawesome spyder
```
```
conda clean -p
```
```
conda install qtawesome spyder
```
Probably the command to force the install for `qtawesome` (`conda install -f qtawesome`) didn't work in your case because the cache is also corrupted. For more options of the `clean` command of conda you can see [this link](http://conda.pydata.org/docs/commands/conda-clean.html).

Please try the suggestions above and tell us if any of them works for you :)
@dalthviz, great job at reproducing this one!!

We definitely need to put a guard against this error and inform users about the right fix for it. Please work on that :-)

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -280,7 +280,7 @@ def run(self):
     'pep8',
     'pylint',
     'psutil',
-    'qtawesome',
+    'qtawesome>=0.4.1',
     'qtpy>=1.1.0',
     'pickleshare',
     'pyzmq',
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -91,6 +91,9 @@
 # Avoid a bug in Qt: https://bugreports.qt.io/browse/QTBUG-46720
 from qtpy import QtWebEngineWidgets  # analysis:ignore
 
+# To catch font errors in QtAwesome
+from qtawesome.iconic_font import FontError
+
 
 #==============================================================================
 # Proper high DPI scaling is available in Qt >= 5.6.0. This attibute must
@@ -2966,6 +2969,13 @@ def main():
     mainwindow = None
     try:
         mainwindow = run_spyder(app, options, args)
+    except FontError as fontError:
+        QMessageBox.information(None, "Spyder",
+                "Spyder was unable to load the <i>Spyder 3</i> "
+                "icon theme. That's why it's going to fallback to the "
+                "theme used in Spyder 2.<br><br>"
+                "For that, please close this window and start Spyder again.")
+        CONF.set('main', 'icon_theme', 'spyder 2')
     except BaseException:
         CONF.set('main', 'crash', True)
         import traceback


Test patch:
diff --git a/continuous_integration/travis/modules_test.sh b/continuous_integration/travis/modules_test.sh
--- a/continuous_integration/travis/modules_test.sh
+++ b/continuous_integration/travis/modules_test.sh
@@ -16,7 +16,7 @@ fi
 
 # Depth 1
 for f in spyder/*.py; do
-    if [[ $f == *tests/test_* ]]; then
+    if [[ $f == *test*/test_* ]]; then
         continue
     fi
     if [[ $f == spyder/pyplot.py ]]; then
@@ -31,7 +31,7 @@ done
 
 # Depth 2
 for f in spyder/*/*.py; do
-    if [[ $f == *tests/test_* ]]; then
+    if [[ $f == *test*/test_* ]]; then
         continue
     fi
     if [[ $f == spyder/app/*.py ]]; then
@@ -62,7 +62,7 @@ done
 
 # Depth 3
 for f in spyder/*/*/*.py; do
-    if [[ $f == *tests/test_* ]]; then
+    if [[ $f == *test*/test_* ]]; then
         continue
     fi
     if [[ $f == spyder/external/*/*.py ]]; then
@@ -101,7 +101,7 @@ done
 
 # Depth 4
 for f in spyder/*/*/*/*.py; do
-    if [[ $f == *tests/test_* ]]; then
+    if [[ $f == *test*/test_* ]]; then
         continue
     fi
     python "$f"
@@ -113,6 +113,9 @@ done
 
 # Spyderplugins
 for f in spyder_*/widgets/*.py; do
+    if [[ $f == *test*/test_* ]]; then
+        continue
+    fi
     python "$f"
     if [ $? -ne 0 ]; then
         exit 1