From bda1e062b7843d0d9a088d57d0efe8223ebf7557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 11:46:56 +0100 Subject: [PATCH 1/9] Create VERSIONING_ISSUES.md --- knowledge_base/VERSIONING_ISSUES.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 knowledge_base/VERSIONING_ISSUES.md diff --git a/knowledge_base/VERSIONING_ISSUES.md b/knowledge_base/VERSIONING_ISSUES.md new file mode 100644 index 00000000000..01627dfd4bb --- /dev/null +++ b/knowledge_base/VERSIONING_ISSUES.md @@ -0,0 +1,25 @@ +# Versioning Issues + +## Pytorch version +This issue is related to https://github.com/pytorch/rl/issues/689. Using PyTorch versions lower < 1.13 and installing stable package leads to the following error: +``` +ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb +``` +This is probably due to some incompatibility (tensor casting?) of torch C++ bindings between version 1.12 and 1.13. + + +### How to reproduce +1. Create an Colab Notebook (at 24/11/2022 Colab enviroment has Python 3.7 and Pytorch 1.12 installed by default). +2. ``` !pip install torchrl ``` +3. ``` import torchrl ``` + +### Workarounds +1. Install torch 1.13 or above. +2. Install latest version of functorch. This version depends on torch 1.13 and will install it for you. + + ``` pip install functorch ``` +3. If you need to keep you current torch version, install from source. + + ``` pip install git+https://github.com/pytorch/rl@ ``` + + From 7524d711c82de68286cbbdc26ef76db010967809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 11:57:50 +0100 Subject: [PATCH 2/9] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 194472a3736..7d05157ce81 100644 --- a/README.md +++ b/README.md @@ -489,6 +489,8 @@ python -c 'from torchrl.envs.libs.gym import GymEnv' ``` If this is the case, consider executing torchrl from another location. + + On **MacOs**, we recommend installing XCode first. With Apple Silicon M1 chips, make sure you are using the arm64-built python (e.g. [here](https://betterprogramming.pub/how-to-install-pytorch-on-apple-m1-series-512b3ad9bc6)). Running the following lines of code @@ -506,6 +508,10 @@ and not OS: macOS **** (x86_64) ``` +If you successfully install and you have a ```ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb``` when you try to import the module, most probably this is caused by an incompatibility with your torch package. +Please install torch 1.13 or build the library from source. Please refer to [versioning issues](knowledge_base/VERSIONING_ISSUES.md) for a complete explanation. + + ## Running examples Examples are coded in a very similar way but the configuration may change from one algorithm to another (e.g. async/sync data collection, hyperparameters, ratio of model updates / frame etc.) From 35de973c88a857bbce4a13ffb9ca40a2ec9a8d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 11:59:21 +0100 Subject: [PATCH 3/9] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 7d05157ce81..700ef13a84d 100644 --- a/README.md +++ b/README.md @@ -489,8 +489,6 @@ python -c 'from torchrl.envs.libs.gym import GymEnv' ``` If this is the case, consider executing torchrl from another location. - - On **MacOs**, we recommend installing XCode first. With Apple Silicon M1 chips, make sure you are using the arm64-built python (e.g. [here](https://betterprogramming.pub/how-to-install-pytorch-on-apple-m1-series-512b3ad9bc6)). Running the following lines of code @@ -509,7 +507,7 @@ OS: macOS **** (x86_64) ``` If you successfully install and you have a ```ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb``` when you try to import the module, most probably this is caused by an incompatibility with your torch package. -Please install torch 1.13 or build the library from source. Please refer to [versioning issues](knowledge_base/VERSIONING_ISSUES.md) for a complete explanation. +Please install torch 1.13 or build the library from source. Please refer to this [versioning issues document](knowledge_base/VERSIONING_ISSUES.md) for a complete explanation. ## Running examples From ec0a1079f5890bdbb0a2447de1b5526b7ce99a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 12:20:56 +0100 Subject: [PATCH 4/9] Update VERSIONING_ISSUES.md --- knowledge_base/VERSIONING_ISSUES.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/knowledge_base/VERSIONING_ISSUES.md b/knowledge_base/VERSIONING_ISSUES.md index 01627dfd4bb..fb5ddfce488 100644 --- a/knowledge_base/VERSIONING_ISSUES.md +++ b/knowledge_base/VERSIONING_ISSUES.md @@ -21,5 +21,3 @@ This is probably due to some incompatibility (tensor casting?) of torch C++ bind 3. If you need to keep you current torch version, install from source. ``` pip install git+https://github.com/pytorch/rl@ ``` - - From 2823e922131e67541423f081cb7c807bd0d3f313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 17:29:16 +0100 Subject: [PATCH 5/9] Update VERSIONING_ISSUES.md --- knowledge_base/VERSIONING_ISSUES.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/knowledge_base/VERSIONING_ISSUES.md b/knowledge_base/VERSIONING_ISSUES.md index fb5ddfce488..5725df8cba6 100644 --- a/knowledge_base/VERSIONING_ISSUES.md +++ b/knowledge_base/VERSIONING_ISSUES.md @@ -1,7 +1,7 @@ # Versioning Issues ## Pytorch version -This issue is related to https://github.com/pytorch/rl/issues/689. Using PyTorch versions lower < 1.13 and installing stable package leads to the following error: +This issue is related to https://github.com/pytorch/rl/issues/689. Using PyTorch versions <1.13 and installing stable package leads to undefined symbol errors. For example: ``` ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb ``` @@ -13,11 +13,14 @@ This is probably due to some incompatibility (tensor casting?) of torch C++ bind 2. ``` !pip install torchrl ``` 3. ``` import torchrl ``` -### Workarounds -1. Install torch 1.13 or above. -2. Install latest version of functorch. This version depends on torch 1.13 and will install it for you. - - ``` pip install functorch ``` -3. If you need to keep you current torch version, install from source. +On Colab you can solve the issue by running: +``` +!pip3 install torch --extra-index-url https://download.pytorch.org/whl/cpu -U +``` +before the ```!pip install torchrl``` command. This will install the latest pytorch. Instructions can be found [here](https://pytorch.org/get-started/locally/). - ``` pip install git+https://github.com/pytorch/rl@ ``` +### Workarounds +There are two workarounds to this issue +1. Install/upgrade to the latest pytorch release before installing torchrl. +2. If you need to use a previous pytorch relase: Install functorch version related to your torch distribution: e.g. ``` pip install functorch==0.2.0 ``` + and install library from source ``` pip install git+https://github.com/pytorch/rl@ ```. From 89d58dc7291fba27921a63d720fed16e3936ece0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 17:30:36 +0100 Subject: [PATCH 6/9] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 700ef13a84d..946d202e62e 100644 --- a/README.md +++ b/README.md @@ -506,8 +506,7 @@ and not OS: macOS **** (x86_64) ``` -If you successfully install and you have a ```ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb``` when you try to import the module, most probably this is caused by an incompatibility with your torch package. -Please install torch 1.13 or build the library from source. Please refer to this [versioning issues document](knowledge_base/VERSIONING_ISSUES.md) for a complete explanation. +Versioning issues can cause error message of the type ```undefined symbol``` and such. For these, refer to the [versioning issues document](knowledge_base/VERSIONING_ISSUES.md) for a complete explanation and proposed workarounds. ## Running examples From 36ffd792c1582ba497034e4cb7ee3638ff61fc31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 17:32:03 +0100 Subject: [PATCH 7/9] Update VERSIONING_ISSUES.md --- knowledge_base/VERSIONING_ISSUES.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/knowledge_base/VERSIONING_ISSUES.md b/knowledge_base/VERSIONING_ISSUES.md index 5725df8cba6..db002127797 100644 --- a/knowledge_base/VERSIONING_ISSUES.md +++ b/knowledge_base/VERSIONING_ISSUES.md @@ -5,8 +5,6 @@ This issue is related to https://github.com/pytorch/rl/issues/689. Using PyTorch ``` ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb ``` -This is probably due to some incompatibility (tensor casting?) of torch C++ bindings between version 1.12 and 1.13. - ### How to reproduce 1. Create an Colab Notebook (at 24/11/2022 Colab enviroment has Python 3.7 and Pytorch 1.12 installed by default). From 9e9618c0dcf2ddeec1e9b67617018d30d7b225d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 17:32:37 +0100 Subject: [PATCH 8/9] Update VERSIONING_ISSUES.md --- knowledge_base/VERSIONING_ISSUES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge_base/VERSIONING_ISSUES.md b/knowledge_base/VERSIONING_ISSUES.md index db002127797..28fa2d09c4a 100644 --- a/knowledge_base/VERSIONING_ISSUES.md +++ b/knowledge_base/VERSIONING_ISSUES.md @@ -11,7 +11,7 @@ ImportError: /usr/local/lib/python3.7/dist-packages/torchrl/_torchrl.so: undefin 2. ``` !pip install torchrl ``` 3. ``` import torchrl ``` -On Colab you can solve the issue by running: +In Colab you can solve the issue by running: ``` !pip3 install torch --extra-index-url https://download.pytorch.org/whl/cpu -U ``` From ecd59aac5f3bc3122c47e4610e5da9eb4f330d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=20Pellican=C3=B2?= Date: Thu, 24 Nov 2022 17:33:53 +0100 Subject: [PATCH 9/9] Update VERSIONING_ISSUES.md --- knowledge_base/VERSIONING_ISSUES.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/knowledge_base/VERSIONING_ISSUES.md b/knowledge_base/VERSIONING_ISSUES.md index 28fa2d09c4a..2a80aecddf3 100644 --- a/knowledge_base/VERSIONING_ISSUES.md +++ b/knowledge_base/VERSIONING_ISSUES.md @@ -20,5 +20,4 @@ before the ```!pip install torchrl``` command. This will install the latest pyto ### Workarounds There are two workarounds to this issue 1. Install/upgrade to the latest pytorch release before installing torchrl. -2. If you need to use a previous pytorch relase: Install functorch version related to your torch distribution: e.g. ``` pip install functorch==0.2.0 ``` - and install library from source ``` pip install git+https://github.com/pytorch/rl@ ```. +2. If you need to use a previous pytorch relase: Install functorch version related to your torch distribution: e.g. ``` pip install functorch==0.2.0 ``` and install library from source ``` pip install git+https://github.com/pytorch/rl@ ```.