I got the answer. I initially install a CPU only version this only install cpuonly 1.0. When I uninstall pytorch to install the cuda pytorch it didn’t remove cpuonly 1.0.
to fix it:
conda uninstall pytorch

conda uninstall cpuonly

Then install pytorch again normally
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch