Software Installation: Troubleshooting & Tips

Q: Pycharm is asking me if I want to set up a virtual environment; what do I do?

You don't need to do this for our course. Hit "Cancel" and follow the set-up instructions we provided instead.

Q: How do I update my version of PythonTA (or another Python library)?

A: Updating a Python library is pretty straightforward in PyCharm. To do so, first start PyCharm and then follow these instructions:

  1. Open the PyCharm settings window.
  2. Go to Project: csc110 -> Python Interpreter.
  3. In the table of packages, look for python-ta (or the name of the Python library you are trying to upgrade).
  4. Click on the python-ta row, and then press the up triangle button (▲) at the top of the table of packages to upgrade.
    Note: when you click on the button, it will take a bit of time (~30-60 seconds) to actually perform the upgrade. Please wait
    , and eventually you should see a message saying "Package python-ta successfully upgraded".

In Step 3, if you didn't find python-ta in the table, you can instead search for it by pressing the + button at the top of the table.

Q: I'm encountering an error when I try to install the required Python libraries from the Requirements.txt file.

A: First, try narrowing down the problem by manually installing each library one at a time. You can do this by following these instructions:

  1. Open the PyCharm settings window.
  2. Go to Project: csc110 -> Python Interpreter.
  3. Click on the "+" icon next to the table of packages.
  4. Search for the package you're trying to install (e.g., python-ta). Select it and click on "Install Package".
  5. Repeat step 4 for each package listed in Requirements.txt.

Once you're done, that you should be able to identify exactly which package is causing your error. Copy and paste the full error message that you see when installing the package, and contact us at cs.cmp1@utoronto.ca with this message, and we'll do our best to help you resolve the error.

 

Q: I tried to run the welcome.py but got an error.

A: The most common error is not using Python 3.12. Please check the version of Python you're using carefully.

 

Q: I have a file hello.py, but when I try to run import hello, PyCharm can't find the module.

A:  Folders with a blue icon in the Project view on the left are source folders, meaning they're automatically searched for Python modules. If your folder is not blue, you'll need to mark it as a source folder yourself.
To do this:

  1. Right-click on the folder in the Project view.
  2. Select Mark Directory As -> Sources Root.
  3. Restart PyCharm and try again.

 

Q: I have a file hello.py, but when I try to run import hello in the Python console, PyCharm can't find the module. It's in a folder that's marked as Sources Root.

A: Two possibilities:

  1. If you just marked the folder as Sources Root, you may need to restart PyCharm for this change to take effect.
  2. It could be that PyCharm isn't searching any of the "Sources Root" folders. This is likely because you haven't imported the given settings file.

 

Q: I'm getting an error message about line endings. The file looks fine, what's going on?

A: Different operating systems (Windows, macOS, Linux) use different ways to represent line endings. Since you might use a different operating system on one computer to another, or from a partner on an assignment, it's important to make sure the line endings are consistent. In this course, we'll always use Unix separators (\n). To convert your files to use Unix separators, go to File -> File Properties -> Line Separators -> LF - Unix and macOS (\n).

 

Q: My Python console is missing!

A: By default it should appear, but you can always start it by going to Run -> Python or Debug Console.

 

Q: I get an error when I try to start the Python console or run a file.

A: It's likely that your Python interpreter isn't configured properly. Check Step 3b - Linking PyCharm and Python in the software installation guide.

 

Q: I can't figure out how to run a file.

A: Yeah, this is one of the complexities of many IDEs. Open the file you want to run, then go to Run -> Run... and select the file name from the popup menu. The next time, you can press Shift + F10, which runs the most recently run module.

 

Q: How can I load my code in module hello.py into the Python console?

A: Two ways:

  1. In the Python console, type from hello import *
  2. Open your file, then right-click in the editing pane and select Run File in Python Console.

For more repeated testing, either make use of the if __name__ == '__main__' block or a separate testing file.

 

Q: When I import my file in the Python console, my most recent changes aren't used.

A: This happens when you import a file in the Python console (import myfile), then make changes to the file, and try to import it again. Your changes won't get noticed by the console, and your old version of the file will be used. Instead, you'll need to restart the Python console.