I can NOT install Anaconda correctly on my Windows laptop

Hi - I don’t know what’s going on on your machine. But it may be that you have two versions of Python available (3.7 and 3.11), either one may be fine for the book you’re studying. Trying reading the Anaconda documentation about how to switch between different Python versions:

conda list env     # will show list of all your envs
conda activate base    # activates one of the envs by name

Looking at the first image you posted, it looks like you never started the python interpreter. After opening the anaconda prompt, did you type ‘python’ and hit enter?

1 Like

Good day, smart Alexander. Based upon your advice, I typed Python, and then hit Enter. Look at the uploaded terminial, it perfectly resembles Fig. 2.8 of the e-book which does NOT dictate so for the 1st try of opening a Python terminal. Much obliged!!!

Eureka !!!


!

Hans, the problem has been solved according to the doubt of Alexander Bessman shown above: when opening a Python terminal for the 1st time, type Python and then hit ENTER. However, I still would like to express my deep gratitude to you. Bless

2 Likes

You would probably prefer IPython: the syntax highlighting is definitely worth having. Just type ipython instead of python and change literally nothing else.

Shankar: I will give it a try. Thanks for your advice. One question: from which part of the syntax did you come up with this advice? Please forgive me for asking a stupid question like this since I am still a beginner to learn Python, I cherish every monent like this to ask an advanced Python programmer like you to learn something new. Only in this way can I master Python soon. Tell you what, I plan to master Python in 2 months and half a month has passed. I do NOT see any advice like yours shown in my e-book. So, any suggestions from you are highly appriciated. Hope to receive your answer soon.

I’m sorry, I don’t understand the question. On what basis did I judge IPython to be better than what you were doing? Frankly, I think the way you’re using it is so bad that almost anything would be.

For anything beyond, say, basic arithmetic or checking that a package was installed correctly, I wouldn’t be using Python on the terminal. You should probably be using Jupyter notebooks. (Personally, I prefer Spyder, but I gather that is considered dated.)

I don’t know what book you’re using, but if it’s elementary and doesn’t tell you to use an IDE, I’d consider that a pretty bad oversight. If it’s meant to be more advanced, then that’s reasonable to assume as a prereq, but perhaps you should start with something a bit more elementary.

I should also clarify that I’d judge myself to be an intermediate Python programmer, and not an advanced one. While I have been using Python for more than a decade, it’s been mostly for science (and some recreation), and not as, say, a professional coder.

As a side note, I think your goal of mastering Python in two months is … ambitious. Perhaps you might consider setting yourself some more modest goals as stepping stones.

More concretely, I think you’d be best served by following some YouTube courses. I don’t have in mind any in particular; any moderately popular one should be fine.

1 Like

Shankar: That’s the question: “Frankly, I think the way you’re using it is so bad that almost anything would be.” Saying what you think is the way in which I wish you would do to me because honesty saves pretty mush time. Mastering Python in 2 months is my ambition and right now I spend more than 8 hours in python coding on Jupyter Notebooks daily. The e-book that I read is “Artificial Intelligence with Python” authored by Dr. Teik Toe Teoh and Mr. Zheng Rong. One month prior to my starting to learn Python by myself, I asked more than 10 Python experts which e-book was the best one that they would suggest. All of them advised me to choose this one, and now I understand why they made this recommendation. I enjoy pretty much coding python programs after having read its instructions every day even on weekends. This e-book stimulates my passion, passion, and passion.

It seems my suggestion was either a few days out of date or based on an entirely false impression: if you’re already using Jupyter notebooks, and the book is paced so well that you, starting from scratch, can do eight hours a day (!) without getting stuck, I don’t think I have any advice to give.
From the posts earlier in the thread, I thought you might have been running snippets of code from the prompt, and that was what I felt I could improve.

Before you told me the command “IPYTHON”, I never knew it which gives me a valuable chance to explore what it is, and what the difference between “python” and “ipython” will be. It’s like a treasure hunt. That’s something that I wouldn’t learn from the e-book, and sth that I cherish. Both authors probably don’t know this command, I hazard. That’s why this forum is so valuable for Python programmers.

I guarantee you they know it: it’s not an obscure command. They don’t mention it because it’s not useful if you’re already using an IDE or Jupyter Notebook (as you should be!).

No matter what the reality is, I stiil thank you for teaching me sth that I could NOT have learned from the authors.

Morning Shankar:
2 days ago, I wrote a program to show a circular pi chart by imitating the demo example of my e-book. The currect circular pi chart showed up after my 2nd try. However, What suprised me is the body of the program written by the author. The top image shows the program dictated by the author, and the bottom image is the one written by myself. Three obvious differeces:(1) URL, the URL of the author is kernal (2) The author’s program does NOT need the first 3 standard lines (3) In line 5, the author dictates N. mine N, because line 5 is an expression that’s why N must be followed by comma NOT dot . This problem lingers in my mind for 2 days and I stiil can NOT find a reasonable explanation. My only suspision is the word “kernal” shown at the URL which allows the author to successfully draw the chart. Can you give me a correct explanation? Thanks.

  1. The url has nothing do with it. Jupyter supports a lot of languages, and I’m guessing that’s there to ensure that python3 is used if python2 is also installed.
  2. The author’s program does need those import lines. They’re not shown because it’s assumed that you know they’re necessary by now.
  3. That is a comma, not a period.

To elaborate on 2., there is actually a rather annoying thing about Jupyter notebooks: they’re mutable, and have a hidden state. You can, for example, execute a cell and then delete it, and it will continue to have an effect, making it so that running the notebook from scratch might give you different results. So you have to remember what code has been executed: it’s not necessarily the same as the code you see.

Thanks for your swift reply, however, have you also noticed something very important? Except the differences of " None of the top 3 lines, and N." the additional program codes of the author and mine are all the same, but the chart’s details are very different. How could this happen? That’s something which I can NOT fathom either. Your opinions?

Yes, I noticed that too, and that is important. I don’t know this, but my guess is that you’re using a more recent matplotlib version, and they changed the defaults. (I think the newer version looks significantly better.)

Look carefully at the code—what determines the radiai and width of the chart segments? Are they fixed/hardcoded, or perhaps generated…(pseudo)-randomly? Also, try re-running the code again from scratch—do you see the same result as before? That will answer your question as to why they look different for you than the author…

I wouldn’t call Spyder dated (though of course I’m one of its developers); it is still very actively developed and we’re on pace to have released three major versions in about four or so years, and most if not close to all of the main user-facing features of Jupyter/JuptyerLab and a good deal more (aside from HTML plots and visualizations, which we’re working on), works with IPython consoles and Jupyter kernels and frontends natively (in fact, we help develop/maintain some of the frontend and backend infra) and can work with Jupyter notebooks directly via the first-party Spyder-Notebook plugin.

Jupyter can be a useful tool for learning, experimentation and reporting/documenting results, but once you’re ready to move on to reproducible and re-usable research, Spyder fills an important gap that the notebook ecosystem, despite tens of millions and thousands of hours of investment, just isn’t that well suited for (including for some of the reasons you mention).

Yup, those are but a few of the caveats of relying on notebooks; many of them can be mitigated by a solid understanding of what’s going on behind the scenes and the pitfalls to avoid, and following good development practices with care and attention, but especially by the time you get to that that point you’re likely to really start feeling its more advanced limitations anyway that real IDEs like Spyder address (while in Spyder’s case also striving to be simple and accessable to new, non-expert scientific users). Joel Grus has a great and hilarious presentation (at JupyterCon, no less) highlighting all of these gremlins…

1 Like

Look carefully at the code—what determines the radiai and width of the chart segments? Are they fixed/hardcoded,

Yes, of course, but I think I see the style as being different too, with the new version having lighter colors, no dark edge around the sectors, and better grid “lines” (smooth gray instead of dotted black). Or am I just imagining it, possibly because of the higher resolution image?

I wouldn’t call Spyder dated (though of course I’m one of its developers)

Perhaps “dated” connotes more pejorative than I intend. Traditional? Staid? As I said, I strongly prefer it over Jupyter (and am thrilled to hear about plans for HTML plots!).

EDIT: With Spyder-Notebook, it’s not even a Spyder vs. Jupyter thing, but rather just scripts vs notebooks. I prefer the former, but the latter seem to me to be more in vogue, at least among my colleagues. O tempora, o mores.

I believe Julia’s Pluto solves a lot of those problems with Jupyter notebooks, and something like that for Python might be the best of both worlds.

I’d assumed that, given the OP was a rank beginner that had reproduced someone else’s code and was still in the process of understanding the basics of its operation, their statement that “the charts details are very different” was intended to refer to the actual content of the figure, but your interpretation could also be the case.

Looking carefully, the differences seem to my eye to mostly be ascribable to differences in the figure “DPI” setting and rendered resolution and color correction/calibration of the respective plots and the respective screenshots of them, given the multiple layers of processing (particularly with the book image) involved, possibly along with minor differences in Matplotlib’s presentation between versions, though it does look to me like there is a thin <=1 px black or dark gray stroke around the radial segments in the original.

Yeah, for sure, and better yet not just scripts but actual Python modules (which can be of course be fairly seamless to transition into if using real Python code files rather than bespoke notebooks). The thing with Spyder is its relatively easy to use any of the three and you can transition between them, whereas with the Jupyter walled garden you are locked into notebooks only unless you completely switch applications/environments.