Trying to install software on a new PC to run Python code I wrote in 2021

  • Context: Python 
  • Thread starter Thread starter Hornbein
  • Start date Start date
  • Tags Tags
    Python
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 3K views
Hornbein
Gold Member
Messages
4,116
Reaction score
3,275
TL;DR
Trying to install software to run Python code I wrote in 2021.
I have some Python code I wrote and ran in 2021. I'm trying to run it again. I have a computer I bought in 2024 running Windows 11.

I used to run under Anaconda. I downloaded that. Attempts to run Spyder, the Python IDE, failed. It wouldn't execute.

So I downloaded Spyder and Python. I was able run Spyder and see my code. But Spyder failed to "connect to the kernel", going into an infinite loop. An Internet search came up with all sorts of different solutions, from rebooting the computer to resetting variables in Anaconda. I tried a number of installs and uninstalls, which incurred some ominous error messages. In the end I was no worse off but Spyder still can't connect to the kernel and execute code. I tried starting Spyder in debug mode : it crashes immediately.

I attempted to execute Python directly from a file. One of those black shell windows would come up for an instant then disappear.

I'm able to start Python from a command line prompt. I don't know how to use it this way. Naturally it doesn't know where any of the files I'm trying to import are.

Any suggestions?
 
Last edited:
Physics news on Phys.org
Hornbein said:
TL;DR Summary: Trying to install software to run Python code I wrote in 2021.

I attempted to execute Python directly from a file. One of those black shell windows would come up for an instant then disappear.
Open the shell window and go to the directory where the file is and then run the command. The window will stay open and you'll be able to see the error message that it probably threw. My guess is that your previous computer had python installed in a different location than your current one and it's looking in the previous location. After that, odds may be good that you don't have one or more python libraries installed on your current machine that the program needs. Either way, the error message in the window should point you in the right direction.
 
Reply
  • Like
Likes   Reactions: berkeman, PeterDonis and FactChecker
In addition to what @Borg wrote, make sure that your environment variables are appropriately set. The Python docs at python.org go into some detail about the variables you need to set.
 
Thanks for you help guys. I've decided getting those programs to run again isn't worth it. There are better ways to illustrate my book.