#๐Ÿ”’ default pip packages

41 messages ยท Page 1 of 1 (latest)

rough steeple
#

Is there any default pip packages?

Python 3.9.6
pip 21.2.4

heady oakBOT
#

@rough steeple

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

humble pine
rough steeple
#

What are these packages and why can't I uninstall?

humble pine
#

you might not have the right privileges to uninstall any of them if they are installed system wide and you are using a normal user account

#

what OS are you using?

rough steeple
#

I also think it's good to mention that I didn't install pip3 or python3. I had it installed via xcode command line tools so mabye some of these packages are used for compiling swift or for other programs

humble pine
#

if you haven't installed anything it's the default system python installation and packages

rough steeple
humble pine
#

you can use it, but i would recommend using some other python installation for your own stuff and just let the system use it's own and don't touch that, so that you can run what ever version you feel like and let the system run the version that it prefers

#

i mostly use pyenv to install a clean python alongside the system python so that i don't have to use the system python, then just use virtual environments and never install any python packages in the python installation, only in the venv
or i use uv with python-build-standalone

rough steeple
#

The packages in pip list isn't here?

humble pine
# rough steeple

that is one of the locations, python packages can be installed in several locations

rough steeple
humble pine
rough steeple
#

Python 3.9.6

humble pine
#

hmm, that looks correct

rough steeple
rough steeple
humble pine
#

they might be used by other things on your system, so i really wouldn't touch them

rough steeple
#

Since I want to prevent this in the future how would i install packages specific to a directory/project.

#

For example in npm we would do npm init and then install any packages and it will only be available in the package

#

what is the equivelent in python

humble pine
#

you would create a venv (virtual environment) and install all your stuff there

rough steeple
#

How?

humble pine
# rough steeple How?

when you are in the root of your project folder you can run

python3 -m venv venv
``` to create it (the second `venv` is just the directory name for the venv)
then you activate it with
```sh
. venv/bin/activate
``` and don't forget the dot with the space after it there in the beginning of the line, it means `source` the file
#

after you have activated the environment you can use pip inside the environment just as you would normally but installations would be confined to the virtual environment

#

to get out of the virtual environment you can run the deactivate command

#

remember that you need to activate your virtual environment to run things in it, or run your code with the python executable inside the virtual environment if you don't want to activate the whole virtual environment and just want to run a one off

rough steeple
#

thank you

humble pine
rough steeple
#

Also one last question it is irrelevent to everything we were disscussing but what is the common practice for entrypoint files. I've see a lot of main.py and __init__.py. Which one should I use for the entrypoint?

humble pine
#

__init__.py is for modules/libraries
for a script main.py is pretty common, but can be called what ever you want
it also depends on the type of project you are doing, some frameworks has specific guidelines

rough steeple
#

Alright thank you

heady oakBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.