ubuntu anaconda pytorch配置

在ubuntu16 anaconda上配置 caffe2,因为caffe2已经和pytorch合并了,所以配置pytorch即可。

启动Anaconda环境

安装依赖库

pip install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing

 安装cuda驱动,注意:这里需要确定cuda版本

(wind2) star@xmatrix:~$ 
(wind2) star@xmatrix:~$ cat /usr/local/cuda/version.txt
CUDA Version 10.1.243
(wind2) star@xmatrix:~$ 
(wind2) star@xmatrix:~$ 
conda install -c pytorch magma-cuda101 # or [magma-cuda92 | magma-cuda100 | magma-cuda101 ] depending on your cuda version


 下载pytorch

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive   #这一步会用很长时间

 conda install lmdb

安装,这里也会用很长时间

python setup.py install

...............
byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/basic_rnn_test.py to basic_rnn_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/bucketize_op_test.py to bucketize_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/channel_stats_op_test.py to channel_stats_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/unique_uniform_fill_op_test.py to unique_uniform_fill_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/scale_op_test.py to scale_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/torch_integration_test.py to torch_integration_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/operator_test/given_tensor_fill_op_test.py to given_tensor_fill_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_fill_op_test.py to mkl_fill_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_sigmoid_op_test.py to mkl_sigmoid_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/rewrite_graph_test.py to rewrite_graph_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_pool_op_test.py to mkl_pool_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_speed_test.py to mkl_speed_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_elementwise_add_op_test.py to mkl_elementwise_add_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/rewrite_graph.py to rewrite_graph.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_pool_speed_test.py to mkl_pool_speed_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_fc_speed_test.py to mkl_fc_speed_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_copy_op_test.py to mkl_copy_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_sbn_speed_test.py to mkl_sbn_speed_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_sbn_op_test.py to mkl_sbn_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_fc_op_test.py to mkl_fc_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_relu_op_test.py to mkl_relu_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_elementwise_sum_op_test.py to mkl_elementwise_sum_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_concat_op_test.py to mkl_concat_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_LRN_speed_test.py to mkl_LRN_speed_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_conv_op_test.py to mkl_conv_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_LRN_op_test.py to mkl_LRN_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/mkl/mkl_squeeze_op_test.py to mkl_squeeze_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/nomnigraph_transformations.py to nomnigraph_transformations.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/docs/parser.py to parser.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/docs/generator.py to generator.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/docs/github.py to github.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/docs/formatter.py to formatter.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/docs/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/model_helper_test.py to model_helper_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/data_parallel_model.py to data_parallel_model.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/core.py to core.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/workspace_test.py to workspace_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/normalizer_test.py to normalizer_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/hsm_util.py to hsm_util.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/schema.py to schema.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/caffe_translator_test.py to caffe_translator_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/hypothesis_test_util.py to hypothesis_test_util.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/python/parallel_workers.py to parallel_workers.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/script/examples/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/script/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/prof/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/prof/cuda_profile_ops_test.py to cuda_profile_ops_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/gloo/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/gloo/gloo_test.py to gloo_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/aten/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/aten/gen_op.py to gen_op.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/aten/aten_test.py to aten_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/aten/docs/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/aten/docs/sample.py to sample.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/warpctc/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/warpctc/ctc_ops_test.py to ctc_ops_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/nccl/nccl_ops_test.py to nccl_ops_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/nccl/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/nnpack/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/nnpack/nnpack_ops_test.py to nnpack_ops_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/tensorboard/tensorboard_exporter.py to tensorboard_exporter.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/tensorboard/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/tensorboard/tensorboard_test.py to tensorboard_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/tensorboard/tensorboard.py to tensorboard.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/tensorboard/tensorboard_exporter_test.py to tensorboard_exporter_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/output_generator.py to output_generator.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/compute_topk_accuracy.py to compute_topk_accuracy.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/ModuleRegister.py to ModuleRegister.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/gfs_IN1k.py to gfs_IN1k.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/override_no_test_model_no_checkpoint.py to override_no_test_model_no_checkpoint.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/IN1k_resnet_no_test_model.py to IN1k_resnet_no_test_model.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/explicit_resnet_param_update.py to explicit_resnet_param_update.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/IN1k_resnet.py to IN1k_resnet.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/rendezvous_filestore.py to rendezvous_filestore.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/caffe2_resnet50_default_param_update.py to caffe2_resnet50_default_param_update.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/caffe2_resnet50_default_forward.py to caffe2_resnet50_default_forward.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/resnetdemo/explicit_resnet_forward.py to explicit_resnet_forward.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/meter.py to meter.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/AnyExp.py to AnyExp.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/module_map.py to module_map.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/AnyExpOnTerm.py to AnyExpOnTerm.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/compute_loss.py to compute_loss.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/contrib/playground/checkpoint.py to checkpoint.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/sparse_reshape_op_test.py to sparse_reshape_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/convnet_benchmarks.py to convnet_benchmarks.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/sparse_funhash_op_test.py to sparse_funhash_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/SparseTransformer.py to SparseTransformer.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/tt_contraction_op_test.py to tt_contraction_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/net_construct_bench.py to net_construct_bench.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/device_reduce_sum_bench.py to device_reduce_sum_bench.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/tt_pad_op_test.py to tt_pad_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/python/funhash_op_test.py to funhash_op_test.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/experiments/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/metanet_pb2.py to metanet_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/predictor_consts_pb2.py to predictor_consts_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/caffe2_legacy_pb2.py to caffe2_legacy_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/torch_pb2.py to torch_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/caffe2_pb2.py to caffe2_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/hsm_pb2.py to hsm_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/proto/prof_dag_pb2.py to prof_dag_pb2.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/perfkernels/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/perfkernels/hp_emblookup_codegen.py to hp_emblookup_codegen.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/core/nomnigraph/__init__.py to __init__.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/core/nomnigraph/op_gen.py to op_gen.cpython-36.pyc byte-compiling /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/caffe2/core/__init__.py to __init__.cpython-36.pyc running install_egg_info running egg_info creating torch.egg-info writing torch.egg-info/PKG-INFO writing dependency_links to torch.egg-info/dependency_links.txt writing entry points to torch.egg-info/entry_points.txt writing top-level names to torch.egg-info/top_level.txt writing manifest file 'torch.egg-info/SOURCES.txt' reading manifest file 'torch.egg-info/SOURCES.txt' writing manifest file 'torch.egg-info/SOURCES.txt' Copying torch.egg-info to /home/star/anaconda3/envs/wind2/lib/python3.6/site-packages/torch-1.4.0a0+39297bf-py3.6.egg-info running install_scripts Installing convert-caffe2-to-onnx script to /home/star/anaconda3/envs/wind2/bin Installing convert-onnx-to-caffe2 script to /home/star/anaconda3/envs/wind2/bin (wind2) star@xmatrix:~/PyTorch/pytorch$ (wind2) star@xmatrix:~/PyTorch/pytorch$

安装完毕

(wind2) star@xmatrix:~/PyTorch/pytorch$ 
(wind2) star@xmatrix:~/PyTorch/pytorch$ python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> import caffe2
>>> 
>>> 
>>> exit();
(wind2) star@xmatrix:~/PyTorch/pytorch$ 
(wind2) star@xmatrix:~/PyTorch/pytorch$ 
(wind2) star@xmatrix:~/PyTorch/pytorch$ 
(wind2) star@xmatrix:~/PyTorch/pytorch$ 

参考:https://blog.csdn.net/jyh_ai/article/details/85542866

https://github.com/pytorch/pytorch

猜你喜欢

转载自www.cnblogs.com/herd/p/12126524.html