FLOW error when running “python examples/SUMO/highway.py”

717 Views Asked by At

(flow) lab@lab-500-471cn:~/flow/examples/sumo$ python highway_ramps.py

netconvert: symbol lookup error: netconvert: undefined symbol: _ZN10OGRFeature16GetFieldAsStringEi

Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds...

Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds...

Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds...

Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds... Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds... Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds... Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds... Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds... Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds... Error during start: [Errno 2] No such file or directory: '/home/lab/flow/flow/core/kernel/network/debug/cfg/highway-ramp_20191106-1018371573006717.6494718.net.xml' Retrying in 1 seconds...

Traceback (most recent call last):

File "highway_ramps.py", line 115, in exp = highway_ramps_example()

File "highway_ramps.py", line 109, in highway_ramps_example env = AccelEnv(env_params, sim_params, network)

File "/home/lab/flow/flow/envs/ring/accel.py", line 80, in init super().init(env_params, sim_params, network, simulator)

File "/home/lab/flow/flow/envs/base.py", line 158, in init self.k.network.generate_network(self.network)

File "/home/lab/flow/flow/core/kernel/network/traci.py", line 146, in generate_network connections

File "/home/lab/flow/flow/core/kernel/network/traci.py", line 531, in generate_net raise error

TypeError: exceptions must derive from BaseException

Thanks very much!

2

There are 2 best solutions below

0
On

I had the same problem on Ubuntu 18.04... with Sumo installed from sources available from Flow repo

After some searching, it was apparent that the 'net' file was not getting created because the Flow installation directory 'path name' had white spaces in my instance. Therefore, I modified the traci.py file from below Line 510 as below (NOTE: some debugging code is also there for easy observation of output) and with some changes in the variables inside the 'subprocess.call' invocation

    final_net_path = "\'"+self.net_path+self.cfgfn+"\'"
    final_cfg_path = "\'"+self.cfg_path+self.netfn+"\'"

    #added by me
    print("netpath =",self.net_path)
    print("cfgpath =",self.cfg_path)
    print("netfn =",self.netfn)
    print("cfgfn =",self.cfgfn)

    subprocess.call(
        [
            'netconvert -c ' + final_net_path +
            ' --output-file=' + final_cfg_path +
            ' --no-internal-links="false"'
        ],
        stdout=subprocess.DEVNULL,
        shell=True)

The rest of the code section remains intact...

Hope this helps!

NOTE: The traci.py file is located in your flow directory's /flow/core/kernel/network path

0
On

I had the same problem when following the local installation of Flow instructions instructions on Ubuntu 19.10. The problem seems to come from the pre-compiled binaries. To solve the problem, I compiled and installed SUMO by following the instructions in (Optional) Direct install of SUMO from GitHub.