Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Request] build scenario failed #2125

Closed
beark007 opened this issue Dec 20, 2023 · 7 comments · Fixed by #2126
Closed

[Help Request] build scenario failed #2125

beark007 opened this issue Dec 20, 2023 · 7 comments · Fixed by #2126
Assignees
Labels
help wanted Extra attention is needed

Comments

@beark007
Copy link

beark007 commented Dec 20, 2023

High Level Description

1.install

pip install -e '.[camera_obs,train,test,envision]' --config-settings editable_mode=strict

2.build scenario

scl scenario build scenarios/sumo/loop/

3.problem

Building: scenarios/sumo/loop/
Error processing line 1 of /home/XXX/SMARTS/.venv/lib/python3.8/site-packages/zope.interface-6.1-py3.8-nspkg.pth:

Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "/home/XXX/SMARTS/build/__editable__.smarts-1.4.0-py3-none-any/smarts/__init__.py", line 22, in <module>
    from importlib.metadata import version
  File "/usr/lib/python3.8/importlib/metadata.py", line 3, in <module>
    import re
  File "/usr/lib/python3.8/re.py", line 124, in <module>
    import enum
  File "/usr/lib/python3.8/enum.py", line 2, in <module>
    from types import MappingProxyType, DynamicClassAttribute
ImportError: cannot import name 'MappingProxyType' from partially initialized module 'types' (most likely due to a circular import) (/home/XXX/SMARTS/smarts/sstudio/types/__init__.py)

During handling of the above exception, another exception occurred:

Version

master
commit:6ffa83fca9dda7

Operating System

Ubuntu 20.04

Problems

build scenario failed.

No response

@beark007 beark007 added the help wanted Extra attention is needed label Dec 20, 2023
@Gamenot Gamenot self-assigned this Dec 20, 2023
@Gamenot
Copy link
Collaborator

Gamenot commented Dec 20, 2023

@beark007, it appears like you may have a python environment issue. The smarts.sstudio.types is somehow overriding the standard python types module.

Would you happen to somehow have added <SMARTS_REPO>/smarts/sstudio to your PYTHONPATH or PATH environment variables?

If you try the python interpreter, does <SMARTS_REPO>/smarts/sstudio somehow show up in sys.path before /usr/lib/python3.8?

python
>>> import sys
>>> sys.path
>>> [os.path.abspath(p) for p in sys.path]
# example output
['/home/dev/repo/SMARTS', '/home/dev/anaconda3/lib/python39.zip', '/home/dev/anaconda3/lib/python3.9', '/home/dev/anaconda3/lib/python3.9/lib-dynload', '/home/dev/repo/SMARTS/.venv/lib/python3.9/site-packages', '/home/dev/repo/SMARTS/__editable__.smarts-1.4.0.finder.__path_hook__']

@beark007
Copy link
Author

@beark007, it appears like you may have a python environment issue. The smarts.sstudio.types is somehow overriding the standard python types module.

Would you happen to somehow have added <SMARTS_REPO>/smarts/sstudio to your PYTHONPATH or PATH environment variables?

If you try the python interpreter, does <SMARTS_REPO>/smarts/sstudio somehow show up in sys.path before /usr/lib/python3.8?

python
>>> import sys
>>> sys.path
>>> [os.path.abspath(p) for p in sys.path]
# example output
['/home/dev/repo/SMARTS', '/home/dev/anaconda3/lib/python39.zip', '/home/dev/anaconda3/lib/python3.9', '/home/dev/anaconda3/lib/python3.9/lib-dynload', '/home/dev/repo/SMARTS/.venv/lib/python3.9/site-packages', '/home/dev/repo/SMARTS/__editable__.smarts-1.4.0.finder.__path_hook__']

print info:
Python 3.8.10 (default, Nov 22 2023, 10:22:35)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import sys
sys.path
['', '/home/XXX/SMARTS', '/home/XXX/nuplan-devkit', '/home/XXX/carla_0910/PythonAPI/carla/dist/carla-0.9.10-py3.7-linux-x86_64.egg', '/home/XXX/carla_0910/PythonAPI/carla/agents', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/XXX/.local/lib/python3.8/site-packages', '/home/XXX/d4rl', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']

@beark007
Copy link
Author

After installing the environment under a new python, it still fails to build the scenario.

@Gamenot
Copy link
Collaborator

Gamenot commented Dec 21, 2023 via email

@beark007
Copy link
Author

I have never seen this error before and have not yet been able to reproduce the error for that commit. The system path is not suggesting anything. I am going to attempt to emulate the error and see if I can force the correct import order.

Many thanks!

@Gamenot
Copy link
Collaborator

Gamenot commented Dec 21, 2023

It appears like it may be related to Pycharm debug:

https://stackoverflow.com/a/68985644

What I might be able to do here is forcefully reload the module if types is smarts.sstudio.types when resolving through smarts.__init__.py. This may not be possible because types is a core module...

I think I am going to have to deprecate and rename smarts/sstudio/types.py.

@Gamenot
Copy link
Collaborator

Gamenot commented Dec 22, 2023

@beark007 I have merged in a fix that should resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants