Cannot pip install tensorflow

when I write sudo pip install tensorflow I get the following error:

Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

I tried some things from online but did not help. What should I do?

You should search the forum first before posting a topic, but here is another topic that a user posted regarding installing tensorflow.

Please don't do that.

tensorflow is in the repos. Use that instead.

Also,

:point_up:

1 Like

I do not want the gpu version, but the cpu one.

Also, I have the tensorflow from repos installed, I dont know how to use that to run my python files, stupid question, but it's a newbie corner. Please be easy on me.

Try following the instruction on the very last reply.

And also try to fill out your profile so that the readers and helpers know what Desktop Environment you have, what Kernel you have, what gpu you have, and etc.

Will update my profile. While following the pacman install of the tensorflow from [here] the third command (Install Tensorflow 2), I encountered the following:
==> ERROR: 'pacman' failed to install missing dependencies. ==> Missing dependencies: -> bazel -> cuda -> nvidia-utils -> nccl -> cudnn -> python-wheel -> python-h5py -> python-keras-applications -> python-keras-preprocessing ==> ERROR: Could not resolve all dependencies.

preceding with errors I saw here saying Errors occurred, no packages were upgraded. . I can share the screenshot if needed.

I still cannot run my python file, it says tensorflow not found. I noticed that pip installs are discouraged. It would be great if you could point me to a page where it explains why. Also, help! Thanks.

I think pip install is only for debian based distros (I think) and pacman -S is for arch linux. And don't run the third command if you don't have a nvidea gpu.

The Errors occurred, no packages were upgraded problem persists. Here's the errors:

Proceed with installation? [Y/n] y
(15/15) checking keys in keyring [#######################################] 100%
(15/15) checking package integrity [#######################################] 100%
(15/15) loading package files [#######################################] 100%
(15/15) checking for file conflicts [#######################################] 100%
error: failed to commit transaction (conflicting files)
python-h5py: /usr/lib/python3.8/site-packages/h5py/init.py exists in filesystem
python-h5py: /usr/lib/python3.8/site-packages/h5py/pycache/init.cpython-38.pyc exists in filesystem
...
...
...
python-keras-preprocessing: /usr/lib/python3.8/site-packages/keras_preprocessing/image/image_data_generator.py exists in filesystem
python-keras-preprocessing: /usr/lib/python3.8/site-packages/keras_preprocessing/image/iterator.py exists in filesystem
python-keras-preprocessing: /usr/lib/python3.8/site-packages/keras_preprocessing/image/numpy_array_iterator.py exists in filesystem
python-keras-preprocessing: /usr/lib/python3.8/site-packages/keras_preprocessing/image/utils.py exists in filesystem
python-keras-preprocessing: /usr/lib/python3.8/site-packages/keras_preprocessing/sequence.py exists in filesystem
python-keras-preprocessing: /usr/lib/python3.8/site-packages/keras_preprocessing/text.py exists in filesystem
Errors occurred, no packages were upgraded.

It was previously showing numpy and matplotlib too, I tried this and it's not showing that anymmore. I did the same for every other package. And now tensorflow works! Phew! Thanks much appreciated! Next time around I need to dig deeper around older threads!

2 Likes

It is because the package manager expects to own all those files and if you use pip or some other type of manual install the package manager will recognize that it doesn't own the files and this will cause you quite a lot of pain down the road. You will end up in strange situations where you are forced to research those errors and make decisions about when to forcibly overwrite or remove them.

On top of that, Python is an ecosystem that needs t be aligned from a version perspective. When you use two different mechanisms for updates, you will inevitably end up out of alignment at some point.

1 Like

You should mark your comment as the solution. And if in the near future you encounter a problem, try searching the forums first before posting anything. And here are posts that can help you give information about your device. Provide details when seeking assistance
Dump your "inxi -Fxxxza --no-host" here and bookmark it

How do you use pip though? Or rather, when do you use it?

You can use it for Python development in a virtualenv or some similar sandbox. Realistically, you shouldn't count on system libraries for Python development to begin with.

1 Like

Oh, okay. Thanks for the clarification!

Yes, my last resort/option/savior was going to be to create a virtual env as advised here, but the forum helped me! Great community, stay tuned for more newb questions!

2 Likes

Great job! You should mark your comment as the solution so that other people will be pointed to the right direction. Good luck!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by