2016-05-10 12 views
5

Ich habe genau wie the official guide gesagt. iPython Notebook funktioniert nicht in Pycharm

Für mich ich nicht dieses Fenster hatte Pop-up, wenn ich Sie auf die Schaltfläche Runenter image description here

Allerdings, wenn ich die Run Schaltfläche klicken wurde es einfach nicht funktioniert und zeigte eine * in der Halterung. enter image description here

Im Terminal:

ipython notebook 
[I 21:25:20.940 NotebookApp] Serving notebooks from local directory: /Users/yangyy/GitHub/Signal&System 
[I 21:25:20.941 NotebookApp] 0 active kernels 
[I 21:25:20.941 NotebookApp] The IPython Notebook is running at: http://localhost:8888/ 
[I 21:25:20.941 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). 
[W 21:25:24.439 NotebookApp] 404 GET /api/kernels/e905abbe-caad-458e-a50b-a48b7dbcc6ab/channels?session_id=16F0F228133A41AC84E1A2A71F1064F2 (::1): Kernel does not exist: e905abbe-caad-458e-a50b-a48b7dbcc6ab 
[W 21:25:24.446 NotebookApp] 404 GET /api/kernels/e905abbe-caad-458e-a50b-a48b7dbcc6ab/channels?session_id=16F0F228133A41AC84E1A2A71F1064F2 (::1) 14.19ms referer=None 
[E 21:25:30.370 NotebookApp] Notebook JSON is not valid v3: Additional properties are not allowed (u'cells' was unexpected) 

    Failed validating u'additionalProperties' in schema: 
     {u'$schema': u'http://json-schema.org/draft-04/schema#', 
     u'additionalProperties': False, 
     u'definitions': {u'code_cell': {u'additionalProperties': False, 
             u'description': u'Notebook code cell.', 
             u'properties': {u'cell_type': {u'description': u'String identifying the type of cell.', 
                     u'enum': [u'code']}, 
                 u'collapsed': {u'description': u'Whether the cell is collapsed/expanded.', 
                     u'type': u'boolean'}, 
                 u'input': {u'$ref': u'#/definitions/misc/source'}, 
                 u'language': {u'description': u"The cell's language (always Python)", 
                     u'type': u'string'}, 
                 u'metadata': {u'additionalProperties': True, 
                     u'description': u'Cell-level metadata.', 
                     u'type': u'object'}, 
                 u'outputs': {u'description': u'Execution, display, or stream outputs.', 
                     u'items': {u'$ref': u'#/definitions/output'}, 
                     u'type': u'array'}, 
                 u'prompt_number': {u'description': u"The code cell's prompt number. Will be null if the cell has not been run.", 
                      u'minimum': 0, 
                      u'type': [u'integer', 
                         u'null']}}, 
             u'required': [u'cell_type', 
                 u'input', 
                 u'outputs', 
                 u'language'], 
             u'type': u'object'}, 
          u'display_data': {u'additionalProperties': False, 
              u'description': u'Data displayed as a result of code cell execution.', 
              u'patternProperties': {u'[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$': {u'$ref': u'#/definitions/misc/multiline_string', 
                              u'description': u'mimetype output (e.g. text/plain), represented as either an array of strings or a string.'}}, 
              u'properties': {u'html': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'javascript': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'jpeg': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'json': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'latex': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'metadata': {u'$ref': u'#/definitions/misc/output_metadata'}, 
                  u'output_type': {u'description': u'Type of cell output.', 
                      u'enum': [u'display_data']}, 
                  u'pdf': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'png': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'svg': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                  u'text': {u'$ref': u'#/definitions/misc/multiline_string'}}, 
              u'required': [u'output_type'], 
              u'type': u'object'}, 
          u'heading_cell': {u'additionalProperties': False, 
              u'description': u'Notebook heading cell.', 
              u'properties': {u'cell_type': {u'description': u'String identifying the type of cell.', 
                      u'enum': [u'heading']}, 
                  u'level': {u'description': u'Level of heading cells.', 
                     u'minimum': 1, 
                     u'type': u'integer'}, 
                  u'metadata': {u'additionalProperties': True, 
                      u'description': u'Cell-level metadata.', 
                      u'type': u'object'}, 
                  u'source': {u'$ref': u'#/definitions/misc/source'}}, 
              u'required': [u'cell_type', 
                  u'source', 
                  u'level'], 
              u'type': u'object'}, 
          u'markdown_cell': {u'additionalProperties': False, 
              u'description': u'Notebook markdown cell.', 
              u'properties': {u'cell_type': {u'description': u'String identifying the type of cell.', 
                      u'enum': [u'markdown', 
                         u'html']}, 
                  u'metadata': {u'additionalProperties': True, 
                      u'description': u'Cell-level metadata.', 
                      u'properties': {u'name': {u'$ref': u'#/definitions/misc/metadata_name'}, 
                          u'tags': {u'$ref': u'#/definitions/misc/metadata_tags'}}, 
                      u'type': u'object'}, 
                  u'source': {u'$ref': u'#/definitions/misc/source'}}, 
              u'required': [u'cell_type', 
                  u'source'], 
              u'type': u'object'}, 
          u'misc': {u'metadata_name': {u'description': u"The cell's name. If present, must be a non-empty string.", 
                 u'pattern': u'^.+$', 
                 u'type': u'string'}, 
            u'metadata_tags': {u'description': u"The cell's tags. Tags must be unique, and must not contain commas.", 
                 u'items': {u'pattern': u'^[^,]+$', 
                    u'type': u'string'}, 
                 u'type': u'array', 
                 u'uniqueItems': True}, 
            u'mimetype': {u'patternProperties': {u'^[a-zA-Z0-9\\-\\+]+/[a-zA-Z0-9\\-\\+]+': {u'$ref': u'#/definitions/misc/multiline_string', 
                                u'description': u"The cell's mimetype output (e.g. text/plain), represented as either an array of strings or a string."}}}, 
            u'multiline_string': {u'oneOf': [{u'type': u'string'}, 
                    {u'items': {u'type': u'string'}, 
                     u'type': u'array'}]}, 
            u'output_metadata': {u'additionalProperties': True, 
                 u'description': u'Cell output metadata.', 
                 u'type': u'object'}, 
            u'prompt_number': {u'description': u"The code cell's prompt number. Will be null if the cell has not been run.", 
                 u'minimum': 0, 
                 u'type': [u'integer', 
                   u'null']}, 
            u'source': {u'$ref': u'#/definitions/misc/multiline_string', 
               u'description': u'Contents of the cell, represented as an array of lines.'}}, 
          u'output': {u'oneOf': [{u'$ref': u'#/definitions/pyout'}, 
               {u'$ref': u'#/definitions/display_data'}, 
               {u'$ref': u'#/definitions/stream'}, 
               {u'$ref': u'#/definitions/pyerr'}], 
             u'type': u'object'}, 
          u'pyerr': {u'additionalProperties': False, 
            u'description': u'Output of an error that occurred during code cell execution.', 
            u'properties': {u'ename': {u'description': u'The name of the error.', 
                   u'type': u'string'}, 
                u'evalue': {u'description': u'The value, or message, of the error.', 
                   u'type': u'string'}, 
                u'output_type': {u'description': u'Type of cell output.', 
                     u'enum': [u'pyerr']}, 
                u'traceback': {u'description': u"The error's traceback, represented as an array of strings.", 
                    u'items': {u'type': u'string'}, 
                    u'type': u'array'}}, 
            u'required': [u'output_type', 
                u'ename', 
                u'evalue', 
                u'traceback'], 
            u'type': u'object'}, 
          u'pyout': {u'additionalProperties': False, 
            u'description': u'Result of executing a code cell.', 
            u'patternProperties': {u'^[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$': {u'$ref': u'#/definitions/misc/multiline_string', 
                             u'description': u'mimetype output (e.g. text/plain), represented as either an array of strings or a string.'}}, 
            u'properties': {u'html': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'javascript': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'jpeg': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'json': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'latex': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'metadata': {u'$ref': u'#/definitions/misc/output_metadata'}, 
                u'output_type': {u'description': u'Type of cell output.', 
                     u'enum': [u'pyout']}, 
                u'pdf': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'png': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'prompt_number': {u'description': u"A result's prompt number.", 
                     u'minimum': 0, 
                     u'type': [u'integer']}, 
                u'svg': {u'$ref': u'#/definitions/misc/multiline_string'}, 
                u'text': {u'$ref': u'#/definitions/misc/multiline_string'}}, 
            u'required': [u'output_type', 
                u'prompt_number'], 
            u'type': u'object'}, 
          u'raw_cell': {u'additionalProperties': False, 
             u'description': u'Notebook raw nbconvert cell.', 
             u'properties': {u'cell_type': {u'description': u'String identifying the type of cell.', 
                     u'enum': [u'raw']}, 
                 u'metadata': {u'additionalProperties': True, 
                     u'description': u'Cell-level metadata.', 
                     u'properties': {u'format': {u'description': u'Raw cell metadata format for nbconvert.', 
                            u'type': u'string'}, 
                         u'name': {u'$ref': u'#/definitions/misc/metadata_name'}, 
                         u'tags': {u'$ref': u'#/definitions/misc/metadata_tags'}}, 
                     u'type': u'object'}, 
                 u'source': {u'$ref': u'#/definitions/misc/source'}}, 
             u'required': [u'cell_type', 
                 u'source'], 
             u'type': u'object'}, 
          u'stream': {u'additionalProperties': False, 
             u'description': u'Stream output from a code cell.', 
             u'properties': {u'output_type': {u'description': u'Type of cell output.', 
                     u'enum': [u'stream']}, 
                 u'stream': {u'description': u'The stream type/destination.', 
                    u'type': u'string'}, 
                 u'text': {u'$ref': u'#/definitions/misc/multiline_string', 
                   u'description': u"The stream's text output, represented as an array of strings."}}, 
             u'required': [u'output_type', 
                u'stream', 
                u'text'], 
             u'type': u'object'}, 
          u'worksheet': {u'additionalProperties': False, 
             u'properties': {u'cells': {u'description': u'Array of cells of the current notebook.', 
                    u'items': {u'oneOf': [{u'$ref': u'#/definitions/raw_cell'}, 
                          {u'$ref': u'#/definitions/markdown_cell'}, 
                          {u'$ref': u'#/definitions/heading_cell'}, 
                          {u'$ref': u'#/definitions/code_cell'}], 
                       u'type': u'object'}, 
                    u'type': u'array'}, 
                 u'metadata': {u'description': u'metadata of the current worksheet', 
                     u'type': u'object'}}, 
             u'required': [u'cells']}}, 
     u'description': u'IPython Notebook v3.0 JSON schema.', 
     u'properties': {u'metadata': {u'additionalProperties': True, 
             u'description': u'Notebook root-level metadata.', 
             u'properties': {u'kernel_info': {u'description': u'Kernel information.', 
                     u'properties': {u'codemirror_mode': {u'description': u'The codemirror mode to use for code in this language.', 
                              u'type': u'string'}, 
                         u'language': {u'description': u'The programming language which this kernel runs.', 
                             u'type': u'string'}, 
                         u'name': {u'description': u'Name of the kernel specification.', 
                            u'type': u'string'}}, 
                     u'required': [u'name', 
                         u'language'], 
                     u'type': u'object'}, 
                 u'signature': {u'description': u'Hash of the notebook.', 
                     u'type': u'string'}}, 
             u'type': u'object'}, 
         u'nbformat': {u'description': u'Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.', 
             u'maximum': 3, 
             u'minimum': 3, 
             u'type': u'integer'}, 
         u'nbformat_minor': {u'description': u'Notebook format (minor number). Incremented for backward compatible changes to the notebook format.', 
              u'minimum': 0, 
              u'type': u'integer'}, 
         u'orig_nbformat': {u'description': u'Original notebook format (major number) before converting the notebook between versions.', 
              u'minimum': 1, 
              u'type': u'integer'}, 
         u'orig_nbformat_minor': {u'description': u'Original notebook format (minor number) before converting the notebook between versions.', 
                u'minimum': 0, 
                u'type': u'integer'}, 
         u'worksheets': {u'description': u'Array of worksheets', 
             u'items': {u'$ref': u'#/definitions/worksheet'}, 
             u'type': u'array'}}, 
     u'required': [u'metadata', 
         u'nbformat_minor', 
         u'nbformat', 
         u'worksheets'], 
     u'type': u'object'} 

    On instance: 
     {u'cells': [], 
     u'metadata': {}, 
     u'nbformat': 3, 
     u'nbformat_minor': 0, 
     u'worksheets': [{u'cells': [{u'cell_type': u'code', 
             u'execution_count': None, 
             u'input': u'%matplotlib inline', 
             u'language': u'python', 
             u'metadata': {}, 
             u'outputs': []}, 
            {u'cell_type': u'code', 
             u'execution_count': None, 
             u'input': u'', 
             u'language': u'python', 
             u'metadata': {}, 
             u'outputs': []}, 
            {u'cell_type': u'code', 
             u'execution_count': None, 
             u'input': u'', 
             u'language': u'python', 
             u'metadata': {}, 
             u'outputs': []}]}]} 
[W 21:25:30.393 NotebookApp] Notebook test.ipynb is not trusted 

In PyCharm

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /usr/local/bin/ipython notebook --no-browser --ip localhost --port 8889 
[I 21:18:54.055 NotebookApp] Serving notebooks from local directory: /Users/yangyy/GitHub/Signal&System 
[I 21:18:54.055 NotebookApp] 0 active kernels 
[I 21:18:54.055 NotebookApp] The IPython Notebook is running at: http://localhost:8889/ 
[I 21:18:54.056 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). 
[W 21:18:56.558 NotebookApp] 404 GET /api (127.0.0.1) 27.47ms referer=None 
[I 21:18:56.589 NotebookApp] Kernel started: 2ff0bf8f-4351-4423-a867-23a698f4b820 
[W 21:18:56.594 NotebookApp] 404 GET /api/kernels/2ff0bf8f-4351-4423-a867-23a698f4b820/iopub (127.0.0.1) 1.52ms referer=None 
[W 21:18:56.596 NotebookApp] 404 GET /api/kernels/2ff0bf8f-4351-4423-a867-23a698f4b820/shell (127.0.0.1) 1.16ms referer=None 
[W 21:18:56.690 NotebookApp] 404 GET /api (127.0.0.1) 2.05ms referer=None 
[I 21:18:56.703 NotebookApp] Kernel started: d1e16c68-352d-4d1a-89ed-9548a666f9ab 
[W 21:18:56.712 NotebookApp] 404 GET /api/kernels/d1e16c68-352d-4d1a-89ed-9548a666f9ab/shell (127.0.0.1) 2.61ms referer=None 
[W 21:18:56.715 NotebookApp] 404 GET /api/kernels/d1e16c68-352d-4d1a-89ed-9548a666f9ab/iopub (127.0.0.1) 1.78ms referer=None 
[I 21:20:29.566 NotebookApp] Kernel restarted: d1e16c68-352d-4d1a-89ed-9548a666f9ab 
[W 21:20:38.117 NotebookApp] 404 GET /api (127.0.0.1) 2.99ms referer=None 
[I 21:20:38.132 NotebookApp] Kernel started: 792636bb-8fda-4d26-9f4f-c92a799ef23c 
[W 21:20:38.138 NotebookApp] 404 GET /api/kernels/792636bb-8fda-4d26-9f4f-c92a799ef23c/shell (127.0.0.1) 2.28ms referer=None 
[W 21:20:38.140 NotebookApp] 404 GET /api/kernels/792636bb-8fda-4d26-9f4f-c92a799ef23c/iopub (127.0.0.1) 1.26ms referer=None 

Dinge funktionieren gut, wenn ich den Browser verwenden enter image description here

Wer in das gleiche Problem laufen gelassen?

+0

1) ist Matplotlib installiert? 2) Ist Matplotlib in Ihrem Projektpfad? 3) ist es in den Notizbüchern? 3) Erzielen Sie beim Betrieb des Notebooks dieselben Ergebnisse? –

+0

'matplotlib' ist systemweit installiert und der Interpreter des Projekts ist das System. iPython-Notebook funktioniert gut, wenn ich es im Browser verwende. Aber ich verstehe nicht ganz, was "auf dem Weg des Notebooks" bedeutet? –

+0

Ich habe festgestellt, dass es daran liegt, dass Pycharm die neue API von "IPython 4.2.0" nicht erkennt und ich nur die neueste Version IPython deinstallieren und "IPython 3.2.3" installieren muss. –

Antwort

2

fand ich, dass es ist, weil PyCharm nicht die neue api von IPython 4.2.0 erkennt und ich gerade die neueste Version IPython deinstallieren müssen und IPython 3.2.3 installieren.

Run

$ pip uninstall IPython 
$ pip install 'ipython<4' 

in Terminal und sudo verwenden, wenn die Erlaubnis verweigert.

+0

Nun, ich habe diese Lösung versucht, aber es hat nicht für mich funktioniert. Ich benutze die PyCharm Community Edition 2016.2.3. Ich benutzte IPython 5.3.0 und deinstallierte es mit 'conda remove IPython' (ich benutze anaconda2). Dann habe ich IPython 3.2.3 mit 'conda install 'ipython <4'' installiert. Versucht, das Notebook zu benutzen und nichts lief wieder. Dann habe ich 'conda install jupyter' versucht, aber es musste IPython auf die neueste Version aktualisieren. Konnte jupyter nicht installieren, ohne IPython zu aktualisieren, selbst mit der Option "--no-update-dependencies". –