#๐ default pip packages
41 messages ยท Page 1 of 1 (latest)
@rough steeple
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.
run pip list to see what is installed, in a clean python install i think there will only be pip listed there
What are these packages and why can't I uninstall?
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?
MacOs 15.2
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
if you haven't installed anything it's the default system python installation and packages
No I did install some packages and since I didn't know much about python I installed it globally
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
that is one of the locations, python packages can be installed in several locations
Why hasn't numpy and mpl_toolkits shown in pip3 list
could be that they are for the wrong version of python, what does python3 --version say?
Python 3.9.6
hmm, that looks correct
Do you think I should uninstall these packages as super-user?
which ones?
All of them except pip
they might be used by other things on your system, so i really wouldn't touch them
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
you would create a venv (virtual environment) and install all your stuff there
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
you can find a longer introduction to python virtual environments at https://realpython.com/python-virtual-environments-a-primer/
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
thank you
you're welcome ๐
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?
__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
Alright thank you
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.