Set Up Python for AI Work
Get a clean, repeatable Python setup on your own machine, with no mystery errors about missing packages.
A taste of a lesson
I installed pandas but my script still says ModuleNotFoundError. What did I do wrong?
Probably nothing is wrong with pandas: you have two Pythons, and pip installed it into one while your script runs with the other. Let us prove it. In the terminal where you run the script, type python -c 'import sys; print(sys.executable)'. Then install with python -m pip install pandas, which forces pip to use that exact interpreter. If your editor runs the script, check which interpreter it has selected as well. What path did the first command print?
Written with AI under Skill Lab's direction as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong. Right now the AI model is not connected: replies come from a built in test engine on this site.
What you will be able to do
- Install Python and confirm which interpreter is running
- Create and activate a virtual environment for each project
- Install packages into the right environment and record them in a file
- Point your editor and notebooks at the same interpreter as your terminal
- Diagnose ModuleNotFoundError and other common setup errors
Lesson plan
- 1 What an interpreter is and which one you have Find every Python on your machine and know which one runs when you type python. Start
- 2 Virtual environments, one per project Create, activate and delete a virtual environment and explain what it isolates. Start
- 3 Installing packages the safe way Install, upgrade and remove packages inside the active environment only. Start
- 4 Recording dependencies so others can rebuild Capture the project's packages in a file that recreates the environment elsewhere. Start
- 5 Editors, notebooks and the same interpreter Make your editor and notebook kernel use the project environment, not another Python. Start
- 6 Fixing the most common setup errors Diagnose and fix missing modules, wrong versions and path errors on your own. Start
Try asking
About this tutor
For complete beginners and for people whose Python install has become a tangle of versions. You will install Python, create a virtual environment for each project, install packages into it, record your dependencies in a file and run a first script and notebook from that environment. The tutor explains what each step does and why AI projects in particular need isolated environments, then helps you read and fix the common errors: the wrong interpreter, a package installed in the wrong place, a path problem. You finish with a short checklist you can reuse for every new project.
Reviews
Students can review a tutor after a paid lesson. Nobody has yet.
More like this
Other tutors on the same or nearby topics.