minibook-2nd-code icon indicating copy to clipboard operation
minibook-2nd-code copied to clipboard

[FIXED] matplotlib import error on a remote server

Open kevleininger opened this issue 9 years ago • 5 comments

There is an error in chapter 2, in the "Downloading and loading a dataset". You must run "%matplotlib inline" before you run "import matplotlibpyplot as plt"

If you don't, you get an error on the import statement.

kevleininger avatar Dec 30 '15 13:12 kevleininger

The order shouldn't matter; what is the exact error message? Also the import should be import matplotlib.pyplot as plt (there is a dot)

rossant avatar Dec 30 '15 13:12 rossant

Sorry. Typo on the missing .

I am using ubunutu in AWS and Jupyter. See the attached screen shot for the error. If I reverse the order (I found this fix posted somewhere...can't remember where) it works fine.

screen shot 2015-12-30 at 9 42 21 am

kevleininger avatar Dec 30 '15 14:12 kevleininger

Thanks! this is a bug with conda matplotlib on headless systems like AWS, and inverting the order does seem to be an easy "fix". See https://github.com/conda/conda/issues/1051. I've changed the name of the issue accordingly.

rossant avatar Dec 30 '15 16:12 rossant

For me, switching those two does not work. I have to install pyqt4 to solve the issue. See this answer on SO.

ausernametaken avatar Jan 17 '16 10:01 ausernametaken

Good to know thanks. To install pyqt4 with conda use conda install pyqt.

rossant avatar Jan 17 '16 10:01 rossant