Pytorch errors: "received an invalid combination of arguments" in Jupyter Notebook
I'm trying to learn Pytorch, but whenever I seem to try any online tutorial (https://pytorch.org/tutorials/beginner/blitz/tensor_tutorial.html#sphx-glr-beginner-blitz-tensor-tutorial-py), I get errors when trying to run certain functions, but only in Jupyter Notebook.

When running

x = torch.empty(5, 3)


I get an error:

module 'torch' has no attribute 'empty'


Furthermore, when running

x = torch.zeros(5, 3, dtype=torch.long)


I get the error:

module 'torch' has no attribute 'long'


Some other functions work fine like:

x = torch.rand(5, 3)


But generally, most code I try to run seems to run into an error really quickly. I couldn't find any resolution online.

When I go into my docker container and simply run python in the shell, I can run these lines just fine with no errors.

I'm running pytorch in a Docker image that I extended from a fastai image, as it already included things like jupyter notebook and pytorch. I used anaconda to update everything, and committed it to a new image for myself.

I have absolutely no idea what the issue could be. I've tried updating packages through anaconda, pip, aptitude in my docker container, and making sure to commit my changes, but nothing seems to work. I also tried creating a new kernel with python 3.7 as I noticed that my Jupyter Notebook only runs in 3.6.4, and when I run python in the shell it is at 3.7.

I've also tried getting different docker images and extending them with what I need, but all images that I've tried have had errors with anaconda where it gets stuck on "Solving environment" step.

Ok, so the fix for me was to either update pytorch through conda using the following command

conda update pytorch


If it's not installed yet, I've gotten it to work in other environments by simply installing it through conda

conda install pytorch


Kind of stupid that I didn't try this earlier, but I was confused on the difference between conda and pip.
