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
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 was trying Streamlit 1.13 on Windows 10, where I encountered the following error:
Z:\>streamlit run st1.py
2022-10-04 02:25:28.218 INFO numexpr.utils: NumExpr defaulting to 4 threads.
Welcome to Streamlit!
If you're one of our development partners or you're interested in getting
personal technical support or Streamlit updates, please enter your email
address below. Otherwise, you may leave the field blank.
http://localhost:8501
Traceback (most recent call last):
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\http1connection.py", line 276, in _read_message
delegate.finish()
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\routing.py", line 268, in finish
self.delegate.finish()
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\web.py", line 2322, in finish
self.execute()
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\web.py", line 2344, in execute
self.handler = self.handler_class(
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\web.py", line 239, in __init__
self.initialize(**kwargs) # type: ignore
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\web\server\routes.py", line 49, in initialize
self._pages = get_pages()
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\web\server\server.py", line 397, in <lambda>
for page_info in source_util.get_pages(
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\source_util.py", line 155, in get_pages
"script_path": str(main_script_path.resolve()),
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1215, in resolve
s = self._flavour.resolve(self, strict=strict)
File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 215, in resolve
s = self._ext_to_normal(_getfinalpathname(s))
OSError: [WinError 1] Incorrect function: 'st1.py'
The installation of streamlit was complete: initially there was a conflict which I fixed, I also installed it in Anaconda and the error was the same.
I checked the exact streamlit file which rised the exception and changed the script to print the actual path of the script and it was correct, as well as the file was there.
#File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\source_util.py", line 155, in get_pages
def get_pages(main_script_path_str: str) -> Dict[str, Dict[str, str]]:
global _cached_pages
print("main_script_path_str=",main_script_path_str) #DEBUG
# Avoid taking the lock if the pages cache hasn't been invalidated.
pages = _cached_pages
if pages is not None:
return pages
The problem was with the location of the script on a RAM disk. Moving it to the a regular disk resolved it.
Another question with this Win error reminded me that the drivers of Windows RAM drives, at least the ones I've used such as Imdisk or OSFMount, seem to have missing support of some of the OS file functions.
OSError: [WinError 1] Incorrect function
E.g. "Rust" also had errors when trying to build source located in any of these RAM drives on Windows.
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.
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
I am trying to get the usb.find command to work properly in a python script I'm writing on Angstrom for the Beagleboard.
Here is my code:
#!/usr/bin/env python
import usb.core
import usb.util
import usb.backend.libusb01 as libusb
PYUSB_DEBUG_LEVEL = 'debug'
# find our device
# Bus 002 Device 006: ID 1208:0815
# idVendor 0x1208
# idProduct 0x0815
# dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# iManufacturer 1 TOROBOT.com
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815,
backend=libusb.get_backend() )
I don't know what's missing, but here is what I do know.
When I don't specify the backend, no backend is found. When I do specify the backend "usb.backend.libusb01" I get the following error:
root#beagleboard:~/servo# ./pyServo.py
Traceback (most recent call last):
File "./pyServo.py", line 17, in <module>
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815, backend=libusb.get_backend() )
File "/usr/lib/python2.6/site-packages/usb/core.py", line 854, in find
return _interop._next(device_iter(k, v))
File "/usr/lib/python2.6/site-packages/usb/_interop.py", line 60, in _next
return next(iter)
File "/usr/lib/python2.6/site-packages/usb/core.py", line 821, in device_iter
for dev in backend.enumerate_devices():
File "/usr/lib/python2.6/site-packages/usb/backend/libusb01.py", line 390, in enumerate_devices
_check(_lib.usb_find_busses())
File "/usr/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: usb_find_busses
What am I missing so that this will work properly?
Thank you.
Python, pyusb, libusb.
I think that's it.
Well libc, ld-linux.so too of course, but those are in your system by default.
Do nm -D /path-to/libusb.so and see if usb_find_busses symbol is really there. There's always a chance that your libusb is outdated or somehow specially compiled.
Check if you get any log, for example missing libusb.so should produce something like 'Error loading libusb 0.1 backend'