Im trying to install the gym atari package on version 0.9.5 (I specifically need this version), but when I run the code (which is supposed to be running smoothly if gym is properly downloaded), I get the following error:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
The problem occurred when I tried to run gym.make().
Does anyone know how to fix this?
The same behavior happened to me with python 3.9, but for some reason not on python 3.8 (there was a different error there). Maybe Im missing some rendering library?
The full error message is:
[2021-05-22 02:17:05,405] Making new env: PongNoFrameskip-v4
C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py:17: PkgResourcesDeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
result = entry_point.load(False)
Traceback (most recent call last):
File "C:/Users/1/PycharmProjects/University Homework/Reinforcement Learning/dqn/main.py", line 61, in <module>
env = get_env(task, seed)
File "C:\Users\1\PycharmProjects\University Homework\Reinforcement Learning\dqn\utils\gym.py", line 13, in get_env
env = gym.make(env_id)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 164, in make
return registry.make(id)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 122, in make
env = spec.make()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 89, in make
env = cls(**self._kwargs)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 32, in __init__
self.game_path = atari_py.get_game_path(game)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\atari_py\games.py", line 20, in get_game_path
raise Exception('ROM is missing for %s, see https://github.com/openai/atari-py#roms for instructions' % (game_name,))
Exception: ROM is missing for pong, see https://github.com/openai/atari-py#roms for instructions
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\utils\closer.py", line 67, in close
closeable.close()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 150, in render
return self._render(mode=mode, close=close)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 109, in _render
if self.viewer is not None:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
Exception ignored in: <function Env.__del__ at 0x00000203EE2174C8>
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 203, in __del__
self.close()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 150, in render
return self._render(mode=mode, close=close)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 109, in _render
if self.viewer is not None:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
Also, the relevant code:
if __name__ == '__main__':
# Get Atari games.
benchmark = gym.benchmark_spec('Atari40M')
# Change the index to select a different game.
task = benchmark.tasks[3]
# Run training
seed = 0 # Use a seed of zero (you may want to randomize the seed!)
env = get_env(task, seed)
And get_env is:
def get_env(task, seed):
env_id = task.env_id
env = gym.make(env_id)
set_global_seeds(seed)
env.seed(seed)
expt_dir = 'tmp/gym-results'
env = wrappers.Monitor(env, expt_dir, force=True)
env = wrap_deepmind(env)
return env
The error looks like the Atari ROM for pong is not found. This is probably due to the fact that gym no longer installs ROMs automatically, due to licensing issues.
But there's an easy workaround now:
pip install -U gym
pip install -U gym[atari,accept-rom-license]
The accept-rom-license option installs a package called autorom which provides the AutoROM command, and runs it automatically with the --accept-rom-license option.
Then everything just works normally.
Details:
If you run AutoROM without the --accept-license option, this is what you get, so be warned:
AutoROM will download the Atari 2600 ROMs.
They will be installed to:
[...]/site-packages/AutoROM/roms
Existing ROMs will be overwritten.
I own a license to these Atari 2600 ROMs.
I agree to not distribute these ROMs and wish to proceed: [Y/n]:
Run AutoROM --help for more options.
Related
2023-01-25 08:21:21,659 - ERROR - Traceback (most recent call last):
File "/home/xyzUser/project/queue_handler/document_queue_listner.py", line 148, in __process_and_acknowledge
pipeline_result = self.__process_document_type(message, pipeline_input)
File "/home/xyzUser/project/queue_handler/document_queue_listner.py", line 194, in __process_document_type
pipeline_result = bill_parser_pipeline.process(pipeline_input)
File "/home/xyzUser/project/main/billparser/__init__.py", line 18, in process
bill_extractor_model = MachineGeneratedBillExtractorModel()
File "/home/xyzUser/project/main/billparser/models/qa_model.py", line 25, in __new__
cls.__model = TransformersReader(model_name_or_path=cls.__model_path, use_gpu=False)
File "/home/xyzUser/project/.env/lib/python3.8/site-packages/haystack/nodes/base.py", line 48, in wrapper_exportable_to_yaml
init_func(self, *args, **kwargs)
File "/home/xyzUser/project/.env/lib/python3.8/site-packages/haystack/nodes/reader/transformers.py", line 93, in __init__
self.model = pipeline(
File "/home/xyzUser/project/.env/lib/python3.8/site-packages/transformers/pipelines/__init__.py", line 542, in pipeline
return task_class(model=model, framework=framework, task=task, **kwargs)
File "/home/xyzUser/project/.env/lib/python3.8/site-packages/transformers/pipelines/question_answering.py", line 125, in __init__
super().__init__(
File "/home/xyzUser/project/.env/lib/python3.8/site-packages/transformers/pipelines/base.py", line 691, in __init__
self.device = device if framework == "tf" else torch.device("cpu" if device < 0 else f"cuda:{device}")
TypeError: '<' not supported between instances of 'torch.device' and 'int'
This is the error message i got after installing a requirement.txt file from my project. I think it is related to torch but also dont know how to fix it. I am new to hugging face transformers and dont know if it is a version issue.
This was a bug with the transformers package for a number of versions prior to v4.22.0, given that particular line of code does not discern between the type of the device argument could be a torch.device before comparing that with an int. Tracing through git blame, we can find that this specific change made in changeset 9d4a45509ab include the much needed if isinstance(device, torch.device): provided by line 764 in the resulting file, which will ensure this error won't happen. Checking the tags above will show that the release for v4.22.0 and after should include this particular fix. As a refresher, to update a specific package, activate the environment, and issue the following:
pip install -U transformers
Alternatively with a specific version, e.g.:
pip install -U transformers==4.22.0
I am trying to install the python module gfootball from the Google Research Football Environment. After following the installation instructions shown on the web site for a Mac ( I am using macOS High Sierra ( 10.13.6 ) and Xcode 9.4 ) I tested the setup using the the following:
# test_gfootball.py
import gfootball.env as football_env
env = football_env.create_environment(env_name="academy_empty_goal_close")
env.reset()
env.close()
But I get the following errors:
File "test_gfootball.py", line 5, in <module>
env = football_env.create_environment(env_name="academy_empty_goal_close")
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gfootball/env/__init__.py", line 182, in create_environment
scenario_config = config.Config({'level': env_name}).ScenarioConfig()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gfootball/env/config.py", line 98, in __init__
self.NewScenario()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gfootball/env/config.py", line 153, in NewScenario
self._scenario_cfg = scenario_builder.Scenario(self).ScenarioConfig()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gfootball/env/scenario_builder.py", line 62, in __init__
scenario.build_scenario(self)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gfootball/scenarios/academy_empty_goal_close.py", line 33, in build_scenario
builder.AddPlayer(-1.0, 0.0, e_PlayerRole_GK)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gfootball/env/scenario_builder.py", line 108, in AddPlayer
player = Player(x, y, role, lazy, controllable)
TypeError: __init__() should return None, not 'NoneType'
I have worked through the files named in the error message but as far as I can see everything seems to be okay. I suspect that there is something wrong with the call using “env_name” - maybe it can’t find the scenario - "academy_empty_goal_close.
What more should I check to find the problem?
Seems like a known issue with some Conda environments: https://github.com/google-research/football/issues/156
I am trying to run the following github project:
https://github.com/jeffgreenca/laughr
I can run the command: pipenv run python laughr.py --help
but when I ask to mute a laugh from an audio file I get the following error:
Traceback (most recent call last):
File "laughr.py", line 292, in <module>
model=localModel)
File "laughr.py", line 202, in do_mute_laughs
laughr.remove_laughs(sourceFile, outFile)
File "laughr.py", line 147, in remove_laughs
rc.laughs = self.model.predict(rc.build_features())
File "laughr.py", line 73, in build_features
self.raw = self.y.T[0][i * chunkLen:(i + 1) * chunkLen]
IndexError: invalid index to scalar variable.
I think it may be a wrong version of the tensorflow or keras that I am using, but I have no idea which one is right. thanks for listening.
I am working on Sensu and graphite. Where Sensu server sends the data in the JSON format to graphite server to draw graphs of the various metrics and parameters.
I am getting following error while trying to start carbon. I have pasted the error log and trace back here. I am not able to find the solution in the internet. I tried googling almost everything.
I have enabled AMQP to read the metrics from the rabbitMQ server.
Traceback (most recent call last):
File "./carbon-cache.py", line 30, in <module>
run_twistd_plugin(__file__)
File "/opt/graphite/lib/carbon/util.py", line 90, in run_twistd_plugin
config.parseOptions(twistd_options)
File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 614, in parseOptions
usage.Options.parseOptions(self, options)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 266, in parseOptions
self.subOptions.parseOptions(rest)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 276, in parseOptions
self.postOptions()
File "/opt/graphite/lib/carbon/conf.py", line 188, in postOptions
program_settings = read_config(program, self)
File "/opt/graphite/lib/carbon/conf.py", line 497, in read_config
settings.readFrom(config, section)
File "/opt/graphite/lib/carbon/conf.py", line 137, in readFrom
value = parser.getboolean(section, key)
File "/usr/lib/python2.7/ConfigParser.py", line 370, in getboolean
raise ValueError, 'Not a boolean: %s' % v
ValueError: Not a boolean: False
ENABLE_AMQP = True
AMQP_VERBOSE = True
AMQP_HOST = 192.168.1.134
AMQP_PORT = 5671
AMQP_VHOST = /sensu
AMQP_USER = sensu
AMQP_PASSWORD = mypass
AMQP_EXCHANGE = metrics
AMQP_METRIC_NAME_IN_BODY = True
Kindly help me out. I am in need of it....
For the benefit of those coming from Google, the problem may actually be that you're missing the Python module txAMQP. You can install the module with:
pip install txamqp
or on Ubuntu (tested on Ubuntu 14.04)
sudo apt-get install python-txamqp
If i create a new theme, i become a Traceback:
../bin/paster create -t gomobile_theme gomobiletheme.mytheme
...
Traceback (most recent call last):
File "../bin/paster", line 275, in <module>
paste.script.command.run()
File "/opt/plone4/plone4/eggs/PasteScript-1.7.5-py2.6.egg/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/opt/plone4/plone4/eggs/PasteScript-1.7.5-py2.6.egg/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/opt/plone4/plone4/eggs/PasteScript-1.7.5-py2.6.egg/paste/script/command.py", line 238, in run
result = self.command()
File "/opt/plone4/plone4/eggs/PasteScript-1.7.5-py2.6.egg/paste/script/create_distro.py", line 170, in command
egg_info_dir = pluginlib.egg_info_dir(output_dir, dist_name)
File "/opt/plone4/plone4/eggs/PasteScript-1.7.5-py2.6.egg/paste/script/pluginlib.py", line 135, in egg_info_dir
% ', '.join(all))
IOError: No egg-info directory found (looked in ./gomobiletheme.mytheme/./gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/setup.cfg/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/docs/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/README.txt/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/gomobiletheme/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/src/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/setup.py/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/CONTRIBUTORS.txt/gomobiletheme.mytheme.egg-info, ./gomobiletheme.mytheme/CHANGES.txt/gomobiletheme.mytheme.egg-info)
Then I added my theme to buildout.cfg, reran it become a error like this:
bin/buildout
Develop: '/opt/plone4/plone4/src/gomobiletheme.mytheme'
error in gomobiletheme.mytheme setup command: Distribution
contains no modules or packages for namespace package 'gomobiletheme'
While:
Installing.
Processing develop directory '/opt/plone4/plone4/src/
gomobiletheme.mytheme'.
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/opt/plone4/plone4/eggs/zc.buildout-1.4.3-py2.6.egg/zc/
buildout/buildout.py", line 1660, in main
getattr(buildout, command)(args)
File "/opt/plone4/plone4/eggs/zc.buildout-1.4.3-py2.6.egg/zc/
buildout/buildout.py", line 394, in install
installed_develop_eggs = self._develop()
File "/opt/plone4/plone4/eggs/zc.buildout-1.4.3-py2.6.egg/zc/
buildout/buildout.py", line 634, in _develop
zc.buildout.easy_install.develop(setup, dest)
File "/opt/plone4/plone4/eggs/zc.buildout-1.4.3-py2.6.egg/zc/
buildout/easy_install.py", line 895, in develop
*args) == 0
AssertionError
Know anyone whats wrong?
I think this is caused by the template you are using. Perhaps it is outdated.
Check if your setup.py looks like this:
packages=find_packages('src'),
namespace_packages=['gomobiletheme'],
But you need an additional:
package_dir = {'': 'src'},
directive to get the buildout working again.