python bindings for LteHelper.InstallEnbDevice error - can't use an ObjectFactory without setting a TypeId first

128 views
Skip to first unread message

BJ Quinn

unread,
May 16, 2025, 5:37:06 PM5/16/25
to ns-3-users
Hello, I'm getting the following error when trying to use LteHelper.InstallEnbDevice in Python:  can't use an ObjectFactory without setting a TypeId first

[environment]
Ubuntu 24.04.1 LTS (WSL on Win11)
Python 3.12.3

[steps to reproduce from scratch]
git clone https://gitlab.com/nsnam/ns-3-dev.git
cd ns-3-dev
git checkout -b ns-3.44 ns-3.44
python3 -m venv venv
source venv/bin/activate
pip install cppyy==3.1.2
./ns3 configure --enable-examples --enable-tests --enable-python
./ns3 build

create test2.py with the following simplified code:
from ns import ns
enb_nodes = ns.NodeContainer()
enb_nodes.Create(1)
lte_helper = ns.LteHelper()
enb_devs = lte_helper.InstallEnbDevice(enb_nodes)

./ns3 shell
python test2.py

The line of code *from ns import ns* shows the following warnings:
[runStaticInitializersOnce]: Failed to materialize symbols: { (main, { __cxx_global_var_initcling_module_148_, _ZN3ns3L16g_timeInitHelperE, __orc_init_func.cling-module-148, _GLOBAL__sub_I_cling_module_148, $.cling-module-148.__inits.0 }) }
[runStaticInitializersOnce]: Failed to materialize symbols: { (main, { __orc_init_func.cling-module-148 }) }

And the line of code *enb_devs = lte_helper.InstallEnbDevice(enb_nodes)* shows the following error:
NS_ASSERT failed, cond="m_tid.GetUid()", msg="ObjectFactory::Create - can't use an ObjectFactory without setting a TypeId first.", +0.000000000s -1 file=/home/bjquinn/ns-3-dev/src/core/model/object-factory.cc, line=85
NS_FATAL, terminating
terminate called without an active exception
 *** Break *** abort

Apologies if I have missed something obvious here, but I have gone through the tutorial  and documentation and I have spent a couple of days trying to work through this.  My ultimate goal is to create a simulation for UE's to wander randomly and hand off between multiple base stations.  And eventually I will want to apply some RL models to the simulation.  My goal is to use Python for both setting up the simulation in ns3 as well as the RL feedback loop.

Thanks!

Gabriel Ferreira

unread,
May 18, 2025, 5:38:14 AM5/18/25
to ns-3-users
First, you must set the mobility model. Second, LTE helper should be created via CreateObject.

from ns import ns
enb_nodes = ns.NodeContainer()
enb_nodes.Create(1)

mobility = ns.MobilityHelper()
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel")
mobility.Install(enb_nodes)
enb_nodes.Get(0).__deref__().GetObject[ns.MobilityModel]().__deref__().SetPosition(ns.Vector(0, 0, 10))

   
lte_helper = ns.CreateObject[ns.LteHelper]()
enb_devs = lte_helper.__deref__().InstallEnbDevice(enb_nodes.Get(0))

BJ Quinn

unread,
May 21, 2025, 12:28:36 PM5/21/25
to ns-3-users
Fantastic, this fixed my problem.  I had previously set mobility model in my code, but I had been trying to boil it down to as simple of a snippet as possible to reproduce the error.  What I was really missing was creating the LTE helper via CreateObject.

Thank you!!

-BJ

From: ns-3-...@googlegroups.com <ns-3-...@googlegroups.com> on behalf of Gabriel Ferreira <gabriel...@gmail.com>
Sent: Sunday, May 18, 2025 4:38 AM
To: ns-3-users <ns-3-...@googlegroups.com>
Subject: Re: python bindings for LteHelper.InstallEnbDevice error - can't use an ObjectFactory without setting a TypeId first
 
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/nDRxWyPaRjo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ns-3-users/84658c44-1dd2-4212-888c-6f3731424b01n%40googlegroups.com.

Pavani Dara

unread,
May 22, 2025, 5:07:40 AM5/22/25
to ns-3-...@googlegroups.com

Why  do sometimes ns-3 don't give outputs even after it did provide output earlier with the same code


You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ns-3-users/CH3PR18MB60270E6938B4E6A43B5829FDCE9EA%40CH3PR18MB6027.namprd18.prod.outlook.com.

Gabriel Ferreira

unread,
May 22, 2025, 6:28:25 PM5/22/25
to ns-3-users
Same code, same result. If not same result, not same code. Or an uncontrolled randomness source
Reply all
Reply to author
Forward
0 new messages