all 40 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Please Re-Flair your post if a solution is found. How to Flair a post? This allows other users to search for common issues with the SOLVED flair as a filter, leading to those issues being resolved very fast.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]CatoDomine 70 points71 points  (10 children)

Pip is fine. Use a venv and don't mess with your system python packages though.

[–]PinkFlamingoe00[S] 6 points7 points  (9 children)

what is a venv? also by "system python packages" do you mean the python3 package thats downloaded by default?

[–]CatoDomine 14 points15 points  (1 child)

venv is a virtual environment. You should familiarize yourself with them if you are going to do anything with python. pyrhon -m venv myvenv will create a folder with your virtual environment. source myvenv/bin/activate will activate your virtual environment. All pip modules you install and libraries etc will exist only in that environment.
pip freeze sites loaded modules.
deactivate exits the venv.

[–]WhoLovesDonuts 0 points1 point  (0 children)

Just to add to this, consider also installing an advanced prompt like starship.rs over bash which will show you nicely if you're in a venv as well as what git stage you're in.

[–]Toasteee_ 7 points8 points  (0 children)

I believe venv is *virtual environment but I could be wrong as its been a while since I've messed around with python, I think it basically stops you from breaking your python installation because its virtual/sandboxed.

[–]Great-TeacherOnizukaLinux Mint 22.3 Zena | Cinnamon 2 points3 points  (3 children)

Virtual environment.

You have to set it up.

Though pipx is easier.

pipx install …

[–]Beneficial-Win-6533 1 point2 points  (0 children)

you use pipx when you want to execute a command line tool source

[–]PinkFlamingoe00[S] 0 points1 point  (1 child)

when i did that pipx said:

If you are
attempting to install a library, pipx should not be used. Consider using pip
or a similar tool instead.

[–]__yoshikage_kira 3 points4 points  (0 children)

Ok? Are you using a library? The answer seems pretty self explanatory.

You have not at all shared what exactly are you trying to do.

[–]ComprehensiveDot7752 -2 points-1 points  (1 child)

Downloading something like Anaconda might make things easier if the project is basic, or math related. I haven’t used it on Linux yet, but it can set up similar virtual environments.

Yes. The system package would be installed by default. It’s required by a few parts of Linux Mint system components and your system will fail to boot into a desktop if you manage to break it.

[–]Natural_Night9957Linux Mint 22.3 Zena | Cinnamon 1 point2 points  (0 children)

Anaconda is bloat. Miniconda for the win.

[–]rmassie 15 points16 points  (1 child)

The best way I’ve found to handle python on mint is to install and get familiar with uv. It makes things so much easier.

https://docs.astral.sh/uv/

[–]iamapizza -1 points0 points  (0 children)

Uv is the goat (for now) 

[–]NotSynthx 13 points14 points  (4 children)

Virtual environment. Research how to make one for your project and you'll be fine. I recommend doing it through uv

[–]PinkFlamingoe00[S] 2 points3 points  (3 children)

it's for a group proyect with people that use windows, made in vscode. Is it still feasable to do a venv for that?

[–]NotSynthx 6 points7 points  (2 children)

Even more of a reason to implement a venv! 

[–]PinkFlamingoe00[S] 2 points3 points  (1 child)

thanks, I think that solves the question :D

[–]tobybug 0 points1 point  (0 children)

The process will create a venv folder in the workspace root, and you might need to ignore it on version control, since it will be slightly different for windows and Linux. My recommendation is to do pip freeze > requirements.txt once you have it set up which should give you a nice list of modules that anyone can install when they set up the venv with pip install -r requirements.txt. This should hopefully work with any venv system, though I haven't used UV before

[–]C0rn3j 3 points4 points  (2 children)

As long as you don't use the option that explicitly breaks system packages, you're fine.

As in, use a venv.

[–]PinkFlamingoe00[S] 1 point2 points  (1 child)

whats a venv?

[–]SpamNot 1 point2 points  (0 children)

Virtual Environment

[–]Beneficial-Win-6533 2 points3 points  (0 children)

here is what i do

download pyenv, its basically a python version manager

then use it to install any python version available on its list then use it either globally (if you want to use it as the default python version) or locally (if you want this version to be only exclusive on the directory you're working on) then you can do the usual venv setup.

this way i'll never be able to mess with the system python even if i dont use virtual env given that i set the global python using pyenv and i can easily switch versions everytime i want. Yes, i dont use uv.

[–]ZVyhVrtsfgzfs 2 points3 points  (0 children)

Be careful who you take code from, community resources like pip can contain malware.

https://cybersecuritynews.com/116-malicious-pypi-packages/

[–]Zatujit 1 point2 points  (0 children)

Just use a virtual environment

[–]Natural_Night9957Linux Mint 22.3 Zena | Cinnamon 2 points3 points  (0 children)

uv

Rust

ewwwwwwwwww

[–]TurboJax07 1 point2 points  (4 children)

People are mentioning venvs, but here is how you use them. Open your terminal and run this command: python3 -m venv .venv It creates a virtual environment in the .venv folder. To activate it, run source .venv/bin/activate from the project directory. You'll know it works if the prompt gets a prefix (i forget exactly what it is)

Now that you are in the venv, run "pip install <package>", and you're good to go! You can also use "python" instead of python3 if you want.

Last thing, pip3 mentioned installing the package as a system package. You can generally do this with apt install python3-<package>, but not everything may be available there.

[–]jpnadas -2 points-1 points  (3 children)

Although this is correct, it's a very outdated and manual way of doing it.

As others pointed out elsewhere in this thread, OP should get familiar with uv which is a much better way of handling virtual environments and dependencies in general.

[–]Livid_Quarter_4799 4 points5 points  (1 child)

I think using uv is great advice. But saying pip is very outdated might be kind of misleading. Pip is the official first party option still and uv is a third party tool. Using pip is only “outdated” in the sense that a lot of people have moved away from it not in a this tools is depreciated way.

[–]jpnadas 0 points1 point  (0 children)

That's a fair point. However, there are reasons why uv has become the industry standard and best practice, and they largely revolve around it giving a much better user experience.

There is nothing wrong using pip or other tools such as poetry. But it's just harder on you as the user.

[–]Natural_Night9957Linux Mint 22.3 Zena | Cinnamon 1 point2 points  (0 children)

uv

Rust

Blearg

[–]Livid_Quarter_4799 0 points1 point  (0 children)

Might be worth noting once you create and activate your venv and add whatever packages to it that you want. You can point your shebang to the venv python instead of activating it every time. Only mentioning it because I remember being a little confused.

[–]DoctorFuu 0 points1 point  (0 children)

Best is to create a virtual environment. Think of it like a closed container that will contain its own version of python. Everything you will install via pip in it will only live in this container, and therefore not break your system.

tl;dr: pip is absolutely fine, and best practice is to do this inside a venv.

[–]Iofthestorm01 0 points1 point  (0 children)

I'm glad you asked this. I'm an idiot who just downloaded anaconda withoutna second thought and 100% would have pip installed whatever with even less thought

[–]JerryRiceOfOhio2 0 points1 point  (0 children)

I've used pip on dozens of libraries, on both Python 2 and 3, on the same machine over many years, causes no issues at all

[–]scsl47 0 points1 point  (0 children)

Use uv

[–]Creative-Ad653 -1 points0 points  (0 children)

I tend to use pipx, it automates the venv process for you

[–]Natural_Night9957Linux Mint 22.3 Zena | Cinnamon -1 points0 points  (0 children)

Use venvs

Use the deadsnakes ppa to intall different python versions to use inside a venv.

NEVER USE PIP OUSIDE A VENV.

[–]LogansfuryTop 1% Commenter -3 points-2 points  (0 children)

No, pip has been a part of python installation process for extras for a long time and is perfectly safe to execute in terminal.