Sorry Python but it is what it is.

    • @[email protected]OP
      link
      fedilink
      English
      82 years ago

      cargo just works, it’s great and everyone loves it.

      npm has a lot of issues but in general does the job. When docs say do ‘npm install X’ you do it and it works.

      pip is a mess. In my experience doing ‘pip install X’ will maybe install something but it will not work because some dependencies will be screwed up. Using it to distribute software is pointless.

      • @[email protected]
        link
        fedilink
        252 years ago

        I use pip extensively and have zero issues.

        npm pulls in a million dependencies for even the simplest functionality.

        • @[email protected]OP
          link
          fedilink
          English
          52 years ago

          It probably works for your own local project. After using it for couple of days to install some 3rd party tool my conclusion is that it has no idea about dependencies. It just downloads some dependencies in some random versions and than it never works. Completely useless.

        • qaz
          link
          fedilink
          52 years ago

          You’ve never had broken dependencies?

          • @[email protected]
            link
            fedilink
            52 years ago

            Nope. I know mixing pip with python packages installed through your systems package manager can be a problem but that’s why I containerize everything.

    • @[email protected]
      link
      fedilink
      102 years ago

      Pip stores everything inside of some random txt file that doesn’t differentiate between packages and dependencies.

          • @[email protected]
            link
            fedilink
            82 years ago

            Yes, but this file is created by you and not pip. It’s not like package.json from npm. You don’t even need to create this file.

            • @[email protected]
              link
              fedilink
              42 years ago

              Well if the file would be created by hand, that’s very cumbersome.

              But what is sometimes done to create it automatically is using

              pip freeze > requirements. txt

              inside your virtual environment.

              You said I don’t need to create this file? How else will I distribute my environment so that it can be easily used? There are a lot of other standard, like setup.py etc, so it’s only one possibility. But the fact that there are multiple competing standard shows that how pip handles this is kinds bad.

              • Vash63
                link
                fedilink
                32 years ago

                I work with python professionally and would never do that. I add my actual imports to the requirements and if I forget I do it later as the package fails CI/CD tests.

              • @[email protected]
                link
                fedilink
                English
                22 years ago

                If you try to keep your depencies low, it’s not very cumbersome. I usually do that.

                A setup.py/pyproject.toml can replace requirements. txt, but it is for creating packages and does way more than just installing dependencies, so they are not really competing.

                For scripts which have just 1 or 2 packges as depencies it’s also usuall to just tell people to run pip install .

          • Farent
            link
            fedilink
            72 years ago

            Isn’t it called a requirements.txt because it’s used to export your project requirements (dependencies), not all packages installed in your local pip environment?

      • SSUPII
        link
        fedilink
        52 years ago

        Honestly its a simple and straightforward solution. What’s wrong with it?

        • @[email protected]
          link
          fedilink
          2
          edit-2
          2 years ago

          If newer versions are released and dependencies change you would still install the old dependencies. And if the dependencies are not stored you can’t reproduce the exact same environment.

      • Daniel Quinn
        link
        fedilink
        English
        182 years ago

        cough npm,yarn,grunt,esbuild,webpack,parcel,rollup,lasso,rollup,etc.,etc.cough

        I’m not saying that Python’s packaging ecosystem isn’t complicated, but to paint JavaScript as anything other than nightmare fuel just isn’t right.

        • @[email protected]
          link
          fedilink
          82 years ago

          I don’t think that’s a fair comparison, the only two libraries that are related to the actual packaging system in that list is yarn and NPM. The rest of them have to do with the complexities of actually having your code runnable in the maximum number of browsers without issue. If python was the browser scripting language, it’d likely have the same issue.

          Is there a python package that transpiles and polyfills python3 to work in python 2? 2.7? 2.5?

          Also, unrelated to your comment, a lot of people are dunking on npm for the black hole that is node modules (which is valid), but also saying it’s not pip’s fault a lot of packages don’t work. It’s not npm’s fault the package maintainers are including all these dependencies, and there are some 0-dependency packages out there.

          • @[email protected]
            link
            fedilink
            2
            edit-2
            2 years ago

            Is there a python 3 package that polyfills to Python 2?

            Plenty of 'em. You ever heard of the six library?

      • Fushuan [he/him]
        link
        fedilink
        English
        22 years ago

        It’s not that confusing. There’s like 5 main different tools in total, what are you going to code if you can’t even set up the workspace? That’s much simpler than an installation that depends on cuda or spark, and those only require setting up environment variables after installation anyway.

        As a programmer you’ll encounter several redundant libraries and tools in your life where each has an edge in some use cases and you’ll learn to use most to be able to adapt to the different projects you encounter, python’s package manager tools are simply one of those.

    • @[email protected]
      link
      fedilink
      English
      22 years ago

      I genuinely don’t get the hate for pip, been using it for 5 years and never had an issue

    • @[email protected]
      link
      fedilink
      5
      edit-2
      2 years ago

      The only time I ever interacted with python packaging was when packaging for nixos. And I can tell you that the whole ecosystem is nuts. You have like ten package managers each with thirty different ways to do things, none of which specify dependencies in a way that can be resolved without manual input because y’all have such glorious ideas as implementing the same interface in different packages and giving each the same name and such. Oh and don’t get me started on setup.py making http requests.

    • @[email protected]OP
      link
      fedilink
      English
      172 years ago

      This article someone linked is not 14 years old and it perfectly describes the mess python and pip are: https://chriswarrick.com/blog/2023/01/15/how-to-improve-python-packaging/

      My favorite part is:

      Most importantly: which tool should a beginner use? The PyPA has a few guides and tutorials, one is using pip + venv, another is using pipenv (why would you still do that?), and another tutorial that lets you pick between Hatchling (hatch’s build backend), setuptools, Flit, and PDM, without explaining the differences between them

      But yes, following old blog post is the issue.

      • @[email protected]
        link
        fedilink
        22 years ago

        If you’re using a manually managed venv, you need to remember to activate it, or to use the appropriate Python.

        That really doesn’t seem like a big ask.

        I’ve been using python professionally for like 10 years and package management hasn’t really been a big problem.

        If you’re doing professional work, you should probably be using docker or something anyway. Working on the host machine is just asking for “it works on my machine what do you mean it doesn’t work in production?” issues.

        • @[email protected]OP
          link
          fedilink
          English
          12 years ago

          No, actually most devs don’t use docker like that. Not java devs, not JS devs, not rust devs. That is because maven, npm and cargo manage dependencies per project. You use it for python exactly because pip does it the wrong way and python has big compatibility issues.

            • @[email protected]
              link
              fedilink
              52 years ago

              Friend, while I appreciate the time and effort on the docs, it has a rather tiny section on one of the truly worst aspects of pip (and the only one that really guts usability): package conflicts.

              Due to the nature of Python as an interpreted language, there is little that you can check in advance via automation around “can package A and package B coexist peacefully with the lowest common denominator of package X”? Will it work? Will it fail? Run your tool/code and hope for the best!

              Pip is a nightmare with larger, spawling package solutions (i.e. a lot of the ML work out there). But even with the freshest of venv creations, things still go remarkably wrong rather quick in my experience. My favorite is when someone, somewhere in the dependency tree forgets to lock their version, which ends up blossoming into a ticking time bomb before it abruptly stops working.

              Hopefully, your experiences have been far more pleasant than mine.

    • TunaCowboy
      link
      fedilink
      392 years ago

      This is programmer humor, 95% of the people here still get defeated by semicolons, have never used a debugger, and struggle to exit vim.

      • Fushuan [he/him]
        link
        fedilink
        English
        152 years ago

        Sometimes I wish there was a community for more advanced users, where the concept of deciding on the best build tool chain per project is not a major hurdle. Venvs? Nbd. Pipenv? Nbd. Conda/mamba/micromamba? Nbd. Pure pip? Oh boy, I hope it a simple one, but I’ll manage. Maven? Fml, but sure. Npm? Sure. “Complex” git workflows, no problem.

        Idk, that’s just setting up the work environment, if your brains get squeezed by that I’m not sure if you will then be able to the actually code whatever its being asked of you. Some people…

        But yeah, this is a newbie space so I guess that we have to ignore some noise.

        • jelloeater
          link
          fedilink
          English
          12 years ago

          Seriously, I usually use Poetry these days for most projects, shit just works, build well and lets me distribute my code from PiPy just fine. Everything in one pyproject.yaml.

    • @[email protected]
      link
      fedilink
      42 years ago

      I have to agree, I maintain and develop packages in fortrat/C/C++ that use Python as a user interface, and in my experience pip just works.

      You only need to throw together a ≈30 line setup.py and a 5 line bash script and then you never have to think about it again.

      • Scribbd
        link
        fedilink
        42 years ago

        If we talk about solutions: python has plenty. Which might be overwhelming to the user.

        I use Direnv to manage my python projects. I just have to add layout pyenv 3.12.0 on top and it will create the virtual environment for me. And it will set my shell up to use that virtual environment as I enter that directory. And reset back to default when I leave the directory.

        But you could use pipenv, poetry, pdm, conda, mamba for your environment management. Pip and python do not care.

  • luky
    link
    fedilink
    182 years ago

    i will get hated for this but: cargo > composer > pip > npm

  • @[email protected]
    link
    fedilink
    202 years ago

    This is why I use poetry for python nowadays. Pip just feels like something ancient next to Cargo, Stack, Julia, npm, etc.

  • @[email protected]
    link
    fedilink
    72 years ago

    Getting into rust is still on my to-do list, otherwise I’ve no major problem with pip or npm. They both have their flaws, but both work well enough to do what I need them for. If I had to prefer one it would be pip simply to sustain my passionate hate for all things JavaScript.