tensorforce: cannot run example: AttributeError: module 'tensorflow._api.v1.keras.optimizers' has no attribute 'Ftrl'
It seems like I have a problem running tensorforce on Ubuntu 18.04.
Procedure:
Uninstalling Tensorforce-0.5.2:
/home/jrlab/.local/lib/python3.6/site-packages/Tensorforce-0.5.2.dist-info/INSTALLER
/home/jrlab/.local/lib/python3.6/site-packages/Tensorforce-0.5.2.dist-info/LICENSE
/home/jrlab/.local/lib/python3.6/site-packages/Tensorforce-0.5.2.dist-info/METADATA
/home/jrlab/.local/lib/python3.6/site-packages/Tensorforce-0.5.2.dist-info/RECORD
/home/jrlab/.local/lib/python3.6/site-packages/Tensorforce-0.5.2.dist-info/WHEEL
/home/jrlab/.local/lib/python3.6/site-packages/Tensorforce-0.5.2.dist-info/top_level.txt
Proceed (y/n)? y
Successfully uninstalled Tensorforce-0.5.2
> pwd
/home/jrlab/Desktop/Git/tensorforce
> git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
> pip3 install -e .
[lots out output]
Successfully installed Tensorforce attrs-19.3.0 cloudpickle-1.3.0 cycler-0.10.0 future-0.18.2 gym-0.17.1 h5py-2.10.0 importlib-metadata-1.6.0 kiwisolver-1.2.0 matplotlib-3.2.1 more-itertools-8.2.0 msgpack-1.0.0 msgpack-numpy-0.4.5 numpy-1.18.3 packaging-20.3 pluggy-0.13.1 py-1.8.1 pyglet-1.5.0 pyparsing-2.4.7 pytest-5.4.1 python-dateutil-2.8.1 scipy-1.4.1 six-1.14.0 tqdm-4.45.0 wcwidth-0.1.9 zipp-3.1.0
> python3 run.py benchmarks/configs/ppo1.json gym --level CartPole-v1 -e 300
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
File "run.py", line 24, in <module>
from tensorforce import Agent, Environment, Runner
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/__init__.py", line 31, in <module>
from tensorforce.environments import Environment
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/environments/__init__.py", line 29, in <module>
from tensorforce.environments.carla_environment import CARLAEnvironment
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/environments/carla_environment.py", line 7, in <module>
from tensorforce.agents import Agent
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/agents/__init__.py", line 18, in <module>
from tensorforce.agents.constant import ConstantAgent
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/agents/constant.py", line 19, in <module>
from tensorforce.core.models import ConstantModel
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/core/__init__.py", line 23, in <module>
from tensorforce.core.optimizers import optimizer_modules
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/core/optimizers/__init__.py", line 32, in <module>
from tensorforce.core.optimizers.tf_optimizer import TFOptimizer, tensorflow_optimizers
File "/home/jrlab/Desktop/Git/tensorforce/tensorforce/core/optimizers/tf_optimizer.py", line 30, in <module>
ftrl=tf.keras.optimizers.Ftrl,
AttributeError: module 'tensorflow._api.v1.keras.optimizers' has no attribute 'Ftrl'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (16 by maintainers)
The reason why TensorFlow is not automatically installed is because you have to choose between
tfandtf_gpu, and a default would probably be confusing. If you install viapip install -e .[tf / tf_gpu], it should be installed.