Python Starting to Learn Python: Development Tools and Environments

  • Thread starter Thread starter PeroK
  • Start date Start date
  • Tags Tags
    Python Tools
AI Thread Summary
Learning Python can be initiated effectively using various IDEs and editors, with PyCharm Community Edition and Anaconda being highly recommended for beginners. Anaconda simplifies package management and deployment, making it suitable for scientific computing and data science. Users can also opt for Jupyter Notebooks for an interactive coding experience. While some prefer command-line tools and lightweight editors like Notepad++, others appreciate the debugging features and user-friendly interfaces of IDEs like Spyder and Thonny.For Windows users, familiarity with the operating system is beneficial, although IDEs can abstract some complexities. Git is widely used for source control, with platforms like GitHub and Bitbucket available for hosting repositories. Python 3 is emphasized over Python 2 due to ongoing deprecation. For GUI development, TkInter is built-in, but wxPython is recommended for more robust applications. Overall, the choice of tools depends on personal preference and specific programming goals, with many resources available for beginners to ease the learning curve.
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
2024 Award
Messages
29,192
Reaction score
20,849
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
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
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
Anaconda with Jupyter Notebooks.
 
  • Like
Likes vanhees71, scottdave, aaroman and 1 other person
Borg said:
Anaconda with Jupyter Notebooks.
What does Anaconda do?
 
PS I've downloaded Pycharm and will see how that goes.
 
  • Like
Likes vanhees71, StoneTemplePython and pbuk
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
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.
 
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
  • #14
I'm using Thonny on Unbuntu and that works pretty well, no fluff.
 
  • #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.
 
  • #36
FactChecker said:
Have you considered getting a single-board computer like Raspberry Pi?
I haven't.
 
  • #37
Mark44 said:
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/

To be honest, that's a couple of insights I have not read. Thanks for giving me that info.
 
  • #38
PeroK said:
I haven't.
I bought one back in April and it was a lot of fun, but ended up burning it out two months later. You can install python on windows just fine and use visual studio which is a great IDE.
 
  • Like
Likes FactChecker and PeroK
  • #39
Borg said:
Anaconda with Jupyter Notebooks.
This is mostly, AFAIK, for Data Science/Analytics. @PeroK : Any specific goal/focus in learning Python ? Edit: There are other more " neutral ones" like Idle ( Part of the Python theme, I guess: Idle--Eric ). I was having some conflict for a while using versions 2,3 at the same time. When you make a request to the back end server , at least from Anaconda, the system got confused on which of the servers 2,3 would handle/serve the request.
 
  • #40
WWGD said:
This is mostly, AFAIK, for Data Science/Analytics. @PeroK : Any specific goal/focus in learning Python ? Edit: There are other more " neutral ones" like Idle ( Part of the Python theme, I guess: Idle--Eric ). I was having some conflict for a while using versions 2,3 at the same time. When you make a request to the back end server , at least from Anaconda, the system got confused on which of the servers 2,3 would handle/serve the request.
I've no programming project in mind, but I wanted to be able to write some mathematical scripts to help when looking at various problems. I assumed Python would be quick and easy to get started with.
 
  • #41
That's Python's strength: you can produce functional, usable code very quickly.

Ensuring that code runs fast, on the other hand, is something of an art. Python can run fast, but sometimes doesn't. There are a lot of opportunities for bottlenecks.
 
  • #42
PeroK said:
I've no programming project in mind, but I wanted to be able to write some mathematical scripts to help when looking at various problems. I assumed Python would be quick and easy to get started with.
In that case, download python from the Windows store and an editor (Notepad++ is nice) and start coding. You will almost certainly want numpy and scipy, but their webpages have install instructions.

Worry about IDEs when you're writing large projects.
 
  • #43
Well with Anaconda you get everything in a single package (python with numpy, scipy, IDE,...) which is good enough to start and also for more advanced topics.
I agree with Ibix, that if you want GUI programming the built-in Tkinter is.. well let's just say, not appealing :)
 
  • #44
On linux and Mac python is part of the system and it can easily be broken. I would suggest looking into virtual environments. The value is that if you screw one up just delete it and start afresh. I hate IDEs. They just get in the way typically.
 
  • #45
Just to recap, we are on Windows (read the OP) and at the advice from at least two posters in this thread experienced in multiple environments have recommended FOR THIS USE CASE the Anaconda installation which comes packaged with Jupyter Notebooks and/or PyCharm which is a cut-down version of a commercial product.

Python package management in Windows is a mess, and it is far quicker to let the Anaconda or Intellij installer set this up so it works than debug a self-installation of Python and pip or conda.
 
  • #46
pbuk said:
Python package management in Windows is a mess, and it is far quicker to let the Anaconda or Intellij installer set this up so it works than debug a self-installation of Python and pip or conda.

I disagree about package management on Windows being a mess. I use git bash and python venv on Windows and it works very smoothly. I totally get a preference for other tools, but one can work very efficiently without them.
 
  • Like
Likes atyy and Paul Colby
  • #47
Locrian said:
I disagree about package management on Windows being a mess. I use git bash and python venv on Windows and it works very smoothly. I totally get a preference for other tools, but one can work very efficiently without them.
That's great, I'm glad it works for you. Have you ever tried to fix it for someone else, remotely, with an unknown environment state?
 
  • Like
Likes atyy
  • #48
(of course whilst this discussion has being continuing, the OP has just been getting on with coding in Python - good for you @PeroK)
PeroK said:
PS I've downloaded Pycharm and will see how that goes.
 
  • #49
pbuk said:
That's great, I'm glad it works for you. Have you ever tried to fix it for someone else, remotely, with an unknown environment state?

As long as Python and git bash are installed, this would just be typing three lines into the bash terminal.

There's nothing special about Python package management on Windows. Venv even uses the same syntax as Linux (the only difference being the activation script is stored in youenvfolder/Scripts instead of yourenvfolder/bin). If memory serves me, conda environment management uses the same syntax in git bash and linux as well, though I haven't needed conda for a couple of years.
 
  • Like
Likes Paul Colby
  • #50
Locrian said:
As long as Python and git bash are installed, this would just be typing three lines into the bash terminal.

There's nothing special about Python package management on Windows. Venv even uses the same syntax as Linux (the only difference being the activation script is stored in youenvfolder/Scripts instead of yourenvfolder/bin). If memory serves me, conda environment management uses the same syntax in git bash and linux as well, though I haven't needed conda for a couple of years.
The problem is that in Windows there is no such thing as "yourenvfolder".

pip or conda looks for packages in the locations that are set in the PATH (or is it Path now? was it ever case sensitive anyway?) env variable visible to the current application instance, and the only way this is going to be set right is if whatever you used to install Python put them there and there is not some other install that has overwritten them or put another version over the top or higher up the precedence or on another user or in an inaccessible Admin user or in a bespoke "Python" shortcut or somewhere else.
 

Similar threads

Replies
1
Views
7K
Replies
8
Views
2K
Replies
3
Views
1K
Replies
13
Views
3K
Replies
6
Views
2K
Replies
6
Views
2K
Replies
14
Views
5K
Back
Top