Starting to Learn Python: Development Tools and Environments

In summary: Thanks! I'll check it out. I'm mostly just looking for a general purpose editor with decent support for Python.Eclipse is a good choice.
  • #1
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
2023 Award
26,893
18,410
TL;DR Summary
A few questions about getting started.
I finally decided to learn how to program in Python. The basic syntax seems easy enough, but I have a few questions:

There is a dizzying array of editors and IDE's out there. What is a good option to get started?

I've never programmed (or done anything technical) on Windows. Is there any general advice about using the Windows environment for programming? I don't want to get into installing Linux at this stage. Do I need to be able to find my way around the Windows O/S, or does an IDE make that unnecessary?
 
  • Like
Likes vanhees71, Ishika_96_sparkles and berkeman
Technology news on Phys.org
  • #2
Pycharm Community Edition is the absolute best coupled with an Anaconda3 distribution. Most common packages are in Anaconda or can be easily downloaded via:
Bash:
$$ conda search xxxx

$$ conda install xxxx

Pycharm is a project IDE similar to Netbeans and Eclipse but is tuned for Python.

Many folks using or learning machine learning and numerical simulation use Anaconda with Pycharm. Pycharm has a checking feature too that points out when your code violates some PEP rule which means its not how python programmers do it. As an example, I like to use ## for comments ala // in java but PEP warns me it should be # instead or when you don't have spaces separating variables from operators it will warn you. Pycharm has a formatter that will clean some of these things up.

Also you should use Python3 not Python2 as that is slowly very slowly getting deprecated. There are some real differences that can trip you up bouncing between them.

The cheap route is to go Processing IDE with its python mode although it is actually jython (python running on java) and is at python 2.7 level. In addition, there aren't nearly as many packages available for it but it can do graphics programming which is good for self study with immediate feedback.

I've used both and like both.

For example programs for all languages of interest, checkout rosettacode.org

Its especially good for comparing a known language with one you want to learn. Just be aware that examples are user contributed and may not be best practice or even solve the tasks in the same way.
 
  • Like
  • Informative
Likes vanhees71, Ishika_96_sparkles, pbuk and 2 others
  • #3
Spyder coupled with Anacondais a good IDE. I use it all the time and it has served me well. Works on both Windows and Linux.
 
  • Like
Likes vanhees71, aaroman and PeroK
  • #4
Anaconda with Jupyter Notebooks.
 
  • Like
Likes vanhees71, scottdave, aaroman and 1 other person
  • #5
Borg said:
Anaconda with Jupyter Notebooks.
What does Anaconda do?
 
  • #6
PS I've downloaded Pycharm and will see how that goes.
 
  • Like
Likes vanhees71, StoneTemplePython and pbuk
  • #7
From Wikipedia:
Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment.

I do all of my development in Jupyter which runs using the Anaconda framework. If I need to get a new python library, I open miniconda, load my new libraries and they're available in my Jupyter environment. Like any new language, it takes some time to get used to it but, once you do, it eliminates a lot of the maintainence headaches.
 
  • Like
Likes vanhees71
  • #8
Borg said:
From Wikipedia:
Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment.

I do all of my development in Jupyter which runs using the Anaconda framework. If I need to get a new python library, I open miniconda, load my new libraries and they're available in my Jupyter environment. Like any new language, it takes some time to get used to it but, once you do, it eliminates a lot of the maintainence headaches.
Thanks.
 
  • #9
Actually there are two varients to Anaconda:
- anaconda everything plus the kitchen sink
- miniconda minimal anaconda about half its size

Both use the conda command to install and manage puthon packages including their depend packages.
 
  • #10
Sorry if I missed it or misunderstood it, but does Python have a built-in GUI builder, or do you use a separate package for building GUIs? Thanks.
 
  • #11
berkeman said:
does Python have a built-in GUI builder, or do you use a separate package for building GUIs?
Yes. :smile:

It has TkInter built in, which isn't great. Install wxPython.
 
  • Informative
Likes berkeman
  • #12
Ibix said:
Install wxPython
Thanks! Also, is there a source control system that works best with Python, or do folks just use whatever they use for other source code control?
 
  • #13
The trend in python for GUIs is to use the web framework instead Using python flask

With Flask you can construct an application specific web server. This gives you the full range of html, css, and JavaScript packages for your GUI.

Another less popular approach is to use the NCurses package for a textual GUI.
 
  • Like
Likes pbuk
  • #15
Interesting, I’ve not heard of Thonny before. It’s from the Univ of Tartu in Estonia and runs on Python 3.7 across all three major OS platforms with good debugging features.

https://thonny.org/

https://en.wikipedia.org/wiki/Thonny

its reminiscent of BlueJ for learning Java from Monash Univ Good for learning and simpler than the more common IDE tools.
 
Last edited:
  • #16
  • Like
Likes Greg Bernhardt
  • #17
rbelli1 said:
https://www.python.org/downloads/release/python-2718/

The terminal release of Python 2 (2.7.18) was April 20, 2020.

BoB

True, but what's happened in the past was user pushback which gave it new life so we'll have to see. There was even a case of retrofitting some feature specifically for 3+ into 2.7 because of user pushback.
 
  • Like
Likes Greg Bernhardt
  • #18
rbelli1 said:
https://www.python.org/downloads/release/python-2718/

The terminal release of Python 2 (2.7.18) was April 20, 2020.

BoB
Unless you're working on legacy scripts
jedishrfu said:
its reminiscent of BlueJ for learning Java from Monash Univ Good for learning and simpler than the more common IDE tools.
Yeah I like it because there is no learning curve. You just write and execute. Perfect for simple scripting. Good debugging capability. Anything heavier and of course, you'll want something more professional.
 
  • Like
Likes vanhees71 and jedishrfu
  • #19
Tell me about legacy scripts, our dept groups are littered with these scripts following the notion of don't fix what's not broken to the point where we still have FORTRAN IV (not a scripting language but definitely legacy) stuff floating around.

We have a real dinosaur boneyard on site.
 
  • #20
PeroK said:
There is a dizzying array of editors and IDE's out there. What is a good option to get started?
I don't use an IDE at all. I write my Python code using either Notepad or Notepad++, save the file, and then run the interpreter from the command prompt window.

My point is that it's not necessary to install a bunch of other software just to write and run Python code.
 
  • Like
Likes vanhees71 and jack action
  • #21
I've used Spyder too, from Anaconda and from WinPython. WinPython is interesting, because you can just download it as a folder in Windows, and can be used with no additional installation steps.

You can also try Google Colab, which you can use to run programs online and is free. It can read from your Google Drive.
 
Last edited:
  • Like
Likes vanhees71
  • #22
Anaconda, simple to install, add packages and use. Don’t use it professionally but the messing about was minimal before I could code and run Python.
 
  • Like
Likes vanhees71 and pbuk
  • #23
jedishrfu said:
Pycharm Community Edition is the absolute best coupled with an Anaconda3 distribution.
Ack, I downloaded it, but that is the single most unfriendly IDE startup I've run into. Too much of a Darth Vader look for me. How can I change to a Princes Leia look?

1594775830329.png
 
  • Haha
Likes atyy
  • #24
Ah, found it under Settings. Turns out the default Appearance is "Dracula". Lordy.

1594776057228.png
 
  • Like
Likes vanhees71
  • #26
berkeman said:
Thanks! Also, is there a source control system that works best with Python, or do folks just use whatever they use for other source code control?
Everyone who has a free (as in speech) choice uses Git for everything now. Bitbucket is a good free (as in beer) online repo (GitHub is only free for public projects).
 
  • #27
berkeman said:
Ah, found it under Settings. Turns out the default Appearance is "Dracula". Lordy.

View attachment 266362

ahh that would be Darkula. Yeah these IDE tools can be daunting at first but they definitely grow on you if you persevere for a few more days. Use google to find a good intro Video on YouTube.

most programmers prefer the dark theme either because we are in the dark about what to do or we’re in that dark stage of a project where we Just want to escape to Hawaii.
 
  • Like
  • Haha
Likes vanhees71, berkeman and atyy
  • #28
I just stumbled across this free online python course offered by Harvard. I guess it might be of interest to many of you.

Using Python for Research

What you'll learn
  • Python 3 programming basics (a review)
  • Python tools (e.g., NumPy and SciPy modules) for research applications
  • How to apply Python research tools in practical settings

https://online-learning.harvard.edu/course/using-python-research
 
  • Like
Likes berkeman, vanhees71 and PeroK
  • #29
You've gotten great responses so far, and I'll see if I can add to it.

PeroK said:
There is a dizzying array of editors and IDE's out there. What is a good option to get started?

I like every suggestion so far. One thing I would say is that while it's perfectly fine to end up using Pycharm or other advanced IDE, I think there's real value in being able to work straight from the command line. I use raw Python (no Conda), vim and venv. There are a few quality of life items that my colleagues using Pycharm have that I don't, but I don't miss them, and I've seen cases where they have to ssh into a server and have no idea what to do without the additional support. Meanwhile, I'm fine.

I've never programmed (or done anything technical) on Windows. Is there any general advice about using the Windows environment for programming?

Installing git will also install git bash, which is a linux-like command line tool you run from windows. It's pretty great! I've used it for several years now, but last year I also tried installing a linux subsystem on Windows 10. That worked great too! They both have advantages and being able to switch between them is very nice.
 
  • Like
Likes jedishrfu, atyy and PeroK
  • #30
pbuk said:
Everyone who has a free (as in speech) choice uses Git for everything now. Bitbucket is a good free (as in beer) online repo (GitHub is only free for public projects).
This is outdated information. Github offers free private repositories since early 2019.
 
  • Informative
Likes pbuk and berkeman
  • #31
A lot of suggestions here and all are sensible, I think. Python has so many good tools. :-)

I probably would start with Jupyter notebooks (and anaconda). It's very interactive to program with them and they allow you to quickly explore math, plot things and dig into data. If you want to go the more traditional road of working with scripts, I recommend Spyder (or thonny which looks even more beginner-friendly but I don't have any experience with it myself). PyCharm is also a great program but I would only use it as a beginner if I was interested in getting to a professional level with bigger projects (like websites) quickly.
 
  • #32
One of the downsides I have faced when working with Spyder and the like, is that you can execute parts of the script you are writing by selecting it with the mouse and clicking on a button. It is a nice feature you don't have when using the command-line, however the variables are kept in memory. In the end when you execute the whole document, it may work only because some variables are still in memory, creating an illusion that the whole file.py is "working as expected". Then, when you execute the code from the command-line, errors are returned. I have faced this problem so many times that I feel I have to mention it.

Personally I just use Gedit + command line or neovim + command line. Spyder (with Anaconda I think) only when I am forced to use Windows on a machine that is not mine.
 
  • #33
Get around the Spyder keeping the variables in memory by clearing out the variables. Sure, the command line works, but when tracing a code one line at a time, the ability to step thru it in an IDE is completely beneficial.
 
  • Like
Likes pbuk
  • #34
Dr Transport said:
Get around the Spyder keeping the variables in memory by clearing out the variables. Sure, the command line works, but when tracing a code one line at a time, the ability to step thru it in an IDE is completely beneficial.
It's not necessary to be using an IDE with Python to get debugging capabilities. You can step through the code from the command line using the PDB debugger that comes with Python distributions. I wrote two Insights articles on how to use this tool.
https://www.physicsforums.com/insights/simple-python-debugging-pdb-part-1/
https://www.physicsforums.com/insights/simple-python-debugging-pdb-part-2/
 
  • Like
Likes berkeman, atyy, Locrian and 2 others
  • #35
PeroK said:
I finally decided to learn how to program in Python. ... I don't want to get into installing Linux at this stage. Do I need to be able to find my way around the Windows O/S, or does an IDE make that unnecessary?
Have you considered getting a single-board computer like Raspberry Pi? It will come with a full Lenix OS and there are a great many introductory tutorials and projects. They are fairly cheap and yet reasonably powerful.
 
<h2>1. What is Python and why should I learn it?</h2><p>Python is a high-level, interpreted programming language that is widely used in various fields such as web development, data science, and artificial intelligence. It is known for its simple syntax and powerful libraries, making it a popular choice for beginners and experienced programmers alike.</p><h2>2. What are some popular development tools for learning Python?</h2><p>Some popular development tools for learning Python include IDLE, PyCharm, Visual Studio Code, and Jupyter Notebook. These tools provide features such as code completion, debugging, and project management to help you write and test your Python code more efficiently.</p><h2>3. What is a virtual environment and why is it important?</h2><p>A virtual environment is a tool that allows you to create isolated environments for your Python projects. This means that you can have different versions of Python and its dependencies for different projects, without them conflicting with each other. It is important because it helps to avoid potential conflicts and ensures that your projects run smoothly.</p><h2>4. How do I set up a virtual environment for my Python project?</h2><p>To set up a virtual environment for your Python project, you can use the built-in venv module or a third-party tool such as virtualenv. First, you need to create a new directory for your project, then navigate to that directory in your terminal and run the command to create a virtual environment. Once the environment is created, you can activate it and install the necessary dependencies for your project.</p><h2>5. Can I use online platforms to learn Python and practice coding?</h2><p>Yes, there are many online platforms such as Codecademy, Coursera, and Udemy that offer courses and tutorials for learning Python. These platforms also provide coding environments where you can practice writing and running Python code without having to set up a local development environment. This can be a convenient option for beginners who are just starting to learn Python.</p>

1. What is Python and why should I learn it?

Python is a high-level, interpreted programming language that is widely used in various fields such as web development, data science, and artificial intelligence. It is known for its simple syntax and powerful libraries, making it a popular choice for beginners and experienced programmers alike.

2. What are some popular development tools for learning Python?

Some popular development tools for learning Python include IDLE, PyCharm, Visual Studio Code, and Jupyter Notebook. These tools provide features such as code completion, debugging, and project management to help you write and test your Python code more efficiently.

3. What is a virtual environment and why is it important?

A virtual environment is a tool that allows you to create isolated environments for your Python projects. This means that you can have different versions of Python and its dependencies for different projects, without them conflicting with each other. It is important because it helps to avoid potential conflicts and ensures that your projects run smoothly.

4. How do I set up a virtual environment for my Python project?

To set up a virtual environment for your Python project, you can use the built-in venv module or a third-party tool such as virtualenv. First, you need to create a new directory for your project, then navigate to that directory in your terminal and run the command to create a virtual environment. Once the environment is created, you can activate it and install the necessary dependencies for your project.

5. Can I use online platforms to learn Python and practice coding?

Yes, there are many online platforms such as Codecademy, Coursera, and Udemy that offer courses and tutorials for learning Python. These platforms also provide coding environments where you can practice writing and running Python code without having to set up a local development environment. This can be a convenient option for beginners who are just starting to learn Python.

Similar threads

  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
3
Views
255
  • Programming and Computer Science
Replies
3
Views
1K
Replies
3
Views
197
  • Programming and Computer Science
Replies
13
Views
2K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
8
Views
817
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
2
Replies
65
Views
2K
Back
Top