Installing and managing Python packages in PyCharm | Getting started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in the previous two videos we set up a python interpreter for our project but sometimes our project depends on python packages and getting those set up can be tricky any chance the ide can help well let's take a look [Applause] [Music] hi i'm paul everett jet brains developer advocate and welcome to our pycharm getting started video series this video series really helps you get started with pycharm but our data shows 80 percent of you won't hear about new videos because you haven't clicked the subscribe button we still have half the series to go click the button so you won't miss it whether you are an experienced python developer or a newbie one thing i can say you're going to be installing and using python packages in your workflow pycharm has a dedicated tool window to help you install upgrade and uninstall python packages for a particular python interpreter let's see how it works [Music] in 2021 pycharm added a new packages tool window to help see python packages that are in your interpreter as well as manage them let's see it in action i'll start with an open flask project generated from the new project wizard for flask the wizard went to the pi pi repository and installed all the necessary packages to get my application up and running for me let's see what pycharm installed i've now opened the python packages tool window let's see what's in there as soon as you open it you can already see a list of installed packages these are the packages that pycharm installed for me when i selected flask as my project type for example ginger 2 and flask are listed in the package listing it's important to mention that these packages belong to the current virtual environment that pycharm also created for this project in this case a virtual environment in this project directory based on python 3.10 so that's the new packages tool window we showed how to see packages let's now manage them another cool thing you can do here is to browse for new packages to install sure it's a common task but working in python projects can kind of make this complicated let's assume that you want to install requests a very popular python package in the packages tool window i'll click on the search bar i then start typing requests as you see pycharm will search the pi pi repository and get back to me with the most relevant packages that match my search if i click on the package name you'll see on the right hand side that the documentation for this package is rendered this is the same documentation that you would find at pi p i so although it's widely available for popular packages sometimes in the case of minor packages it will not be available you also have the option of clicking documentation and checking it from your browser now let's imagine that you want to install this package instead of going to the command line you can just click the install button to install the latest stable version of the package or select a specific version if your application requires it so let's install requests if we now check our list of installed packages we'll see that request is already there ready to be imported and used in our scripts although not common you might also want to delete a package in this case you just need to click the three dots and choose delete package there you go adding a new package pycharm put a pretty face on top of what might have been a very difficult set of machinery in the background local versus remote pip versus conda versus pip versus poetry and so on all right we covered how to install packages from pi pi but you might also want to install packages from a version control system like github or even from your local machine in this case how would you do it it's easy and straightforward let's take a look in the package tool window you first click add package then you have two options add a package from version control or add a package from disk from the disk is as simple as providing the local path to your package directory or an archive we're not importing anything so let's hit cancel and choose add package again this time we will click from version control here you should first select the version control system that you use and then specify a path to the target repository in both cases you can select the dash e check box to install the package in editable mode remember in both cases you can select the dash e check box to install the package in editable mode well that's it for this video you just saw how easy it is to install and manage python packages in pycharm a quick tip to wrap up the video is that sometimes people install python packages from the local terminal without having the virtual environment activated this is a very common mistake by beginners then when they try to import the package using pycharm they'll see a red squiggly line and an error saying no module named request for example this kind of error can be prevented when using pycharm to install and upgrade your packages i hope this video was useful for you but if you have questions feel free to ask them in the comments down below in the next episode we'll see some basic code assistance tips that will boost your productivity and pie charm so make sure to click the subscribe button and don't miss any future updates also feel free to leave your comments about the topics discussed and any other topics you'd like us to cover in future episodes see you in the next video [Music] you
Info
Channel: PyCharm, a JetBrains IDE
Views: 22,426
Rating: undefined out of 5
Keywords: pycharm, python ide, python packages
Id: EanHxYTYGio
Channel Id: undefined
Length: 7min 32sec (452 seconds)
Published: Tue Apr 05 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.