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
Click For Summary
SUMMARY

The discussion centers on the challenges faced while attempting to run Python code from 2021 on a new Windows 11 PC using Anaconda and Spyder. The user encountered issues with Spyder failing to connect to the kernel, resulting in an infinite loop. Despite multiple installations and attempts to run Python directly, the user faced persistent errors and crashes. The final conclusion suggests that the user may need to check environment variables and ensure all necessary Python libraries are installed on the new machine.

PREREQUISITES
  • Familiarity with Python 3.x and its libraries
  • Understanding of Anaconda environment management
  • Basic knowledge of Windows command line operations
  • Experience with IDEs, specifically Spyder
NEXT STEPS
  • Check and configure environment variables for Python on Windows 11
  • Install missing Python libraries using pip or conda
  • Learn how to run Python scripts from the command line effectively
  • Explore alternative IDEs or code editors for Python development
USEFUL FOR

Python developers, data scientists, and anyone transitioning code from older systems to new environments, particularly those using Anaconda and Spyder.

Hornbein
Gold Member
Messages
3,743
Reaction score
3,027
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:
Technology 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.
 
  • 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.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
7
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
55
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K