google-research / robotics_transformer

Apache License 2.0
1.29k stars 148 forks source link

Error installing requirements.txt ( tensor2robot ) #1

Open traversaro opened 1 year ago

traversaro commented 1 year ago

Hello, thanks a lot for sharing the code related to this interesting research!

I tried to follow the instructions in the README, and I have problem in the pip install -r robotics_transformer/requirements.txt step. In particular, I tried with Python 3.11, 3.10, 3.8 and 3.6, and it is failing. Which version of Python should be used? Thanks a lot in advance.

The errors are listed in the following.

Python 3.8

(robtrans) traversaro@IITICUBLAP257:~/robotics_transformer$ pip install -r ./requirements.txt
Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r ./requirements.txt (line 9))
  Cloning https://github.com/google-research/tensor2robot to /tmp/pip-req-build-w12cm8j5
  Running command git clone --filter=blob:none --quiet https://github.com/google-research/tensor2robot /tmp/pip-req-build-w12cm8j5
  Resolved https://github.com/google-research/tensor2robot to commit 8fbc4d696f35ce44a63841cae13f26af6c334004
ERROR: git+https://github.com/google-research/tensor2robot#tensor2robot (from -r ./requirements.txt (line 9)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

Python 3.10

(robtrans) traversaro@IITICUBLAP257:~/robotics_transformer$ pip install -r ./requirements.txt
Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r ./requirements.txt (line 9))
  Cloning https://github.com/google-research/tensor2robot to /tmp/pip-req-build-w12cm8j5
  Running command git clone --filter=blob:none --quiet https://github.com/google-research/tensor2robot /tmp/pip-req-build-w12cm8j5
  Resolved https://github.com/google-research/tensor2robot to commit 8fbc4d696f35ce44a63841cae13f26af6c334004
ERROR: git+https://github.com/google-research/tensor2robot#tensor2robot (from -r ./requirements.txt (line 9)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

Python 3.6

(robtrans) traversaro@IITICUBLAP257:~$ pip install -r robotics_transformer/requirements.txt
Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r robotics_transformer/requirements.txt (line 9))
  Cloning https://github.com/google-research/tensor2robot to /tmp/pip-um6_0r33-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-um6_0r33-build/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-um6_0r33-build/
fxia22 commented 1 year ago

Do you mind trying install tensor2robot following the instruction in https://github.com/google-research/tensor2robot#tensor2robot and then install this repo? (maybe comment out the tensor2robot dependency).

Thanks

traversaro commented 1 year ago

I tried, using a venv on Ubuntu 22.04 with Python 3.10, and cloing this repo and https://github.com/google-research/tensor2robot in a directory named ~/ws . I have the following failures:

protoc failure

The protoc command:

(venv) traversaro@IITICUBLAP257:~/ws/tensor2robot/proto$ protoc -I=./ --python_out=`pwd` tensor2robot/t2r.proto
Could not make proto path relative: tensor2robot/t2r.proto: No such file or directory

Indeed, in ~/ws/tensor2robot/proto there is only a t2r.proto file, not a tensor2robot/t2r.proto . Changing the command to protoc -I=./ --python_out=pwdt2r.proto. However, it is worth noting that the protoc used is the one of the system, that is not the same version installed pip, i.e.:

(venv) traversaro@IITICUBLAP257:~/ws/tensor2robot/proto$ which protoc
/usr/bin/protoc
(venv) traversaro@IITICUBLAP257:~/ws/tensor2robot/proto$ protoc --version
libprotoc 3.12.4
(venv) traversaro@IITICUBLAP257:~/ws/tensor2robot/proto$ pip list --verbose | grep proto
protobuf                     3.19.6    /home/traversaro/ws/venv/lib/python3.10/site-packages pip

tensorflow.contrib failure

After this, the command python -m tensor2robot.research.pose_env.pose_env_models_test fails:

  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/traversaro/ws/tensor2robot/research/pose_env/pose_env_models_test.py", line 23, in <module>
    from tensor2robot.input_generators import default_input_generator
  File "/home/traversaro/ws/tensor2robot/input_generators/__init__.py", line 17, in <module>
    from tensor2robot.input_generators import abstract_input_generator
  File "/home/traversaro/ws/tensor2robot/input_generators/abstract_input_generator.py", line 25, in <module>
    from tensor2robot.models import abstract_model
  File "/home/traversaro/ws/tensor2robot/models/abstract_model.py", line 28, in <module>
    from tensor2robot.models import model_interface
  File "/home/traversaro/ws/tensor2robot/models/model_interface.py", line 33, in <module>
    from tensor2robot.preprocessors import abstract_preprocessor
  File "/home/traversaro/ws/tensor2robot/preprocessors/__init__.py", line 17, in <module>
    from tensor2robot.preprocessors import abstract_preprocessor
  File "/home/traversaro/ws/tensor2robot/preprocessors/abstract_preprocessor.py", line 22, in <module>
    from tensor2robot.utils import tensorspec_utils
  File "/home/traversaro/ws/tensor2robot/utils/tensorspec_utils.py", line 31, in <module>
    from tensorflow.contrib import framework as contrib_framework
ModuleNotFoundError: No module named 'tensorflow.contrib'
(venv) traversaro@IITICUBLAP257:~/ws$ python -m tensor2robot.research.pose_env.pose_env_models_test

Perhaps tensorflow 1.x is required?

If I ignore the previous command failure and I go ahead and install the requirements of the robotics_transformer repo, the error is similar:

  File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/home/traversaro/ws/robotics_transformer/tokenizers/action_tokenizer.py", line 35, in <module>
    from tensor2robot.utils import tensorspec_utils
  File "/home/traversaro/ws/tensor2robot/utils/tensorspec_utils.py", line 31, in <module>
    from tensorflow.contrib import framework as contrib_framework
ModuleNotFoundError: No module named 'tensorflow.contrib'

For reproducibility, my pip list is:

(venv) traversaro@IITICUBLAP257:~/ws$ pip list --verbose
Package                      Version   Location                                              Installer
---------------------------- --------- ----------------------------------------------------- ---------
absl-py                      1.3.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
astunparse                   1.6.3     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
cachetools                   5.2.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
certifi                      2022.12.7 /home/traversaro/ws/venv/lib/python3.10/site-packages pip
charset-normalizer           2.1.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
cloudpickle                  2.2.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
decorator                    5.1.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
dm-tree                      0.1.7     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
flatbuffers                  22.12.6   /home/traversaro/ws/venv/lib/python3.10/site-packages pip
gast                         0.4.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
gin-config                   0.5.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
google-auth                  2.15.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
google-auth-oauthlib         0.4.6     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
google-pasta                 0.2.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
grpcio                       1.51.1    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
gym                          0.23.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
gym-notices                  0.0.8     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
h5py                         3.7.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
idna                         3.4       /home/traversaro/ws/venv/lib/python3.10/site-packages pip
keras                        2.11.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
libclang                     14.0.6    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
Markdown                     3.4.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
MarkupSafe                   2.1.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
numpy                        1.23.5    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
oauthlib                     3.2.2     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
opt-einsum                   3.3.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
packaging                    22.0      /home/traversaro/ws/venv/lib/python3.10/site-packages pip
Pillow                       5.3.0     /home/traversaro/ws/venv/lib/python3.10/site-packages
pip                          22.0.2    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
protobuf                     3.19.6    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
pyasn1                       0.4.8     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
pyasn1-modules               0.2.8     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
pybullet                     2.5.0     /home/traversaro/ws/venv/lib/python3.10/site-packages
pygame                       2.1.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
requests                     2.28.1    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
requests-oauthlib            1.3.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
rsa                          4.9       /home/traversaro/ws/venv/lib/python3.10/site-packages pip
setuptools                   59.6.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
six                          1.16.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorboard                  2.11.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorboard-data-server      0.6.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorboard-plugin-wit       1.8.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorflow                   2.11.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorflow-estimator         2.11.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorflow-io-gcs-filesystem 0.28.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorflow-probability       0.19.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tensorflow-serving-api       2.11.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
termcolor                    2.1.1     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tf-agents                    0.15.0    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
tf-slim                      1.1.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
typing_extensions            4.4.0     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
urllib3                      1.26.13   /home/traversaro/ws/venv/lib/python3.10/site-packages pip
Werkzeug                     2.2.2     /home/traversaro/ws/venv/lib/python3.10/site-packages pip
wheel                        0.38.4    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
wrapt                        1.14.1    /home/traversaro/ws/venv/lib/python3.10/site-packages pip
traversaro commented 1 year ago

I also installed a dedicated Python 3.7 to be able to install a Tensorflow 1.* from PyPI, but even in that case the test fail, even if with a different error:

(robtranpy37) traversaro@IITICUBLAP257:~/ws$ python -m robotics_transformer.tokenizers.action_tokenizer.test
Traceback (most recent call last):
  File "/home/traversaro/mambaforge/envs/robtranpy37/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/traversaro/mambaforge/envs/robtranpy37/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/traversaro/ws/robotics_transformer/tokenizers/action_tokenizer.py", line 39, in <module>
    class RT1ActionTokenizer:
  File "/home/traversaro/ws/robotics_transformer/tokenizers/action_tokenizer.py", line 45, in RT1ActionTokenizer
    action_order: Optional[list[str]] = None):
TypeError: 'type' object is not subscriptable

Environment for reproducibility:

~~~ (robtranpy37) traversaro@IITICUBLAP257:~/ws$ mamba list # packages in environment at /home/traversaro/mambaforge/envs/robtranpy37: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge absl-py 1.3.0 pypi_0 pypi astor 0.8.1 pypi_0 pypi astunparse 1.6.3 pypi_0 pypi ca-certificates 2022.12.7 ha878542_0 conda-forge cachetools 5.2.0 pypi_0 pypi certifi 2022.12.7 pypi_0 pypi charset-normalizer 2.1.1 pypi_0 pypi cloudpickle 2.2.0 pypi_0 pypi decorator 5.1.1 pypi_0 pypi dm-tree 0.1.7 pypi_0 pypi flatbuffers 22.12.6 pypi_0 pypi gast 0.2.2 pypi_0 pypi gin-config 0.5.0 pypi_0 pypi google-auth 2.15.0 pypi_0 pypi google-auth-oauthlib 0.4.6 pypi_0 pypi google-pasta 0.2.0 pypi_0 pypi grpcio 1.51.1 pypi_0 pypi gym 0.26.2 pypi_0 pypi gym-notices 0.0.8 pypi_0 pypi h5py 2.10.0 pypi_0 pypi idna 3.4 pypi_0 pypi importlib-metadata 5.1.0 pypi_0 pypi keras 2.11.0 pypi_0 pypi keras-applications 1.0.8 pypi_0 pypi keras-preprocessing 1.1.2 pypi_0 pypi ld_impl_linux-64 2.39 hcc3a1bd_1 conda-forge libclang 14.0.6 pypi_0 pypi libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 12.2.0 h65d4601_19 conda-forge libgomp 12.2.0 h65d4601_19 conda-forge libnsl 2.0.0 h7f98852_0 conda-forge libsqlite 3.40.0 h753d276_0 conda-forge libstdcxx-ng 12.2.0 h46fd767_19 conda-forge libzlib 1.2.13 h166bdaf_4 conda-forge markdown 3.4.1 pypi_0 pypi markupsafe 2.1.1 pypi_0 pypi ncurses 6.3 h27087fc_1 conda-forge numpy 1.18.5 pypi_0 pypi oauthlib 3.2.2 pypi_0 pypi openssl 3.0.7 h0b41bf4_1 conda-forge opt-einsum 3.3.0 pypi_0 pypi packaging 22.0 pypi_0 pypi pillow 5.3.0 pypi_0 pypi pip 22.3.1 pyhd8ed1ab_0 conda-forge protobuf 3.19.6 pypi_0 pypi pyasn1 0.4.8 pypi_0 pypi pyasn1-modules 0.2.8 pypi_0 pypi pybullet 2.5.0 pypi_0 pypi python 3.7.12 hf930737_100_cpython conda-forge readline 8.1.2 h0f457ee_0 conda-forge requests 2.28.1 pypi_0 pypi requests-oauthlib 1.3.1 pypi_0 pypi rsa 4.9 pypi_0 pypi setuptools 65.5.1 pyhd8ed1ab_0 conda-forge six 1.16.0 pypi_0 pypi sqlite 3.40.0 h4ff8645_0 conda-forge tensorboard 1.15.0 pypi_0 pypi tensorboard-data-server 0.6.1 pypi_0 pypi tensorboard-plugin-wit 1.8.1 pypi_0 pypi tensorflow 1.15.5 pypi_0 pypi tensorflow-estimator 1.15.1 pypi_0 pypi tensorflow-io-gcs-filesystem 0.28.0 pypi_0 pypi tensorflow-probability 0.9.0 pypi_0 pypi tensorflow-serving-api 1.15.0 pypi_0 pypi termcolor 2.1.1 pypi_0 pypi tf-slim 1.1.0 pypi_0 pypi tk 8.6.12 h27826a3_0 conda-forge typing-extensions 4.4.0 pypi_0 pypi urllib3 1.26.13 pypi_0 pypi werkzeug 2.2.2 pypi_0 pypi wheel 0.38.4 pyhd8ed1ab_0 conda-forge wrapt 1.14.1 pypi_0 pypi xz 5.2.6 h166bdaf_0 conda-forge zipp 3.11.0 pypi_0 pypi ~~~
darknight-007 commented 1 year ago

I am also getting a similar error on Python 3.8 as posted by @traversaro. Thanks for the suggestion @fxia22 , will try to install tensor2robot first.

Ubuntu 20.04.5 LTS Python 3.8.10

Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r robotics_transformer/requirements.txt (line 9)) Cloning https://github.com/google-research/tensor2robot to /tmp/pip-req-build-47fa_fgz Running command git clone -q https://github.com/google-research/tensor2robot /tmp/pip-req-build-47fa_fgz ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-47fa_fgz/setup.py'"'"'; file='"'"'/tmp/pip-req-build-47fa_fgz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-47fa_fgz/pip-egg-info cwd: /tmp/pip-req-build-47fa_fgz/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.8/tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-47fa_fgz/setup.py'

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

FredaZero commented 1 year ago

Hi, don't know if you have solved the problem now, I tried to install tensor2robot and robotics_transformer separately on Python3.7 with Tensorflow 1.14, but it still has an error. It imported tensorflow_probability somewhere in the model, which means it requires Tensorflow version >= 2.11. That's a conflict.

AliBuildsAI commented 1 year ago

@traversaro may I ask if you could solve your problem? I am getting the exact errors as you on both tf2 and tf1.15

oym1994 commented 1 year ago

Hi, have u solved this problem? I also get the same error "TypeError: 'type' object is not subscriptable "

traversaro commented 1 year ago

@traversaro may I ask if you could solve your problem? I am getting the exact errors as you on both tf2 and tf1.15

No, I was not able to solve the problem. I suspect the code in this repo is actually a mixture of of some code that was meant to work with tensorflow1 and some other code that was meant to work with tensorflow2, but I never investigated further.

paolo-viceconte commented 1 year ago

Hi, I tried to install your software by following the guidelines in the README and I also encountered issues when running pip install -r robotics_transformer/requirements.txt:

Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r robotics_transformer/requirements.txt (line 9))
  Cloning https://github.com/google-research/tensor2robot to /tmp/pip-req-build-bizawiii
  Running command git clone -q https://github.com/google-research/tensor2robot /tmp/pip-req-build-bizawiii
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-bizawiii/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-bizawiii/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-bizawiii/pip-egg-info
         cwd: /tmp/pip-req-build-bizawiii/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.8/tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-bizawiii/setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Therefore, I tried to install tensor2robot separately as suggested in https://github.com/google-research/robotics_transformer/issues/1#issuecomment-1349580393 and:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pviceconte/git/tensor2robot/research/pose_env/pose_env_models_test.py", line 23, in <module>
    from tensor2robot.input_generators import default_input_generator
  File "/home/pviceconte/git/tensor2robot/input_generators/__init__.py", line 17, in <module>
    from tensor2robot.input_generators import abstract_input_generator
  File "/home/pviceconte/git/tensor2robot/input_generators/abstract_input_generator.py", line 25, in <module>
    from tensor2robot.models import abstract_model
  File "/home/pviceconte/git/tensor2robot/models/abstract_model.py", line 28, in <module>
    from tensor2robot.models import model_interface
  File "/home/pviceconte/git/tensor2robot/models/model_interface.py", line 33, in <module>
    from tensor2robot.preprocessors import abstract_preprocessor
  File "/home/pviceconte/git/tensor2robot/preprocessors/__init__.py", line 17, in <module>
    from tensor2robot.preprocessors import abstract_preprocessor
  File "/home/pviceconte/git/tensor2robot/preprocessors/abstract_preprocessor.py", line 22, in <module>
    from tensor2robot.utils import tensorspec_utils
  File "/home/pviceconte/git/tensor2robot/utils/tensorspec_utils.py", line 31, in <module>
    from tensorflow.contrib import framework as contrib_framework
ModuleNotFoundError: No module named 'tensorflow.contrib'

For further context, I am using Python 3.8 on Ubuntu 20.04, and here you have my pip list --verbose output:

`pip list --verbose` output ``` Package Version Location Installer ---------------------------- -------------------- --------------------------------------------------- --------- absl-py 1.4.0 /home/pviceconte/.local/lib/python3.8/site-packages pip argcomplete 2.0.0 /usr/local/lib/python3.8/dist-packages pip astunparse 1.6.3 /home/pviceconte/.local/lib/python3.8/site-packages pip attrs 21.4.0 /usr/local/lib/python3.8/dist-packages pip cachetools 5.3.1 /home/pviceconte/.local/lib/python3.8/site-packages pip catkin-pkg 0.4.24 /usr/local/lib/python3.8/dist-packages pip certifi 2019.11.28 /usr/lib/python3/dist-packages chardet 3.0.4 /usr/lib/python3/dist-packages cloudpickle 2.2.1 /home/pviceconte/.local/lib/python3.8/site-packages pip colcon-argcomplete 0.3.3 /usr/local/lib/python3.8/dist-packages pip colcon-bash 0.4.2 /usr/local/lib/python3.8/dist-packages pip colcon-cd 0.1.1 /usr/local/lib/python3.8/dist-packages pip colcon-cmake 0.2.26 /usr/local/lib/python3.8/dist-packages pip colcon-common-extensions 0.2.1 /usr/local/lib/python3.8/dist-packages pip colcon-core 0.8.2 /usr/local/lib/python3.8/dist-packages pip colcon-defaults 0.2.6 /usr/local/lib/python3.8/dist-packages pip colcon-devtools 0.2.3 /usr/local/lib/python3.8/dist-packages pip colcon-library-path 0.2.1 /usr/local/lib/python3.8/dist-packages pip colcon-metadata 0.2.5 /usr/local/lib/python3.8/dist-packages pip colcon-notification 0.2.13 /usr/local/lib/python3.8/dist-packages pip colcon-output 0.2.12 /usr/local/lib/python3.8/dist-packages pip colcon-package-information 0.3.3 /usr/local/lib/python3.8/dist-packages pip colcon-package-selection 0.2.10 /usr/local/lib/python3.8/dist-packages pip colcon-parallel-executor 0.2.4 /usr/local/lib/python3.8/dist-packages pip colcon-pkg-config 0.1.0 /usr/local/lib/python3.8/dist-packages pip colcon-powershell 0.3.7 /usr/local/lib/python3.8/dist-packages pip colcon-python-setup-py 0.2.7 /usr/local/lib/python3.8/dist-packages pip colcon-recursive-crawl 0.2.1 /usr/local/lib/python3.8/dist-packages pip colcon-ros 0.3.23 /usr/local/lib/python3.8/dist-packages pip colcon-test-result 0.3.8 /usr/local/lib/python3.8/dist-packages pip colcon-zsh 0.4.0 /usr/local/lib/python3.8/dist-packages pip coverage 6.3.2 /usr/local/lib/python3.8/dist-packages pip dbus-python 1.2.16 /usr/lib/python3/dist-packages decorator 5.1.1 /home/pviceconte/.local/lib/python3.8/site-packages pip distlib 0.3.4 /usr/local/lib/python3.8/dist-packages pip dm-tree 0.1.8 /home/pviceconte/.local/lib/python3.8/site-packages pip docutils 0.18.1 /usr/local/lib/python3.8/dist-packages pip empy 3.3.4 /usr/local/lib/python3.8/dist-packages pip flatbuffers 23.5.26 /home/pviceconte/.local/lib/python3.8/site-packages pip gast 0.4.0 /home/pviceconte/.local/lib/python3.8/site-packages pip gin-config 0.5.0 /home/pviceconte/.local/lib/python3.8/site-packages pip google-auth 2.22.0 /home/pviceconte/.local/lib/python3.8/site-packages pip google-auth-oauthlib 1.0.0 /home/pviceconte/.local/lib/python3.8/site-packages pip google-pasta 0.2.0 /home/pviceconte/.local/lib/python3.8/site-packages pip grpcio 1.56.0 /home/pviceconte/.local/lib/python3.8/site-packages pip gym 0.26.2 /home/pviceconte/.local/lib/python3.8/site-packages pip gym-notices 0.0.8 /home/pviceconte/.local/lib/python3.8/site-packages pip h5py 3.9.0 /home/pviceconte/.local/lib/python3.8/site-packages pip idna 2.8 /usr/lib/python3/dist-packages importlib-metadata 6.8.0 /home/pviceconte/.local/lib/python3.8/site-packages pip iniconfig 1.1.1 /usr/local/lib/python3.8/dist-packages pip keras 2.13.1 /home/pviceconte/.local/lib/python3.8/site-packages pip libclang 16.0.6 /home/pviceconte/.local/lib/python3.8/site-packages pip Markdown 3.4.3 /home/pviceconte/.local/lib/python3.8/site-packages pip MarkupSafe 2.1.3 /home/pviceconte/.local/lib/python3.8/site-packages pip notify2 0.3.1 /usr/local/lib/python3.8/dist-packages pip numpy 1.22.0 /home/pviceconte/.local/lib/python3.8/site-packages pip oauthlib 3.2.2 /home/pviceconte/.local/lib/python3.8/site-packages pip opt-einsum 3.3.0 /home/pviceconte/.local/lib/python3.8/site-packages pip packaging 21.3 /usr/local/lib/python3.8/dist-packages pip Pillow 5.3.0 /home/pviceconte/.local/lib/python3.8/site-packages pip pip 20.0.2 /usr/lib/python3/dist-packages pluggy 1.0.0 /usr/local/lib/python3.8/dist-packages pip protobuf 4.23.4 /home/pviceconte/.local/lib/python3.8/site-packages pip py 1.11.0 /usr/local/lib/python3.8/dist-packages pip pyasn1 0.5.0 /home/pviceconte/.local/lib/python3.8/site-packages pip pyasn1-modules 0.3.0 /home/pviceconte/.local/lib/python3.8/site-packages pip pybullet 2.5.0 /home/pviceconte/.local/lib/python3.8/site-packages pip Pygments 2.3.1 /usr/lib/python3/dist-packages PyGObject 3.36.0 /usr/lib/python3/dist-packages pyparsing 3.0.8 /usr/local/lib/python3.8/dist-packages pip pytest 7.1.2 /usr/local/lib/python3.8/dist-packages pip pytest-cov 3.0.0 /usr/local/lib/python3.8/dist-packages pip pytest-repeat 0.9.1 /usr/local/lib/python3.8/dist-packages pip pytest-rerunfailures 10.2 /usr/local/lib/python3.8/dist-packages pip python-apt 2.0.0+ubuntu0.20.4.7 /usr/lib/python3/dist-packages python-dateutil 2.7.3 /usr/lib/python3/dist-packages PyYAML 5.3.1 /usr/lib/python3/dist-packages requests 2.22.0 /usr/lib/python3/dist-packages requests-oauthlib 1.3.1 /home/pviceconte/.local/lib/python3.8/site-packages pip requests-unixsocket 0.2.0 /usr/lib/python3/dist-packages rsa 4.9 /home/pviceconte/.local/lib/python3.8/site-packages pip setuptools 45.2.0 /usr/lib/python3/dist-packages setuptools-scm 6.4.2 /usr/local/lib/python3.8/dist-packages pip six 1.14.0 /usr/lib/python3/dist-packages tensorboard 2.13.0 /home/pviceconte/.local/lib/python3.8/site-packages pip tensorboard-data-server 0.7.1 /home/pviceconte/.local/lib/python3.8/site-packages pip tensorflow 2.13.0 /home/pviceconte/.local/lib/python3.8/site-packages pip tensorflow-estimator 2.13.0 /home/pviceconte/.local/lib/python3.8/site-packages pip tensorflow-io-gcs-filesystem 0.32.0 /home/pviceconte/.local/lib/python3.8/site-packages pip tensorflow-probability 0.20.1 /home/pviceconte/.local/lib/python3.8/site-packages pip tensorflow-serving-api 2.12.1 /home/pviceconte/.local/lib/python3.8/site-packages pip termcolor 2.3.0 /home/pviceconte/.local/lib/python3.8/site-packages pip tf-slim 1.1.0 /home/pviceconte/.local/lib/python3.8/site-packages pip tomli 2.0.1 /usr/local/lib/python3.8/dist-packages pip typing-extensions 4.5.0 /home/pviceconte/.local/lib/python3.8/site-packages pip urllib3 1.25.8 /usr/lib/python3/dist-packages vcstool 0.3.0 /usr/local/lib/python3.8/dist-packages pip vcstools 0.1.42 /usr/lib/python3/dist-packages Werkzeug 2.3.6 /home/pviceconte/.local/lib/python3.8/site-packages pip wheel 0.34.2 /usr/lib/python3/dist-packages wrapt 1.15.0 /home/pviceconte/.local/lib/python3.8/site-packages pip zipp 3.16.2 /home/pviceconte/.local/lib/python3.8/site-packages pip ```
LutaoChu commented 1 year ago

I am also getting a similar error on Python 3.8 as posted by @traversaro, has anyone solved it successfully?

Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r robotics_transformer/requirements.txt (line 9))
  Cloning https://github.com/google-research/tensor2robot to /tmp/pip-req-build-q4u7a7wr
  Running command git clone --filter=blob:none --quiet https://github.com/google-research/tensor2robot /tmp/pip-req-build-q4u7a7wr
  Resolved https://github.com/google-research/tensor2robot to commit f93f378db3183cceaad1b96828b199cf40cad606
ERROR: git+https://github.com/google-research/tensor2robot#tensor2robot (from -r robotics_transformer/requirements.txt (line 9)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
LutaoChu commented 1 year ago

Hi, I tried to install your software by following the guidelines in the README and I also encountered issues when running pip install -r robotics_transformer/requirements.txt:

Collecting git+https://github.com/google-research/tensor2robot#tensor2robot (from -r robotics_transformer/requirements.txt (line 9))
  Cloning https://github.com/google-research/tensor2robot to /tmp/pip-req-build-bizawiii
  Running command git clone -q https://github.com/google-research/tensor2robot /tmp/pip-req-build-bizawiii
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-bizawiii/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-bizawiii/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-bizawiii/pip-egg-info
         cwd: /tmp/pip-req-build-bizawiii/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.8/tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-bizawiii/setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Therefore, I tried to install tensor2robot separately as suggested in #1 (comment) and:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pviceconte/git/tensor2robot/research/pose_env/pose_env_models_test.py", line 23, in <module>
    from tensor2robot.input_generators import default_input_generator
  File "/home/pviceconte/git/tensor2robot/input_generators/__init__.py", line 17, in <module>
    from tensor2robot.input_generators import abstract_input_generator
  File "/home/pviceconte/git/tensor2robot/input_generators/abstract_input_generator.py", line 25, in <module>
    from tensor2robot.models import abstract_model
  File "/home/pviceconte/git/tensor2robot/models/abstract_model.py", line 28, in <module>
    from tensor2robot.models import model_interface
  File "/home/pviceconte/git/tensor2robot/models/model_interface.py", line 33, in <module>
    from tensor2robot.preprocessors import abstract_preprocessor
  File "/home/pviceconte/git/tensor2robot/preprocessors/__init__.py", line 17, in <module>
    from tensor2robot.preprocessors import abstract_preprocessor
  File "/home/pviceconte/git/tensor2robot/preprocessors/abstract_preprocessor.py", line 22, in <module>
    from tensor2robot.utils import tensorspec_utils
  File "/home/pviceconte/git/tensor2robot/utils/tensorspec_utils.py", line 31, in <module>
    from tensorflow.contrib import framework as contrib_framework
ModuleNotFoundError: No module named 'tensorflow.contrib'

For further context, I am using Python 3.8 on Ubuntu 20.04, and here you have my pip list --verbose output:

pip list --verbose output

@paolo-viceconte Have you find the resolution later?

hyy0613 commented 1 year ago

The tensorflow.contrib has been removed in tensorflow2.x. according to the following link https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md But, we can see that the framework is partly moved to core, so I just use tf instead of contrib_framework in tensorspec_utils.py, which I think can solve this problem @traversaro @LutaoChu

LutaoChu commented 1 year ago

The tensorflow.contrib has been removed in tensorflow2.x. according to the following link https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md But, we can see that the framework is partly moved to core, so I just use tf instead of contrib_framework in tensorspec_utils.py, which I think can solve this problem @traversaro @LutaoChu

I fixed the problem in tensorspec_utils.py as you suggested, but ran into problems with tensorflow.contrib in other files such as optimizers.And I found a lot of modules that use tensorflow.contrib, one by one, to deal with the unreality.Do you have any good suggestions? @YiyangHuang-work

tensor2robot.research.pose_env.pose_env_models_test
2023-08-14 15:34:30.642314: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-08-14 15:34:30.675478: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-08-14 15:34:30.675765: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-08-14 15:34:31.338751: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "/home/lutaochu/miniconda3/envs/RT1/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/lutaochu/miniconda3/envs/RT1/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/lutaochu/code/tensor2robot/research/pose_env/pose_env_models_test.py", line 23, in <module>
    from tensor2robot.input_generators import default_input_generator
  File "/home/lutaochu/code/tensor2robot/input_generators/__init__.py", line 17, in <module>
    from tensor2robot.input_generators import abstract_input_generator
  File "/home/lutaochu/code/tensor2robot/input_generators/abstract_input_generator.py", line 25, in <module>
    from tensor2robot.models import abstract_model
  File "/home/lutaochu/code/tensor2robot/models/abstract_model.py", line 29, in <module>
    from tensor2robot.models import optimizers
  File "/home/lutaochu/code/tensor2robot/models/optimizers.py", line 23, in <module>
    from tensorflow.contrib import opt as contrib_opt
ModuleNotFoundError: No module named 'tensorflow.contrib'

image

hyy0613 commented 11 months ago

The tensorflow.contrib has been removed in tensorflow2.x. according to the following link https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md But, we can see that the framework is partly moved to core, so I just use tf instead of contrib_framework in tensorspec_utils.py, which I think can solve this problem @traversaro @LutaoChu

I fixed the problem in tensorspec_utils.py as you suggested, but ran into problems with tensorflow.contrib in other files such as optimizers.And I found a lot of modules that use tensorflow.contrib, one by one, to deal with the unreality.Do you have any good suggestions? @YiyangHuang-work

tensor2robot.research.pose_env.pose_env_models_test
2023-08-14 15:34:30.642314: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-08-14 15:34:30.675478: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-08-14 15:34:30.675765: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-08-14 15:34:31.338751: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "/home/lutaochu/miniconda3/envs/RT1/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/lutaochu/miniconda3/envs/RT1/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/lutaochu/code/tensor2robot/research/pose_env/pose_env_models_test.py", line 23, in <module>
    from tensor2robot.input_generators import default_input_generator
  File "/home/lutaochu/code/tensor2robot/input_generators/__init__.py", line 17, in <module>
    from tensor2robot.input_generators import abstract_input_generator
  File "/home/lutaochu/code/tensor2robot/input_generators/abstract_input_generator.py", line 25, in <module>
    from tensor2robot.models import abstract_model
  File "/home/lutaochu/code/tensor2robot/models/abstract_model.py", line 29, in <module>
    from tensor2robot.models import optimizers
  File "/home/lutaochu/code/tensor2robot/models/optimizers.py", line 23, in <module>
    from tensorflow.contrib import opt as contrib_opt
ModuleNotFoundError: No module named 'tensorflow.contrib'

image

The project just use this tensorspec_utils.py file,so there is no need to change others. I can run the code after fix this problem,wish you good luck~

TX-Leo commented 11 months ago

I succeed in running action_tokenizer_test!!(py3.11.5+tf2.13.0)

Conda env

conda create -n rt1
conda activate rt1
# install python3.11(Python 3.11.5)
conda install python

1.tensor2robot

1)git clone tensor2robot

git clone https://github.com/google-research/tensor2robot.git

2)modify tensor2robot/requirements.txt

pybullet==2.5.0  --> pybullet

3)pip install

pip install -r tensor2robot/requirements.txt

4)test

python -m tensor2robot.research.pose_env.pose_env_test

5)!!!!!modify tensor2robot/utils/tensorspec_utils.py

contrib_framework --> tf


2.rt1

1)git clone rt1

git clone https://github.com/google-research/robotics_transformer.git

2)Comment out the last line of robotics_transformer/requirements.txt

# git+https://github.com/google-research/tensor2robot#tensor2robot

3)pip install

pip install -r robotics_transformer/requirements.txt

4)test action tokenizer

python -m robotics_transformer.tokenizers.action_tokenizer_test


[Note]:my python3.11.5 pip list

Package                 Version
----------------------- ---------
absl-py                 1.4.0
astunparse              1.6.3
cachetools              5.3.1
certifi                 2023.7.22
charset-normalizer      3.2.0
cloudpickle             2.2.1
decorator               5.1.1
dm-tree                 0.1.8
flatbuffers             23.5.26
gast                    0.4.0
gin-config              0.5.0
google-auth             2.23.0
google-auth-oauthlib    1.0.0
google-pasta            0.2.0
grpcio                  1.58.0
gym                     0.23.0
gym-notices             0.0.8
h5py                    3.9.0
idna                    3.4
keras                   2.13.1
libclang                16.0.6
Markdown                3.4.4
MarkupSafe              2.1.3
numpy                   1.24.3
oauthlib                3.2.2
opt-einsum              3.3.0
packaging               23.1
Pillow                  5.3.0
pip                     23.2.1
protobuf                4.24.3
pyasn1                  0.5.0
pyasn1-modules          0.3.0
pybullet                3.2.5
pygame                  2.1.3
requests                2.31.0
requests-oauthlib       1.3.1
rsa                     4.9
setuptools              68.0.0
six                     1.16.0
tensorboard             2.13.0
tensorboard-data-server 0.7.1
tensorflow              2.13.0
tensorflow-estimator    2.13.0
tensorflow-macos        2.13.0
tensorflow-probability  0.20.1
tensorflow-serving-api  2.13.0
termcolor               2.3.0
tf-agents               0.17.0
tf-slim                 1.1.0
typing_extensions       4.5.0
urllib3                 1.26.16
Werkzeug                2.3.7
wheel                   0.38.4
wrapt                   1.15.0

Hopefully it will be helpful to you guys!

tyk15886924522 commented 10 months ago

I succeed in running action_tokenizer_test!!(py3.11.5+tf2.13.0)

Conda env

conda create -n rt1
conda activate rt1
# install python3.11(Python 3.11.5)
conda install python

1.tensor2robot

1)git clone tensor2robot

git clone https://github.com/google-research/tensor2robot.git

2)modify tensor2robot/requirements.txt

pybullet==2.5.0  --> pybullet

3)pip install

pip install -r tensor2robot/requirements.txt

4)test

python -m tensor2robot.research.pose_env.pose_env_test

5)!!!!!modify tensor2robot/utils/tensorspec_utils.py

contrib_framework --> tf

2.rt1

1)git clone rt1

git clone https://github.com/google-research/robotics_transformer.git

2)Comment out the last line of robotics_transformer/requirements.txt

# git+https://github.com/google-research/tensor2robot#tensor2robot

3)pip install

pip install -r robotics_transformer/requirements.txt

4)test action tokenizer

python -m robotics_transformer.tokenizers.action_tokenizer_test

[Note]:my python3.11.5 pip list

Package                 Version
----------------------- ---------
absl-py                 1.4.0
astunparse              1.6.3
cachetools              5.3.1
certifi                 2023.7.22
charset-normalizer      3.2.0
cloudpickle             2.2.1
decorator               5.1.1
dm-tree                 0.1.8
flatbuffers             23.5.26
gast                    0.4.0
gin-config              0.5.0
google-auth             2.23.0
google-auth-oauthlib    1.0.0
google-pasta            0.2.0
grpcio                  1.58.0
gym                     0.23.0
gym-notices             0.0.8
h5py                    3.9.0
idna                    3.4
keras                   2.13.1
libclang                16.0.6
Markdown                3.4.4
MarkupSafe              2.1.3
numpy                   1.24.3
oauthlib                3.2.2
opt-einsum              3.3.0
packaging               23.1
Pillow                  5.3.0
pip                     23.2.1
protobuf                4.24.3
pyasn1                  0.5.0
pyasn1-modules          0.3.0
pybullet                3.2.5
pygame                  2.1.3
requests                2.31.0
requests-oauthlib       1.3.1
rsa                     4.9
setuptools              68.0.0
six                     1.16.0
tensorboard             2.13.0
tensorboard-data-server 0.7.1
tensorflow              2.13.0
tensorflow-estimator    2.13.0
tensorflow-macos        2.13.0
tensorflow-probability  0.20.1
tensorflow-serving-api  2.13.0
termcolor               2.3.0
tf-agents               0.17.0
tf-slim                 1.1.0
typing_extensions       4.5.0
urllib3                 1.26.16
Werkzeug                2.3.7
wheel                   0.38.4
wrapt                   1.15.0

Hopefully it will be helpful to you guys!

I need to make some modifications to run the action_tokenizer_test.

1)Comment out the line 31 of tensor2robot/utils/tensorspec_utils.py

# from tensorflow.contrib import framework as tf

2)Downgrade the protobuf package to 3.20.1

pip install protobuf==3.20.1

3)Compile the protobufs

cd tensor2robot/proto
protoc -I=./ --python_out=`pwd` t2r.proto

4)test action tokenizer

cd ..
cd ..
python -m robotics_transformer.tokenizers.action_tokenizer_test

Many thanks for your help!!! @TX-Leo

liuzc188 commented 9 months ago

However, I need pip install protobuf==3.20.3 and -bash: protoc: command not found, fixed by next blog: https://grpc.io/docs/protoc-installation/

hskAlena commented 5 months ago

AttributeError: module 'keras._tf_keras.keras' has no attribute '__internal__' FYI, I got this error and to resolve that, I installed pip install tf-keras-nightly for tensorflow 2.16.1 and keras 3.1.1 integration.

PING-An32 commented 5 months ago

AttributeError: module 'keras._tf_keras.keras' has no attribute '__internal__' FYI, I got this error and to resolve that, I installed pip install tf-keras-nightly for tensorflow 2.16.1 and keras 3.1.1 integration.

Still gives me AttributeError: module 'keras._tf_keras.keras' has no attribute '__internal__' after pip install tf-keras-nightly. However, continuously doing pip install tfp-nightly and pip install tf-nightly should be good. Source comes from https://github.com/tensorflow/probability/issues/1774#issuecomment-1979642276

levi3001 commented 3 months ago

I succeed in running action_tokenizer_test!!(py3.11.5+tf2.13.0)

Conda env

conda create -n rt1
conda activate rt1
# install python3.11(Python 3.11.5)
conda install python

1.tensor2robot

1)git clone tensor2robot

git clone https://github.com/google-research/tensor2robot.git

2)modify tensor2robot/requirements.txt

pybullet==2.5.0  --> pybullet

3)pip install

pip install -r tensor2robot/requirements.txt

4)test

python -m tensor2robot.research.pose_env.pose_env_test

5)!!!!!modify tensor2robot/utils/tensorspec_utils.py

contrib_framework --> tf

2.rt1

1)git clone rt1

git clone https://github.com/google-research/robotics_transformer.git

2)Comment out the last line of robotics_transformer/requirements.txt

# git+https://github.com/google-research/tensor2robot#tensor2robot

3)pip install

pip install -r robotics_transformer/requirements.txt

4)test action tokenizer

python -m robotics_transformer.tokenizers.action_tokenizer_test

[Note]:my python3.11.5 pip list

Package                 Version
----------------------- ---------
absl-py                 1.4.0
astunparse              1.6.3
cachetools              5.3.1
certifi                 2023.7.22
charset-normalizer      3.2.0
cloudpickle             2.2.1
decorator               5.1.1
dm-tree                 0.1.8
flatbuffers             23.5.26
gast                    0.4.0
gin-config              0.5.0
google-auth             2.23.0
google-auth-oauthlib    1.0.0
google-pasta            0.2.0
grpcio                  1.58.0
gym                     0.23.0
gym-notices             0.0.8
h5py                    3.9.0
idna                    3.4
keras                   2.13.1
libclang                16.0.6
Markdown                3.4.4
MarkupSafe              2.1.3
numpy                   1.24.3
oauthlib                3.2.2
opt-einsum              3.3.0
packaging               23.1
Pillow                  5.3.0
pip                     23.2.1
protobuf                4.24.3
pyasn1                  0.5.0
pyasn1-modules          0.3.0
pybullet                3.2.5
pygame                  2.1.3
requests                2.31.0
requests-oauthlib       1.3.1
rsa                     4.9
setuptools              68.0.0
six                     1.16.0
tensorboard             2.13.0
tensorboard-data-server 0.7.1
tensorflow              2.13.0
tensorflow-estimator    2.13.0
tensorflow-macos        2.13.0
tensorflow-probability  0.20.1
tensorflow-serving-api  2.13.0
termcolor               2.3.0
tf-agents               0.17.0
tf-slim                 1.1.0
typing_extensions       4.5.0
urllib3                 1.26.16
Werkzeug                2.3.7
wheel                   0.38.4
wrapt                   1.15.0

Hopefully it will be helpful to you guys!

I need to make some modifications to run the action_tokenizer_test.

1)Comment out the line 31 of tensor2robot/utils/tensorspec_utils.py

# from tensorflow.contrib import framework as tf

2)Downgrade the protobuf package to 3.20.1

pip install protobuf==3.20.1

3)Compile the protobufs

cd tensor2robot/proto
protoc -I=./ --python_out=`pwd` t2r.proto

4)test action tokenizer

cd ..
cd ..
python -m robotics_transformer.tokenizers.action_tokenizer_test

Many thanks for your help!!! @TX-Leo

I have to add this code to fix the tensorflower.contrib error

from tensorflow.python.util import nest
from tensorflow import TensorSpec as TSPEC
#nest = contrib_framework.nest
#TSPEC = contrib_framework.TensorSpec