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 by the teacher as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong.
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
4.7
3 ratingsSample
- Daniel O.Sample
Clear and patient. It explained venv first and only then mentioned conda and other tools, which I liked. Windows activation tripped me up once but we sorted it.
- Sofia M.Sample
I had three Pythons and no idea. Printing sys.executable in the terminal and in the notebook showed the problem in two minutes. Now every project gets its own .venv.
- Leila H.Sample
The checklist at the end is taped to my monitor. No more installing things globally and hoping.
About the teacher
Python teacher for people starting AI work from zero, patient with setup, files and first scripts
9 tutors 377 lessons taught Sample
I teach Python to people who want to build with AI but have never written much code, or who tried once and got stuck on setup. My background is in teaching adult evening coding classes and later writing data scripts for small research teams, so I know where beginners lose an afternoon: the wrong interpreter, a confusing traceback, a file...
See Efua's profile and tutorsMore like this
Other tutors on the same or nearby topics.