Maybe a better approach would be to create a new virtual environment (e.g. via conda) and install Python=3.9 there while leaving the system 3.10 installation intact.
Hi,
I’m really sorry, but I am still having a little trouble with this issue. I have followed your advice of installing conda and I got a message at the end saying that the installation was completed successfully. However, when I go into the terminal to confirm that conda has been installed correctly, it says command not found.
After the installation, you need to set up bash environment. Since macOS uses zsh, you need to update .zshrc and .zprofile files as suggested in the GitHub page:
Thanks for all your help so far. I have been able to install PyTorch on my mac with your instructions, but there is just one more query I have: After installing PyTorch, how do you actually go about using PyTorch to create Deep Learning models? There are several packages that PyTorch comes installed with, so where do you go from here?
Coding process with PyTorch is just like a normal python coding.
PS: if you want to use tensorboard to log and/or visualise learning process, currently there is a bit of problem due to a version of disutil package. Check this issue: https://github.com/pytorch/pytorch/issues/69894
Thanks I’ll definitely take a look at these tutorial pages, but which files in the Pytorch package do you click on to start a deep learning environment? Particularly, a deep learning environment for computer vision?
At this point, I am not sure your question is relevant to the topic. Looks like your problem is more about python in general.
Anyway, I don’t know which directory you are showing on the picture but let me guess that is in venv/lib/python3.9/ (if you created virtual environment and installed package there. And of course guess you already activated the virtual environment)
In python, once a library is installed, you don’t need to open the code separately. Just create any file with the extension .py and import the library accordingly.
For example, if you want to use PyTorch, create following script.
# test.py
if __name__ == "__main__":
import torch
A = torch.rand(3, 3) # create a 3 x 3 tensor with random numbers
print(A) # print the tensor
And run the code in the terminal
python test.py # I assume your default python version is 3 not 2.
In this way, you can use any function/module provided by PyTorch.
If you want to test whether PyTorch is installed correctly or not, test in the terminal like this.
Thanks again for your reply. I’m sorry for all the questions, I just really want to get this right. You told me to test the following command in terminal:
python -c “import torch; print(torch.version)”
and I got a version number of 1.10.2, so it appears that PyTorch is installed on my mac. However, when I try to run the following code in terminal:
python test.py
I get an error message of can’t open file, No such file or directory.
You would have to create the test.py file first before trying to execute it.
As @kyoungseoun_chung explained, it might be helpful to check some Python tutorials first, e.g. this one (or search any [free] course) to get familiar with the programming language first.