How to install Torch library on python 3.10? - python

Unable to install torch library on my linux machine.
I am trying to install sentence-transformers library in ubuntu. Got to know that Torch is a dependent library therefore I tried
pip install torch
However, at the end of installation it displays the message
Killed
I expanded my volume to cater the storage issue, however I am receiving the same error each time.

Related

Issues with getting cuda to work on torch, importing torch and cuda modules into Python

I'm having some basic issues running the torch and cuda modules in my Python script.
I think that this has something to do with the different versions of Python that I have installed. I have two versions of Python installed:
I think I have torch and cuda installed for the wrong one or something. I don't know how to fix this.
Per the Pytorch website, I installed torch as follows:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
I've installed cuda as follows: pip3 install cuda-python==11.7 (It doesn't matter if I use the newest version -- I still get the same results.)
When I look up the versions, I get the following:
So it seems like it is all installed correctly.
However, if I run the following:
import torch
print(torch.cuda.is_available())
I get False.
If I try to run my code that uses torch, I get the following error:
I don't get what I'm doing wrong. As far as I can tell, I've installed torch with CUDA enabled. So I'm not sure why it's telling me otherwise.
Any ideas? Thanks for any help.
Edit: Here is the info for my GPU:
The issue had to do with the different versions of Python. I ended up using a Conda virtual environment, which solved this issue by ensuring I was using the correct version of Pytorch.

Need help installing TensorFlow/Keras. And h5py and hdp5

I want to use keras in Jupyter. Running command "import tensorflow as tf" tells me that tensorflow cannot be found. "pip install tensorflow" says tensorflow cannot be found. From here i got a better command:
py -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
This worked better, because this time there was progess. But an error was encountered - failed to build wheel for h5py. HDF5 dependency could not be loaded. Trying to get h5py with pip gives exact same error: cant build wheel because hdf5 is missing.
This website does not seem to have anything useful for windows7.
Trying every installer from here had no effect. While claiming that h5py was "successfully installed", trying to install tensorflow proved the opposite.
And trying to install wheels from this website just returned the same error. HDF5 could not be found. Even thought I was trying to install hdf5.
This installation guide is about h5py. it does not work because i dont have hdf5.
So my question is. How do i get a working keras for jupyter? Where can i find an installer that actually installs what i want? What is the complete set of CMD commands that are guaranteed to work and result in a working Tensor flow?
i am using 64 bit windows7, my python is 3.7.2. This fetch quest of collecting tiny bits and pieces of the answer is driving me mad.

Sagemaker Torch Installation Failing

I try to install torch on Sagemaker with the shebang-command in python.
!pip install torch==1.6.0
However, I can only run a notebook once on that specific version. The next time i install that torch version using the notebook, it fails.
The exact error message is:
Collecting torch==1.6.0
Killed
The only workaround would be to install slightly different versions for next notebook runs.

unable to import tensorflow after I pip install in a virtual environment in python

my python version is 3.7.5.
In vscode, I created my virtual environment
python -m venv myProj
Then I switch my python interpreter to: python3.7.5 64bit ('myProj':venv)
I install tensorflow as below:
pip install tensorflow
I can see tensorflow appear in the myProj/lib-sitePackages
Then I tried to run python file in which there is one line 'import tensorflow'
The prompt became like below:
(myProj) C:\Users\xxx\Documents\My_Document\myname\myProj>
I got error like below:
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.........
Interestingly, when I did pip install tensorflow outside of virtual environment, I was able to run python3.7.5 and import tensorflow.
I spend hours try this and that. But got no success.
Do anyone know why it happens?
Run tensorflow in anaconda.
Delete and unistall all existing python software and download anaconda.then view tutorials of how to install tensorflow and keras in anaconda. It takes about 20 mins with goodnet speed.
I used to get the same dll error load module not found error when tried without anaconda.these are compatibility issues

Pip3 installing of Tensorflow issue

I'm trying to install python and tensorflow to learn as part of a class I am taking, and am having some issues installing tensorflow. I keep getting the same set of errors:
C:\Users\X\AppData\Local\Programs\Python\Python36-32\python.exe: can't find '__main__' module in 'C:\\'
or
Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow
I've tried uninstalling and reinstalling python while adding it to my path, and that solved me not being stuck with syntax errors (most of the time), but I haven't been able to make any progress. Any advice on moving forward would be appreciated.
To be clear, I am typing the following command into my command prompt:
pip3 install --upgrade tensorflow
As per the instructions on the TensorFlow website - I've been finding the "C:\>" raises a syntax error however.
your pip3 is broken, because I can clearly see tensorflow distribution on PyPi for python 3.6 https://pypi.python.org/pypi/tensorflow/1.5.0. Also, I just created a new virtual env for python 3.6 and I am able to pip install it.
Also you can download manually the "tensorflow-1.5.0-cp36-cp36m-win_amd64.whl",assuming you have windows, and pip install tensorflow-1.5.0-cp36-cp36m-win_amd64.whl

Categories

Resources