Open mmcaulif opened 3 years ago
Hi mmcaulif,
I just had the same problem and was able to fix (hack) it.
The problem is, that spinningup has two implementations, pytorch
and tf1
. Pytorch depends on tensorflow==2.4.1
, at least that´s what they put in theier setup.py.
So I guess, it is either use the pytorch or tf1 implementation. I strongly suspect, that pytorch is the preferred way to go.
But here is the bug: in __init__.py
they still try to import the tf1
modules
from spinup.algos.tf1.ddpg.ddpg import ddpg as ddpg_tf1
from spinup.algos.tf1.ppo.ppo import ppo as ppo_tf1
from spinup.algos.tf1.sac.sac import sac as sac_tf1
from spinup.algos.tf1.td3.td3 import td3 as td3_tf1
from spinup.algos.tf1.trpo.trpo import trpo as trpo_tf1
from spinup.algos.tf1.vpg.vpg import vpg as vpg_tf1
Despite, we never installed them in the setup.py
.
When you don't want to use the tf1 implementations, you can simply put a try catch around the imports like this, they are not needed for the pytorch algorithms.
try:
from spinup.algos.tf1.ddpg.ddpg import ddpg as ddpg_tf1
from spinup.algos.tf1.ppo.ppo import ppo as ppo_tf1
from spinup.algos.tf1.sac.sac import sac as sac_tf1
from spinup.algos.tf1.td3.td3 import td3 as td3_tf1
from spinup.algos.tf1.trpo.trpo import trpo as trpo_tf1
from spinup.algos.tf1.vpg.vpg import vpg as vpg_tf1
except:
print("TF1 module not imported")
Note: This is more like a hack than a proper solution. You might either:
setup.py
(I don't know if you can have tf1 and tf2 in parallel?)__init__.py
I hope, this was a help.
Attempting the spinning up tutorial using windows and wsl2 by following the link given in the installation tutorial.
After setting up conda and wsl2, I made my conda environment, then followed the installation from there.
When I run the test line:
"python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999"
to check the install i initially received "illegal instruction" so I ran "conda install tensorflow" which I'd seen recommended online.
The installation check no longer returned illegal instruction but now returns:
With I'd imagine the important line being the last one.
Google searches come up with an old thread where someone fixes it themselves but with no explanation apart from "user error" and "bad install"