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

Discussion Overview

The discussion revolves around the challenges of running Python code originally written in 2021 on a new PC with Windows 11. Participants explore issues related to software installation, execution errors, and environment configuration.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant reports difficulties in running Spyder and connecting to the kernel after installing Anaconda and Python on a new computer.
  • Another participant suggests executing Python directly from the command line to capture error messages, hypothesizing that the new installation may be looking for libraries in a different location than the previous setup.
  • A third participant emphasizes the importance of setting environment variables correctly, referencing the Python documentation for guidance.
  • A later reply indicates a decision to abandon efforts to run the original programs, suggesting alternative methods for illustrating concepts in a book.

Areas of Agreement / Disagreement

Participants express various suggestions and hypotheses regarding the issues faced, but there is no consensus on a definitive solution to the problems encountered.

Contextual Notes

Limitations include potential missing dependencies, unresolved environment variable configurations, and the specific nature of the error messages that were not fully explored.

Hornbein
Gold Member
Messages
3,791
Reaction score
3,061
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
3K
Replies
55
Views
7K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
1
Views
6K