6 ms·
which python which python3 which python3nogil
by Waterluvian 3y ago
which python
which python3
which python3nogil
- echelon 3y agovenv, virtualenv, pipenv, pyvenv, venvwrapper, conda, ... Python4 needs a hard reset.
- whalesalad 3y agothose are all means to the same end. venv == virtualenv virtualenvwrapper is ancient not rly used anymore pyenv is a third party tool that makes some of this easier, notably around creating more than just a virtual env in that you also choose the Python version. Python is not hard to deal with in this regard I think people are just uninformed.
- coldtea 3y agoAre you kidding me? The horrendous way Python does dependency management and virtual environments, and the fractured ecosystem around those, is one of it biggest pain points, often covered by core CPython developers and prominent Python third party developers, hardly "misinformed" people. https://xkcd.com/1987/ https://xkcd.com/1987/
- whalesalad 3y agoThat comic is very old. In the days of 2.x it was a little harrier but nothing like people make it out to be. The literal only thing you need to understand is “sys.path”. If you inspect this in a shell you will know what you’re up against. Python is all literally just directories. It’s so easy and yet people get so bent out of shape over it. Create a venv, activate it, and use pip as normal. If you ever run into issues, look at sys.path. That’s it.
- coldtea 3y ago>That comic is very old. And few things have changed since then.
- whalesalad 3y agoI’m gonna have to disagree with ya there bud. Never been easier to be a Python developer.
- coldtea 3y agoWhich is irrelevant. We're talking about the dependencies/packaging/virtual environments situation, not whether "it's easy to be a Python developer" in general. And you can disagree all you want, but it's simply wrong that Python's packaging/venv ecosystem is "just fine".
- beowulfey 3y agoThere are options to do things other ways, but most of the time I just use venvs and pip for everything. Is it because people have to use venvs that people complain about it? I’ll admit being able to install via an OS package manager, vs pip, vs anaconda etc etc can be confusing, but is any of that really Python (the language)’s fault?
- slt2021 3y agohow about: pip install pip install -u sudo pip install conda install sudo conda install some packages require one, are fine with other with few small warnings, and dont work with third way of installing.
- whalesalad 3y agoIf you’re installing a Python package into the global site packages directory (ie, into the system Python) you might need sudo. That’s how permissions work. I don’t know the -u flag on pip, never used it can’t find it in the docs. With a virtual environment sudo is not needed. Assuming you created it, and/or it is owned by you. Virtual environments are just directories on disk. They are not complex. I don’t use conda because it’s never felt even remotely necessary to me. pip and a requirements file is all you need.
- slt2021 3y ago-u flag is short for --user ( https://stackoverflow.com/questions/42988977/what-is-the-purpose-of-pip-install-user https://stackoverflow.com/questions/42988977/what-is-the-pur... ) how about when you are authoring script under your name, but then want to schedule it for cron to run periodically? I often find myself working under my user on remote server, but then I want to schedule cron job - and run into all sorts of permissions / bugs and missing packages. especially when multiple machines need to run this script, and I don't want to involve containers to run 20-lines simple python script. this is why Golang is so popular - you can just scp a single binary across machines and it will just work.
- wombatpm 3y agoI’ve started packaging up my clients python scripts as docker images. Works great for cron tasks and updates/rollbacks are a breeze
- slt2021 3y agoI also forget a out: 1. pip install (with/out --user flag ) 2. pip3 install (with/out --user flag ) 3. sudo pip install 4. sudo pip3 install 5. conda install 6. sudo conda install
- theLiminator 3y agoThis is Stockholm syndrome
- whalesalad 3y agoIt’s one of the most popular programming languages in the world for a reason.
- smabie 3y agoAnd the terrible package management story is not one of those reasons
- whalesalad 3y agocorrect, because it’s not terrible.
- lanstin 3y agoI routinely help data scientist people with mangled local python installs. It could be a full time job but a really bad one.
- replygirl 3y agomore like which python3-compat
- bick_nyers 3y agosudo apt install python3nogilispython3 sudo apt install python3ispython
- tremon 3y agoYou would not need separate packages to do that (in fact, you can't do this with separate packages because dpkg will complain if two packages provide the same file). sudo update-alternatives --set python3 /usr/bin/python3-nogil sudo update-alternatives --set python /usr/bin/python3
- takeda 3y agoThe PEP actually states that the nogil version would also have env variable allowing to temporarily enable GIL. Although I guess in practice they might still build separate versions.
- js2 3y agoWhat do you propose as an alternative? I write code in a lot of languages and I can't think of a single one where I don't have to consider the version. This applies to C, node, ruby, swift, gradle/groovy and java at least. Even bash. When developing for Android and iOS, I have to consider API versions.
- echelon 3y agoAlmost every third party ML model I look at seems to have different versions, different dependencies, and requires deliberate trial and error when creating container images. It's a mess. Having interpreters and packages strewn across the machine is a nightmare. The lack of standard tooling has created a lawlessly dangerous wild west. There are no maps, no guardrails, and you have to beware of the hidden snakes. It goes against the zen of python. As a counter example, Rust packs everything in hermetically from the start. Python4 [1] could use this as inspiration. Cargo is what package and version management should be, and other languages should adopt its lessons. [1] Let's make a clean break from Python3 even if we don't need a new version right now.
- Waterluvian 3y agoRust and Node (via nvm) feel good. The worst I run into is “this version of node isn’t installed” and then I just add it. And I don’t have to worry about where dependencies are being found. Python likes to grab them from all over my OS.
- js2 3y agoI use direnv and pyenv. When I cd to a repo/directory, the .envrc selects the correct Python and the directory has its own virtual environment into which I install any dependencies. I don't find that Python grabs packages from all over the OS.
- Waterluvian 3y agoIndeed there’s a good half-dozen options in Python for this kind of thing. But it depends on which one each project opts to use.
- Nihilartikel 3y agoAsdf makes all of this pretty easy. For consulting I often need multiple versions of everything to match client projects - Just install them with asdf and put a .toolversions file in the project folder with the desired tooling builds.
- EamonnMR 3y agoIt's probably going to be /home/you/project/venv/bin/python
- Der_Einzige 3y agoJust use conda/mamba unironically. Solves all of these problems. Venv and other solutions should be depreciated already.
- kaba0 3y agoIt is not the language’s task to solve. Use a proper dependency manager like nix.
- meowface 3y agoOr pyenv (https://github.com/pyenv/pyenv https://github.com/pyenv/pyenv) if you don't want to take the plunge into something like nix. As for managing Python library dependencies, I use poetry (https://python-poetry.org https://python-poetry.org), though unfortunately both it and pipenv seem to progressively break functionality over time for some reason.
- takeda 3y agoIt would be more like: does the code support nogil? Because the code that is updated is expected to work with both versions.