Full Python Environment Setup for AI (or other) Apps + Virtual Environments
In this video, we'll walk you through setting up a powerful Python development environment, complete with virtual environments, the Pyenv Python version manager, Git, and a handy notebook on Google Colab. Whether you're a beginner or looking to advance your Python skills, this tutorial has got you covered.
----------------------
LINKS:
👉 Article with the code: alejandro-ao.com/setup-python...
💬 Join the Discord Help Server - link.alejandro-ao.com/HrFKZn
❤️ Buy me a coffee... or a beer (thanks): link.alejandro-ao.com/l83gNq
✉️ Join the mail list: link.alejandro-ao.com/AIIguB
----------------------
Python is an incredibly versatile language used extensively in machine learning, and our course will help you master its fundamentals while exploring advanced concepts and real-world projects. We'll start by explaining the importance of Python virtual environments and their role in isolating project dependencies, ensuring smooth and conflict-free development.
With our step-by-step instructions, you'll learn how to set up Python virtual environments in popular editors like Visual Studio Code (VSCode), enabling you to manage multiple projects effortlessly. We'll cover the best practices for creating and activating virtual environments, ensuring optimal efficiency in your Python workflow.
Next, we'll introduce you to Pyenv, a powerful Python version manager that allows you to install, switch, and manage different Python versions seamlessly. We'll guide you through the installation process on macOS using Homebrew, ensuring a hassle-free setup for your development environment.
But that's not all! Git, a widely-used version control system, is essential for collaboration and project management. We'll demonstrate how to integrate Git into your Python projects, enabling you to track changes, manage branches, and collaborate with ease.
Lastly, we'll showcase the power of Google Colab, a cloud-based Jupyter Notebook environment. You'll learn how to leverage its features for Python development, including seamless integration with popular machine-learning libraries and the ability to share your notebooks effortlessly.
Whether you're a beginner or an advanced Python enthusiast, this tutorial will equip you with the skills and tools necessary to take your Python projects to the next level. Join us now and unlock the full potential of Python development!
---------------------------------------------------------------
⏰ TIMESTAMPS
0:00 Intro
1:06 Homebrew
3:33 System Python
7:18 What is a Python Version Manager?
10:26 Install Pyenv
13:20 Install multiple Python versions
16:26 Change the Global version of Python
19:30 Why you need a Python Virtual Environment
23:18 Local Python for Each Project
26:45 Create a Python Virtual Environment
28:20 Activate your Virtual Environment
30:56 Initialize a Git Repository
35:42 .ENV for Environment Variables
40:48 Notebooks
43:59 Outro
#Python #machinelearning #artificialintelligence #softwareengineer
Пікірлер: 98
💬 Join the Discord Help Server: link.alejandro-ao.com/981ypA ❤ Buy me a coffee (thanks): link.alejandro-ao.com/YR8Fkw ✉ Join the mail list: link.alejandro-ao.com/o6TJUl
I just wanted to say that you are one of the best teachers I've ever seen! Your explanations flow flawlessly and I truly appreciate how well you communicate complex ideas. Thank you for being such a great teacher!
@alejandro_ao
Жыл бұрын
hey there, i really appreciate that you find these videos useful! it makes my day to read things like this. I'll be going back to weekly videos in a couple of weeks (after my exams)! clear skies
@rospy02
10 ай бұрын
I second this post! I know other languages, but I’ve been struggling to learn python and every video i watch if yours is 1000x better than anyone else I’ve seen. You give step-by-step directions, but you also take the time to explain WHY and also what pitfalls to be aware of. Thank you for making the effort in these videos. It is appreciated!
@xt3708
10 ай бұрын
agreed, you’re awesome 🎉
Wow, I wish I had seen this video six months ago. It would have saved me so many hours and headaches aches learning this stuff through trial and error. A great refresher now.
I picked up python back after abandoning it for a year and was following your latest tutorials, this is exactly what I've been thinking about, thanks man!!
I agree, you are indeed the best instructor I've seen! Fantastic, you are calm, thorough and clear you don't rush through the topics. by far the best and most "giving" videos I've seen. I walk away understanding stuff I did not understand before, but had tried to use without fully understanding. thumbs up! just wish I had seen this before I polluted and messed up my setup🙂
Thanks for such a great video. Never found such straightforward and easy to follow videos for beginners until i found your channel. Keep up the great work!
Very well done, great explanation, well structured, detailed enough, overall easy to understand, thanks!
I studied I.T yeeaars ago but had to drop out 1 year in cause I just didn't have the money for it. As time went on I sorta forgot the love I have for tech since I was trying to you know, make a living. Your videos honestly resparked my love for the field and you're just amazing. Best teacher I've ever had❤️👍🏾
Thank you for reading and responding to our questions and comments. you have a remarkably good teaching style.
@alejandro_ao
Жыл бұрын
hey there Randy! thank you, i really appreciate what you say! it's my pleasure 💪
You man are a genius, i've not programmed in years but you have inspired me to learn and i am improving!!! I would love a tutorial on servers and hosting your own as i would like to make one for my business to host a database and query data (maybe even link to some shopify api's)
hey brother just getting into coding and your is one of the more really understandable easy to follow vary well explained and in depth for someone like myself that needs to know what to do but are importantly why so i can retain the memory better and be able to execute it on a different project again next time, that you!!!!!
Amazing job! Thank you so much!
I PAID FOR KZread PREMIUM JUST TO BE ABLE TO WATCH YOUR AMAZING VIDEOS UNINTERUPTED! MUCH LOVE FROM NEW ORELANS - YOUR BIGGEST FAN AND STUDENT!
@alejandro_ao
Жыл бұрын
you’re a legend mate, keep building 🔥
Love your videos! These genuinely make me love learning coding and development; thank you so much!
@alejandro_ao
11 ай бұрын
this makes me very happy
Your voice is so calming, just what people need when setting up. Thank you soooo much!
@alejandro_ao
5 ай бұрын
i will start doing asmr 🤓
@elenajiang9291
5 ай бұрын
@@alejandro_ao Haha, oh pls do, then you are making this world a better place ;)
Thank you for this video very much needed! One little tip I run into: I was not able to change local nor global python. The only thing I needed to understand was that on my terminal, (for some reasons unknown to me) I have a regular python program by default, and another one as python3. All your commands work perfectly using python3 instead of python.
It is a perfect tutorial both for beginners and more experimented users. You tackle all the angles and always have a thought for special cases. Well done 👏
@alejandro_ao
Жыл бұрын
thank you!! i’m very glad i this was helpful :) expect more videos like this :)
@alejandro_ao
Жыл бұрын
attends c’est toi vincent ? hah merci mec !!
@vincentfernandez7145
Жыл бұрын
@@alejandro_ao Haha oui, c'est bien moi. C'est une très bonne vidéo et il me tarde de voir les prochaines !
As ronan4681 mentioned , organization and structure is a skill that even veteran programmers feel benefited from, and one that novice programmers dream of learning right from the start. I am always looking for AI teaching bloggers who have the logic and structure that can make the path to learning the latest AI technologies with fewer detours right from the start, and you are one such treasure of a teacher. Thank you for your contribution!
@alejandro_ao
Жыл бұрын
i appreciate it! and yes, just like in maths, rigour and organization is just as important as creativity and logic
I keep coming back to this every few weeks when I need to do something in python LOL thanks! timestamp for personal reference: 23:21
@alejandro_ao
3 ай бұрын
this makes me happy
Wow please more videos like this!!
Excellent. saved me a great tonne of time👌
thank you so much brother, i am very grateful to you
Your channel is amazing brother Im so thankful I discovered it !! Subscribed You are amazing :)
Just the video i was hoping someone would make. I have been programming since 1980 and I am a very good at what i do, but I lack organisation and structure skills.... so, for most my life I have been constantly rebuilding my development pc from project to project. In the modern era I push out a vm for every new project.
@alejandro_ao
Жыл бұрын
i'm happy to hear that! this is definitely a less sexy video than the others in the playlist, but i hope it will be useful for those who were having trouble starting up a dev environment
very useful thanks!
Hola Alejandro, está muy bueno el video. Todo en tu canal es un diez! Gracias capo!
@alejandro_ao
15 күн бұрын
gracias!! :)
Amazing Video. You are really a great teacher!
@alejandro_ao
6 ай бұрын
Thank you! 😃
Thank you!
@alejandro_ao
Жыл бұрын
no worries :) let me know if you have any suggestions on this setup!
You are a blessing from God! Bro you need to set up a discord for your fans and supporters though, so we can collaborate and hang out!
@alejandro_ao
Жыл бұрын
i bless you, amen 🙏🤓 and yeah! i'm thinking of setting that up at around 10k subs so that we don't end up being like 3 people in the server hehe
Hi, thanks for this video. One thing I'm missing is the use of "requirements.txt" in this introduction. Especially when using tensorflow I realized that it is very important to stick to specific versions and also a python version. So after installing all libs with "pip install"... I recommend to add a "pip freeze > requirements.txt" This way you can reproduce the results all the time. And of courde after cloning a git repo you need a "pip install -r requirements.txt" in order to have the same libs as in the examples
You are great!!
@alejandro_ao
Жыл бұрын
you are
thank you 🙏🏆
@alejandro_ao
Жыл бұрын
thank *you* 😎
Thanks!
@alejandro_ao
Жыл бұрын
thank you! i'll be putting up more videos in a couple of weeks, after my exams!
Right on time
@alejandro_ao
Жыл бұрын
thanks! let me know if you have any suggestions!
Thanks
@alejandro_ao
6 ай бұрын
thanks again. there's much more coming this year!
Hello. At minute 32 with 45, did you forget to activate the 'env' environment again? Although you activate it later, it seems that, at minute 38 with 35, the virtual environment is deactivated again. Great job. Blessings.
Thanks for the video, very helpful. I use Mac Ventura and installed Python version 3.9 & 3.11. But when I try pyenv versions I get only 3.9 and does not show up 3.11. Other problem I encounter is Pip install does not work and get zsh: command not found: pip. I tried various option but still no luck. Do you have any suggestion to fix my pip install issue? Thanks
My homebrew installs as Python3. So when I use the pyenv to change the version, it shows the right version of python when I use the command "pyenv versions" but when I use python3 --version its showing the systems version of python?
how to make a chatbot using langchain for multiple pdf file to generate mcq question with similar ansewers.
At 38:30, you pressed the RUN button. Was it call the python which installed by Visual code or it ran the python using "pyenv local"? Thanks!
Do you have a video for making a chatbot with a local model. No openai api or huggingfaceapi. Completely local?
When teaching computer stuff it helps a ton to actually demonstrate. Just because you already have it installed on your computer doesn't help us. We need to see what to click. The truth is I couldn't get homebrew installed and couldn't continue to install the Python Version Manager. Sorry to be critical but I'm sure I wasn't the first person in the 18,463 viewers before me that ran into this issue.
@alejandro_ao
6 ай бұрын
I'm sorry to hear that man. homebrew is made for mac. If you are using a mac, open your terminal and paste the code that they give you on this page: brew.sh/ After running it, you will have to restart your terminal or open a new terminal window. Let me know if you have any questions!
another great video Alejandro. Inspired me to finally get around to doing this. question. I see that pyenv also support virtual environments via pyenv virtualenv. you can configure the project directory to auto activate whenever you cd into that directory. Any reason why you are using the standard venv technique for activation?
@alejandro_ao
Жыл бұрын
hey there! i'm glad this was useful! indeed, pyenv also supports virtual environments and in some cases they may even be more straightforward! i am just used to using standard venv from python. but it's more of a personal choice. you can choose to use whichever suits you best 💪
I really like the idea and the approach with the pyenv. But I still have a question, whats the difference between this approach and using conda to set up an environment ?
@alejandro_ao
Жыл бұрын
hey there, conda is another package manager for python, just like pip. and it also supports virtual environments. you can do the same thing that we did here using conda. the important thing is that your packages are contained in a virtual environment to make dependency management easier. but you can use whichever tool you want for this. geeksforgeeks has a good article on how to set up anaconda: www.geeksforgeeks.org/set-up-virtual-environment-for-python-using-anaconda/
I ran python --version zsh: command not found: python What can I do? Thanks!
Can you make a windows version of this? I've been struggling so much connecting my VS code with python. Sometimes some libraries would work and sometimes it wouldn't. I've been asking on ChatGPT, Perplexity, & Bing etc... but at this point I don't know what to do. I even uninstalled both Python and Vs code then downloaded again but still somehow doesn't work. Same error
@DANNYEL20122
10 ай бұрын
This is very important please 😭😭. I'm using pycharm by the way.
Hey Alejandro, I was wondering how do you install Homebrew for windows?
@alejandro_ao
Жыл бұрын
hey there, no need for homebrew in windows. you can use other package managers on windows if you want or just use regular installers. homebrew is specially useful on mac because it makes your computer work pretty much like linux. if you are on windows, i’d recommend you install wsl (windows subsystem for linux) in order to get a similar experience 💪🏼
At 30:30 minutes (Activate your virtual environment), for Windows Power Shell: ./venv/Scripts/activate
Please do i need a graphics card?
What about for windows?
🥰🥰🥰
I ve been following step by step to set up a virtual environment with pyenv, but in Windows, using the pyenv-win version. I actually went quite smooth until running activate and deactivate bats. Anyone had the same issues? I mean when I run "venv/sripts/activate" I get the prompt preceeded by "(venv)". But python still comes from pyenv, outside my project folder copy, as it shows doing "pyenv which python"... hope someone can help me. Great video BTW! (Spanish, French or English help is appreciated ;) )
@raduirava
Жыл бұрын
hey Raul. after a lot of debugging, my assumption is that "pyenv which python" is not actually the equivalent of "which python" on Mac, it just always returns the pyenv python path. instead, you should be using "where.exe python" and take the first path in the list. hope this helps!
I will really like a windows version of this please 😭😭
(Windows + wsl + conda + vs )is best combo
@alejandro_ao
10 ай бұрын
i’ve been using this at work (only windows there) and it works like wonders
so this is only for MacBook users
First...
@alejandro_ao
Жыл бұрын
😎
Being forced to use homebrew is so annoying
Thanks for sharing, exactly what I need
@alejandro_ao
Жыл бұрын
i’m glad to hear that :)
bro vomit a little when he said "When you are running windows" 30:18
Thank you i was so ignorant. Why not integrate the creation of the venv directly in the main code? Like this: "venv.create(args.env_dir, with_pip=True)"
python3 --version Python 3.11.3 shivanshugupta@Shivanshus-MacBook-Air python-proj % pyenv versions system 3.8.16 3.9.16 * 3.10.11 (set by /Users/shivanshugupta/.pyenv/version) 3.11.3 shivanshugupta@Shivanshus-MacBook-Air python-proj % python3 --version Python 3.11.3 shivanshugupta@Shivanshus-MacBook-Air python-proj % pyenv local 3.9.16 shivanshugupta@Shivanshus-MacBook-Air python-proj % python3 --version Python 3.11.3 shivanshugupta@Shivanshus-MacBook-Air python-proj % No matter what I do ...python version only shows 3.11
@alejandro_ao
Жыл бұрын
hey there, you have to use `python`, not `python3` when using pyenv 👍
@ken5hin
Жыл бұрын
@@alejandro_ao I have a similar issue reez@Reezs-MacBook-Pro ~ % pyenv global 3.9 reez@Reezs-MacBook-Pro ~ % pyenv versions system * 3.9.17 (set by /Users/reez/.pyenv/version) 3.10.12 reez@Reezs-MacBook-Pro ~ % python3 --version Python 3.11.3 reez@Reezs-MacBook-Pro ~ % which python3 /opt/homebrew/bin/python3 reez@Reezs-MacBook-Pro ~ % python --version zsh: command not found: python reez@Reezs-MacBook-Pro ~ % Tried using 'python' but terminal says command not found. Any idea how to fix this? Great videos btw 🙌
@JaredTracy
9 ай бұрын
@@ken5hinI encountered a similar issue on an M2 MBP running Sonoma (which doesn't come with Python installed by default). If you run eval "$(pyenv init --path)", it should solve the python command not being found issue. If it doesn't there's some other issue. If that eval cmd works, then you can add a symlink to have a permanent ability to use "python" since the eval will only work on the current terminal session. Hope that helps.