Open KangWoonKim opened 11 months ago
and when I did
!pip install minerl
instead and run
import gym
import minerl
it showed me this
AttributeError Traceback (most recent call last) Input In [11], in <cell line: 1>() ----> 1 import minerl
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/init.py:6, in
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/envs.py:23, in
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_specs/obtain_specs.py:99, in ObtainDiamond.init(self, dense) 98 def init(self, dense): ---> 99 super(ObtainDiamond, self).init( 100 target_item='diamond', 101 dense=dense, 102 reward_schedule={ 103 "log": 1, 104 "planks": 2, 105 "stick": 4, 106 "crafting_table": 4, 107 "wooden_pickaxe": 8, 108 "cobblestone": 16, 109 "furnace": 32, 110 "stone_pickaxe": 32, 111 "iron_ore": 64, 112 "iron_ingot": 128, 113 "iron_pickaxe": 256, 114 "diamond": 1024 115 }, 116 max_episode_steps=18000 117 )
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_specs/obtain_specs.py:25, in Obtain.init(self, target_item, dense, reward_schedule, max_episode_steps) 23 dense_suffix = "Dense" if self.dense else "" 24 self.reward_schedule = reward_schedule ---> 25 super().init( 26 name="MineRLObtain{}{}-v0".format(suffix, dense_suffix), 27 xml="obtain{}{}.xml".format(suffix, dense_suffix), 28 max_episode_steps=max_episode_steps, 29 )
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_specs/simple_env_spec.py:30, in SimpleEnvSpec.init(self, name, xml, *args, kwargs) 28 def init(self, name, xml, *args, *kwargs): 29 self.resolution = tuple((64, 64)) ---> 30 super().init(name, xml, args, kwargs)
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_spec.py:23, in EnvSpec.init(self, name, xml, max_episode_steps, reward_threshold) 20 self.max_episode_steps = max_episode_steps 21 self.reward_threshold = reward_threshold ---> 23 self.observables = self.create_observables() 24 self.actionables = self.create_actionables() 25 # check that the observables (list) have no duplicate to_strings
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_specs/obtain_specs.py:77, in Obtain.create_observables(self) 54 def create_observables(self) -> List[AgentHandler]: 55 # TODO: Parameterize these observations. 56 return super().create_observables() + [ 57 handlers.FlatInventoryObservation([ 58 'dirt', 59 'coal', 60 'torch', 61 'log', 62 'planks', 63 'stick', 64 'crafting_table', 65 'wooden_axe', 66 'wooden_pickaxe', 67 'stone', 68 'cobblestone', 69 'furnace', 70 'stone_axe', 71 'stone_pickaxe', 72 'iron_ore', 73 'iron_ingot', 74 'iron_axe', 75 'iron_pickaxe' 76 ]), ---> 77 handlers.DamageObservation('mainhand'), 78 handlers.MaxDamageObservation('mainhand'), 79 handlers.TypeObservation('mainhand', 80 ['none', 'air', 'wooden_axe', 'wooden_pickaxe', 'stone_axe', 'stone_pickaxe', 81 'iron_axe', 'iron_pickaxe', 'other']), 82 ]
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/hero/handlers/observables.py:405, in DamageObservation.init(self, hand) 403 self._hand = hand 404 self._default = 0 # 'none' --> 405 super().init(spaces.Box(low=-1, high=1562, shape=(), dtype=np.int))
File ~/opt/anaconda3/lib/python3.9/site-packages/numpy/init.py:324, in getattr(attr)
319 warnings.warn(
320 f"In the future np.{attr}
will be defined as the "
321 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
323 if attr in former_attrs:
--> 324 raise AttributeError(former_attrs[attr])
326 if attr == 'testing':
327 import numpy.testing as testing
AttributeError: module 'numpy' has no attribute 'int'.
np.int
was a deprecated alias for the builtin int
. To avoid this error in existing code, use int
by itself. Doing this will not modify any behavior and is safe. When replacing np.int
, you may wish to use e.g. np.int64
or np.int32
to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Do you know what is causing this?
Hey. MineRL does not run on Mac without some extra steps. See this comment for instructions. Also, running it in notebooks might cause further issues.
pip install minerl
installs an older version of MineRL. To install the up-to-date version (e.g., the one used by OpenAI VPT), you need to install it from the git command (the one where it got stuck).
Hi I have followed your link and when I do the
./gradlew clean build shadowJar
I get
Configure project :
These are the repositories after plugins have been applied: | - MavenRepo -> https://repo.maven.apache.org/maven2/ | - BintrayJCenter -> https://jcenter.bintray.com/ | - maven -> https://repo.spongepowered.org/maven/ | - maven2 -> https://maven.minecraftforge.net/ | - BUNDELED_56907638 -> downloads to: /Users/kylekim/.gradle/caches/forge_gradle/bundeled_repo/ | - maven3 -> https://libraries.minecraft.net/
Repositories after removing proxied repos: | - MavenRepo -> https://repo.maven.apache.org/maven2/ | - BintrayJCenter -> https://jcenter.bintray.com/ | - maven -> https://repo.spongepowered.org/maven/ | - maven2 -> https://maven.minecraftforge.net/ | - BUNDELED_56907638 -> downloads to: /Users/kylekim/.gradle/caches/forge_gradle/bundeled_repo/ | - maven3 -> https://libraries.minecraft.net/
Task :verifyRepos Checking BuildScript Repositories: | - [ OK ]: MavenLocal -> file:/Users/kylekim/.m2/repository | - [FAIL]: MavenRepo -> https://repo.maven.apache.org/maven2/ | - [FAIL]: BintrayJCenter -> https://jcenter.bintray.com/ | - [FAIL]: maven -> https://repo.spongepowered.org/maven/ Checking Project Repositories: | - [FAIL]: MavenRepo -> https://repo.maven.apache.org/maven2/ | - [FAIL]: BintrayJCenter -> https://jcenter.bintray.com/ | - [FAIL]: maven -> https://repo.spongepowered.org/maven/ | - [FAIL]: maven2 -> https://maven.minecraftforge.net/ | - [ OK ]: BUNDELED_56907638 (accepted custom MC repo) | - [FAIL]: maven3 -> https://libraries.minecraft.net/
Task :compileJava /Users/kylekim/opt/anaconda3/lib/python3.9/site-packages/minerl/MCP-Reborn/src/main/java/net/minecraft/client/.ipynb_checkpoints/MainWindow-checkpoint.java:37: error: class MainWindow is public, should be declared in a file named MainWindow.java public final class MainWindow implements AutoCloseable { ^ /Users/kylekim/opt/anaconda3/lib/python3.9/site-packages/minerl/MCP-Reborn/src/main/java/net/minecraft/client/MainWindow.java:37: error: duplicate class: net.minecraft.client.MainWindow public final class MainWindow implements AutoCloseable { ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
Task :compileJava FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compileJava'.
Compilation failed; see the compiler error output for details.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 57s 6 actionable tasks: 6 executed`
In case I have tried to execute the tutorial code and this error message was given
import gym import minerl import logging logging.basicConfig(level=logging.DEBUG) env = gym.make('MineRLBasaltFindCave-v0') obs = env.reset() done = False
while not done:
action = env.action_space.sample()
# In BASALT environments, sending ESC action will end the episode
# Lets not do that
action["ESC"] = 0
obs, reward, done, _ = env.step(action)
env.render()
EOFError Traceback (most recent call last) Input In [3], in <cell line: 6>() 4 logging.basicConfig(level=logging.DEBUG) 5 env = gym.make('MineRLBasaltFindCave-v0') ----> 6 obs = env.reset() 7 done = False 9 while not done: 10 # Take a random action
File ~/opt/anaconda3/lib/python3.9/site-packages/gym/wrappers/time_limit.py:27, in TimeLimit.reset(self, kwargs) 25 def reset(self, kwargs): 26 self._elapsed_steps = 0 ---> 27 return self.env.reset(**kwargs)
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_specs/basalt_specs.py:78, in DoneOnESCWrapper.reset(self) 76 def reset(self): 77 self.episode_over = False ---> 78 return self.env.reset()
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/herobraine/env_specs/basalt_specs.py:57, in BasaltTimeoutWrapper.reset(self) 55 self.timeout = self.env.task.max_episode_steps 56 self.num_steps = 0 ---> 57 return super().reset()
File ~/opt/anaconda3/lib/python3.9/site-packages/gym/core.py:251, in Wrapper.reset(self, kwargs) 250 def reset(self, kwargs): --> 251 return self.env.reset(**kwargs)
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/env/_singleagent.py:22, in _SingleAgentEnv.reset(self) 21 def reset(self) -> Dict[str, Any]: ---> 22 multi_obs = super().reset() 23 return multi_obs[self.task.agent_names[0]]
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/env/_multiagent.py:436, in _MultiAgentEnv.reset(self) 433 agent_xmls = self._setup_agent_xmls(ep_uid) 435 # Start missing instances, quit episodes, and make socket connections --> 436 self._setup_instances() 438 # Episodic state variables 439 self.done = False
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/env/_multiagent.py:539, in _MultiAgentEnv._setupinstances(self) 537 for in range(num_instances_to_start): 538 instance_futures.append(tpe.submit(self._get_new_instance)) --> 539 self.instances.extend([f.result() for f in instance_futures]) 540 self.instances = self.instances[:self.task.agent_count] 541 # self.instances = [self._get_new_instance(port=12000)] 542 543 # Refresh old instances every N setups
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/env/multiagent.py:539, in
File ~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py:439, in Future.result(self, timeout) 437 raise CancelledError() 438 elif self._state == FINISHED: --> 439 return self.__get_result() 441 self._condition.wait(timeout) 443 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py:391, in Future.__get_result(self) 389 if self._exception: 390 try: --> 391 raise self._exception 392 finally: 393 # Break a reference cycle with the exception in self._exception 394 self = None
File ~/opt/anaconda3/lib/python3.9/concurrent/futures/thread.py:58, in _WorkItem.run(self) 55 return 57 try: ---> 58 result = self.fn(*self.args, **self.kwargs) 59 except BaseException as exc: 60 self.future.set_exception(exc)
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/env/_multiagent.py:805, in _MultiAgentEnv._get_new_instance(self, port, instance_id) 802 if InstanceManager.is_remote(): 803 launch_queue_logger_thread(instance, self.is_closed) --> 805 instance.launch(replaceable=self._is_fault_tolerant) 807 # Add a cleaning flag to the instance 808 instance.had_to_clean = False
File ~/opt/anaconda3/lib/python3.9/site-packages/minerl/env/malmo.py:427, in MinecraftInstance.launch(self, daemonize, replaceable) 425 error_str += spline + "\n" 426 # Throw an exception! --> 427 raise EOFError( 428 error_str + "\n\nMinecraft process finished unexpectedly. There was an error with Malmo.") 430 lines.append(line) 431 self._log_heuristic("\n".join(line.split("\n")[:-1]))
EOFError: /Users/kylekim/opt/anaconda3/lib/python3.9/site-packages/minerl/env/../MCP-Reborn Error: Unable to access jarfile build/libs/mcprec-6.13.jar
Minecraft process finished unexpectedly. There was an error with Malmo.
Do you know what have caused this?
Thanks in advance.
Hm I unfortunately do not have time to spare to dig deeper into this (and I do not have a mac with me to test things out). Usually Java compilation errors have been caused by having the wrong java version. Double-check that it is using JDK 8 (e.g., java -version
and javac -version
should both report 1.8...
.). Apart from that I am out of common tips that help :(
I am using jupyter notebook on MacOS and when I did
Collecting git+https://github.com/minerllabs/minerl Cloning https://github.com/minerllabs/minerl to /private/var/folders/mx/13txkwqx4gl2j96pycd99rwc0000gn/T/pip-req-build-dmnu955f Running command git clone --filter=blob:none --quiet https://github.com/minerllabs/minerl /private/var/folders/mx/13txkwqx4gl2j96pycd99rwc0000gn/T/pip-req-build-dmnu955f Resolved https://github.com/minerllabs/minerl to commit 8268ee99329ab45793859050d95352d35274532b Preparing metadata (setup.py) ... |
and stuck here for an hour. how can I install it manually if this is not possible?