Hacker News new | past | comments | ask | show | jobs | submit login

`pip install --upgrade pip` fixed this for me. (not in tensorflow directly, but while installing something else on my M1 last week which required numpy)



OK, so we’re in mid-2021, why is installing Python THAT HARD? I think the only reason Node is so popular is because it JUST WORKS. Windows, Mac, doesn’t matter. One-click installer and you got NPM as well and access to thousands of packages.


As someone using nvm for work, I disagree. NPM can't be installed from normal package repositories, because it's outdated the moment any long-term support distribution accepts it. Then there's yarn, which is fighting for command line dependency management supremacy, with the exact same problem. I'm still not sure what npx does but I think it comes with NPM, unlike nvm which you use to manage NPM installs. I'm hoping I don't need to learn it because I expect some new javascript tool to replace NPM and yarn any day now, as those did bower and grunt before them.

I've also had to use nvm to install an old version of NPM for a specific project because otherwise one of the NPM dependencies couldn't compile a certain C++ executable that I apparently needed? There was also an incompatibility with some binary that another dependency downloaded that required me to mess with soft links to libraries in specific places.

I don't think either NPM or PIP are inherently hard to use as long as you keep them updated (which is exactly what the parent comment is suggesting to do) and as long as you don't need binary dependencies. When you end up in binary territory, which this type of software eventually will, you'll run head-first into stuff that requires arcane commands to get stuff to run.


Respectfully disagree. Being an experienced Python dev, and a total JavaScript noob, I feel exactly the same with npm.

It's ultimately just a matter of experience I guess


While I don't think the problem is as bad as you describe, we should note that Node's initial release was in 2009, while python's was 1991. They pioneered a lot and Node was thus able to spring from quite hefty shoulders.


I consider myself a novice but competent python programmer (not particularly skilled or expert) and everytime i have to use something made in python i cringe because i know it will require 30 minutes of futzing with things to even run it.

Python’s ecosystem is the worst for get-up-and-go usage.

Nvm or nodenv make managing node environments trivial compared to virtualenv, pip, and co. Same with rustup or rbenv… in fact python is the only language i have the problem with.


For real. I enjoy the language but I avoid it like the plague due to...everything else.


i think the comparison with node is good, because my policy for both of them is the same - if i want to use either, i do it inside docker.

i can't be arsed to deal with all the various version dependencies and incompatabilities and system install vs local install nonsense that comes with installing it on my actual computer.


I use asdf (cloned after rbenv) for version management and building versions. Never have a problem.


In case it doesn't fix it for anyone else, here's what worked for me.

First, I ran:

  pip3 install virtualenv
  cd ~
  python3 -m virtualenv tfenv -p python3 --system-site-packages
Now you can activate your tensorflow env at any time by running this:

  source ~/tfenv/bin/activate
I alias this to `tf2` in my ~/.zprofile file:

  alias tf2='source ~/tfenv/bin/activate'
Open up a new terminal and run `tf2`. Now you're in a clean virtualenv, with none of the conda BS. The nice thing about this venv is that if you already have some libraries installed, you can just `import` them. No need to reinstall them for every venv, which I quite like.

So, the goal is to install tensorflow-macos and tensorflow-metal, but the problem is that their pip3 command is failing with some obscure numpy error.

Here's the command that works:

  pip3 install --no-dependencies tensorflow-macos tensorflow-metal absl-py wrapt opt-einsum gast astunparse termcolor flatbuffers
The way I arrived at that command was to run `pip3 install --no-dependencies tensorflow-macos tensorflow-metal`, open a python repl, and try 'import tensorflow as tf'. If it threw an error about package_foo, I added `package-foo` to the end of the command.

That method worked for tracking down every library except absl (unknown library name). But googling pip3 install absl showed that it was named absl-py, not absl.

Now I can run python3, then this code:

  import tensorflow as tf2; tf = tf2.compat.v1; sess = tf.InteractiveSession(); sess.list_devices()
and it shows I have both a CPU and GPU device! I'm really hyped about that. I've wanted tensorflow GPU on my laptop for... about two years? more?

Note that it spits out a warning like this:

  WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
I'm going to leave it as-is, until problems pop up for me. But if you want to try to address it, try adding tensorboard to that pip3 install command above, and repeat the process I described to install any other dependencies.


Alas, this isn't working for me.

    ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none)
    ERROR: No matching distribution found for tensorflow-macos
But it turns out that was using an x86_64 version of Python3 - setting up an arm64 version (under /opt/homebrew) worked.


Presumably actually:

  python -m pip install --upgrade pip
just:

  pip install --upgrade pip
Is “break pip if there is a newer version available”, at least last I checked. (It uninstalls the existing pip but can’t complete the install of the new one.)


I’ve used the latter several times a month over the last year or so, but only since about pip 19.x, didn’t use Python much before a couple of years ago.


It may only be older pip, or windows, or a combination. I've broken pip in quite a few venvs that way in the past though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: