You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Try Jupyter interface with the following Notebook Code.
612
+
* Start an interactive session with 4-8 cores and 1-2 hr walltime.
615
613
* `cd` into your project directory and start `Jupyter Notebook` or `JupyterLab` as described in previous sections.
616
614
* Create a new Python 3 notebook.
617
615
@@ -665,6 +663,7 @@ Jupyter Notebook is a sibling to other notebook authoring applications under the
665
663
.. admonition:: Resources
666
664
:class: dropdown
667
665
666
+
- Official Jupyter documentation: `Jupyter Documentation <https://jupyter-notebook.readthedocs.io/en/latest/notebook.html>`_
668
667
- Jupyter notebook `examples from original documentation <https://nbviewer.org/github/jupyter/notebook/tree/main/docs/source/examples/Notebook/>`_
669
668
- You can also check the lesson about `Jupyter on compute nodes <https://uppmax.github.io/R-python-julia-matlab-HPC/python/jupyter.html>`_ in our "Introduction to running R, Python and Julia in HPC workshop"
670
669
- Documentation about `Jupyter on HPC2N <https://docs.hpc2n.umu.se/tutorials/jupyter/>`_
@@ -751,53 +750,79 @@ Spyder
751
750
Features
752
751
########
753
752
754
-
When you open Spyder, you should see something like the figure below. There should be a large pane on the left for code, and two smaller panes on the right. Each of the 3 panes have their own button with 3 horizontal lines (the menu button or "burger icon") in the top right, each with additional configuration options for those panes.
753
+
When you open Spyder you will see a three-pane layout similar to other scientific IDEs: a large Editor on the left, and one or more utility panes on the right and bottom. The exact arrangement can be customised and saved as a layout.
755
754
756
755
.. admonition:: Spyder interface
757
756
:class: dropdown
758
757
759
758
.. figure:: ../img/cosmos-on-demand-spyder.png
760
759
760
+
Main panes and useful tabs
761
761
762
-
The top right pane has several useful tabs.
762
+
* Editor (left) 📝
763
+
* Edit multiple files in tabs : use the Run toolbar (green ▶️) to run the current file or selection.
764
+
* You can mark cells with ``# %%`` (or ``# %%%`` for multi level cells) and run cells interactively.
765
+
* Use the burger menu on the editor pane to split, undock or save layout.
763
766
764
-
* **Help** displays information about commands and starts up with a message instructing you on how to use it.
765
-
* **Variable explorer** shows a table of currently defined variables, their datatypes, and their current values at runtime. It updates every time you either run a script file or run a command in the IPython console.
766
-
* **Files** shows the file tree for your current working directory
767
-
* Depending on the version , there may also be a **Plots** tab for displaying and adjusting graphics produced with, e.g. Matplotlib.
767
+
* Utility pane (Top-right) 🧰
768
+
* Help 🔍: documentation and contextual help for the symbol under the cursor.
769
+
* Variable explorer 🧾 : table view of in-memory variables with types and values; inspect, edit or remove variables.
770
+
* Files 📂 : file browser for the current working directory.
771
+
* Plots 📈 : interactive plots panel (may be a tab in recent versions); can be undocked to a separate window for better interaction.
768
772
769
-
You can move any of these tabs into separate windows by clicking the menu (burger) button and selecting "Undock". This is especially helpful for the plotting tab.
773
+
* Console and History (Bottom-right) 🖥️
774
+
* IPython console(s) : interactive Python connected to the currently selected kernel/environment.
775
+
* History log : previously executed commands from the console.
770
776
771
-
The bottom right pane shows the IPython console and a history tab. The IPython console is your Python command line, and runs in your current working directory unless changed with ``os.chdir()``. The default path is whatever directory you were in when you launched Spyder, but that can be changed in Preferences. If you run a script file that you've saved to a different directory using the green arrow icon on the menu ribbon, the IPython console will switch your working directory to the one containing that script. The history tab stores the last 500 lines of code excuted in the IPython console.
777
+
.. admonition:: Quick Tips
778
+
:class: dropdown
779
+
780
+
* Run workflow
781
+
* Save your script and click the Run button to execute it in the IPython console. Running a saved file will switch the console working directory to the file's location (configurable in Preferences).
782
+
* Run selection or a cell from the editor to test snippets without running the whole file.
783
+
* Debugging
784
+
* Set breakpoints in the editor gutter and launch the debugger from the Run menu or toolbar to step through code and inspect variables.
785
+
* Plotting
786
+
* Undock the Plots tab or set the IPython console graphics backend to "Automatic" or a GUI backend in Preferences so figures open in separate windows and remain interactive.
787
+
* Multiple consoles/kernels
788
+
* You can open multiple IPython consoles and assign each a different interpreter or conda environment. This is useful for testing code against different environments.
789
+
790
+
* Notes
791
+
* Undock panels (burger menu → Undock) for a multi-monitor workflow or to resize plots independently.
792
+
* If Spyder appears too small on ThinLinc or high-DPI screens, enable "Set custom high-DPI scaling" in Preferences → General → Interface.
793
+
* Prefer launching Spyder from a graphical session (ThinLinc / On-demand desktop). Running it on a login node without a desktop may not work or be unsupported.
794
+
795
+
.. admonition:: Configuring Spyder
796
+
:class: dropdown
772
797
773
-
Most of the icons along the top menu bar under the verbal menu are running and debugging commands. You can hover over any of them to see what they do.
798
+
**Font and icon sizes.** If you are on Thinlinc and/or on a Linux machine, Spyder may be uncomfortably small the first time you open it. To fix this,
774
799
800
+
#. Click the icon shaped like a wrench (Preferences) or click "Tools" and then "Preferences". A popup should open with a menu down the left side, and the "General" menu option should already be selected (if not, select it now).
801
+
#. You should see a tab titled "Interface" that has options that mention "high-DPI scaling". Select "Set custom high-DPI scaling" and enter the factor by which you'd like the text and icons to be magnified (recommend a number from 1.5 to 2).
802
+
#. Click "Apply". If the popup in the next step doesn't appear immediately, then click "OK".
803
+
#. A pop-up will appear that says you need to restart to view the changes and asks if you want to restart now. Click "Yes" and wait. The terminal may flash some messages like ``QProcess: Destroyed while process ("/hpc2n/eb/software/Python/3.8.2-GCCcore-9.3.0/bin/python") is still running."``, but it should restart within a minute or so. Don't interrupt it or you'll have to start over.
775
804
776
-
Configuring Spyder
777
-
##################
805
+
The text and icons should be rescaled when it reopens, and should stay rescaled even if you close and reopen Spyder, as long as you're working in the same session.
778
806
779
-
**Font and icon sizes.** If you are on Thinlinc and/or on a Linux machine, Spyder may be uncomfortably small the first time you open it. To fix this,
807
+
**(Optional but recommended) Configure plots to open in separate windows.** In some versions of Spyder, there is a separate Plotting Pane that you can click and drag out of its dock so you can resize figures as needed, but if you don't see that, you will probably want to change your graphics backend. The default is usually "Inline", which is usually too small and not interactive. To change that,
780
808
781
-
#. Click the icon shaped like a wrench (Preferences) or click "Tools" and then "Preferences". A popup should open with a menu down the left side, and the "General" menu option should already be selected (if not, select it now).
782
-
#. You should see a tab titled "Interface" that has options that mention "high-DPI scaling". Select "Set custom high-DPI scaling" and enter the factor by which you'd like the text and icons to be magnified (recommend a number from 1.5 to 2).
783
-
#. Click "Apply". If the popup in the next step doesn't appear immediately, then click "OK".
784
-
#. A pop-up will appear that says you need to restart to view the changes and asks if you want to restart now. Click "Yes" and wait. The terminal may flash some messages like ``QProcess: Destroyed while process ("/hpc2n/eb/software/Python/3.8.2-GCCcore-9.3.0/bin/python") is still running."``, but it should restart within a minute or so. Don't interrupt it or you'll have to start over.
809
+
#. Click the icon shaped like a wrench (Preferences) or click "Tools" and then "Preferences" to open the Preferences popup.
810
+
#. In the menu sidebar to the left, click "IPython console". The box to the right should then have 4 tabs, of which the second from the left is "Graphics" (see figure below).
811
+
#. Click "Graphics" and find the "Graphics backend" box below. In that box, next to "Backend" there will be a dropdown menu that probably says "Inline". Click the dropdown and select "Automatic".
812
+
#. Click "Apply" and then "OK" to exit.
785
813
786
-
The text and icons should be rescaled when it reopens, and should stay rescaled even if you close and reopen Spyder, as long as you're working in the same session.
814
+
.. admonition:: Spyder interface
815
+
:class: dropdown
787
816
788
-
**(Optional but recommended) Configure plots to open in separate windows.** In some versions of Spyder, there is a separate Plotting Pane that you can click and drag out of its dock so you can resize figures as needed, but if you don't see that, you will probably want to change your graphics backend. The default is usually "Inline", which is usually too small and not interactive. To change that,
#. Click the icon shaped like a wrench (Preferences) or click "Tools" and then "Preferences" to open the Preferences popup.
791
-
#. In the menu sidebar to the left, click "IPython console". The box to the right should then have 4 tabs, of which the second from the left is "Graphics" (see figure below).
792
-
#. Click "Graphics" and find the "Graphics backend" box below. In that box, next to "Backend" there will be a dropdown menu that probably says "Inline". Click the dropdown and select "Automatic".
793
-
#. Click "Apply" and then "OK" to exit.
819
+
Now, graphics should appear in their own popup that has menu options to edit and save the content.
0 commit comments