AWS上创建的notebook实例提示没有导入pytorch模块的解决办法 直接在编辑块中执行如下命令,最后重启kernel问题解决
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
注意上面命令要单独放在单元格中执行如下,否则会报错
#result
Collecting package metadata (current_repodata.json): done
Solving environment: -
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:
- conda-forge/linux-64::keras==2.3.1=py36_0
- defaults/linux-64::_anaconda_depends==2020.02=py36_0
- defaults/noarch::boto3==1.9.162=py_0
- defaults/linux-64::s3transfer==0.2.1=py36_0
- defaults/noarch::botocore==1.12.189=py_0
- conda-forge/noarch::google-auth-oauthlib==0.4.1=py_2
- conda-forge/noarch::google-auth==1.17.2=py_0
- defaults/noarch::numpydoc==1.0.0=py_0
- defaults/linux-64::anaconda==custom=py36_1
- defaults/linux-64::tensorflow==2.2.0=mkl_py36h5a57954_0
- defaults/noarch::sphinx==3.0.4=py_0
- defaults/noarch::s3fs==0.4.2=py_0
- defaults/linux-64::spyder==4.1.3=py36_0
done
## Package Plan ##
environment location: /home/ec2-user/anaconda3/envs/amazonei_tensorflow2_p36
added / updated specs:
- cudatoolkit=10.0
- pytorch
- torchvision
The following packages will be downloaded:
package | build
---------------------------|-----------------
cudatoolkit-10.0.130 | 0 261.2 MB
docutils-0.16 | py36_1 669 KB
gast-0.3.3 | py_0 14 KB
opt_einsum-3.1.0 | py_0 54 KB
pytorch-1.4.0 |py3.6_cuda10.0.130_cudnn7.6.3_0 422.5 MB pytorch
rsa-4.0 | py_0 29 KB
tensorboard-2.2.1 | pyh532a8cf_0 2.4 MB
tensorflow-base-2.2.0 |mkl_py36hd506778_0 129.7 MB
tensorflow-estimator-2.2.0 | pyh208ff02_0 254 KB
torchvision-0.5.0 | py36_cu100 9.1 MB pytorch
------------------------------------------------------------
Total: 825.9 MB
The following NEW packages will be INSTALLED:
cudatoolkit pkgs/main/linux-64::cudatoolkit-10.0.130-0
docutils pkgs/main/linux-64::docutils-0.16-py36_1
gast pkgs/main/noarch::gast-0.3.3-py_0
ninja pkgs/main/linux-64::ninja-1.9.0-py36hfd86e86_0
opt_einsum pkgs/main/noarch::opt_einsum-3.1.0-py_0
pip pkgs/main/linux-64::pip-20.1.1-py36_1
pytorch pytorch/linux-64::pytorch-1.4.0-py3.6_cuda10.0.130_cudnn7.6.3_0
rsa pkgs/main/noarch::rsa-4.0-py_0
tensorboard pkgs/main/noarch::tensorboard-2.2.1-pyh532a8cf_0
tensorflow-base pkgs/main/linux-64::tensorflow-base-2.2.0-mkl_py36hd506778_0
tensorflow-estima~ pkgs/main/noarch::tensorflow-estimator-2.2.0-pyh208ff02_0
torchvision pytorch/linux-64::torchvision-0.5.0-py36_cu100
The following packages will be UPDATED:
ca-certificates conda-forge::ca-certificates-2020.4.5~ --> pkgs/main::ca-certificates-2020.6.24-0
certifi conda-forge::certifi-2020.4.5.2-py36h~ --> pkgs/main::certifi-2020.6.20-py36_0
Downloading and Extracting Packages
gast-0.3.3 | 14 KB | ##################################### | 100%
rsa-4.0 | 29 KB | ##################################### | 100%
tensorboard-2.2.1 | 2.4 MB | ##################################### | 100%
torchvision-0.5.0 | 9.1 MB | ##################################### | 100%
opt_einsum-3.1.0 | 54 KB | ##################################### | 100%
docutils-0.16 | 669 KB | ##################################### | 100%
tensorflow-estimator | 254 KB | ##################################### | 100%
cudatoolkit-10.0.130 | 261.2 MB | ##################################### | 100%
tensorflow-base-2.2. | 129.7 MB | ##################################### | 100%
pytorch-1.4.0 | 422.5 MB | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Note: you may need to restart the kernel to use updated packages.