# RuntimeError: cannot dereference null pointer from cdata 'float \*

**URL:** <https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71>\
**Category:** Application\
**Created:** [April 17, 2018, 8:23pm UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71 "2018-04-17T20:23:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryanscott13](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/bryanscott13/32/25_2.png) [@Bryanscott13](https://discuss.tvm.apache.org/u/Bryanscott13)\
**Post date:** [April 17, 2018, 8:23pm UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/1 "2018-04-17T20:23:43Z")

</div>

I have tried running the darknet test from the test folder as well as the darknet tutorial but am getting the same error in both cases.

Executing the following lines:

> dtype = ‘float32’ batch\_size = 1 print(“Converting darknet to nnvm symbols…”) sym, params = nnvm.frontend.darknet.from\_darknet(net, dtype)

But the following error occurs

> Loading weights from ./yolo.weights…Done! Converting darknet to nnvm symbols… Traceback (most recent call last): File “from\_darknet.py”, line 141, in sym, params = nnvm.frontend.darknet.from\_darknet(net, dtype) File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 643, in from\_darknet return \_from\_darknet(net, dtype) File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 617, in \_from\_darknet \_get\_darknet\_params(net.layers[i], layer\_name, tvmparams, dtype) File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 566, in \_get\_darknet\_params \_get\_convolution\_weights(layer, opname, tvmparams, dtype) File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 414, in \_get\_convolution\_weights biases = \_read\_memory\_buffer((layer.n, ), layer.biases, dtype) File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 397, in \_read\_memory\_buffer data\_np[i] = data[i] RuntimeError: cannot dereference null pointer from cdata ‘float \*’

---

<div class="post-metadata">

**Author:** ![ehsanmok](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/e/85e7bf/32.png) [@ehsanmok](https://discuss.tvm.apache.org/u/ehsanmok)\
**Post date:** [April 17, 2018, 8:55pm UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/2 "2018-04-17T20:55:29Z")

</div>

[This](https://discuss.tvm.ai/t/tvm-ndk-arm64-compile-without-rpc/65/3) worked for me.

---

<div class="post-metadata">

**Author:** ![Bryanscott13](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/bryanscott13/32/25_2.png) [@Bryanscott13](https://discuss.tvm.apache.org/u/Bryanscott13)\
**Post date:** [April 17, 2018, 9:26pm UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/3 "2018-04-17T21:26:32Z")

</div>

I tried installing the packages and changed the code but even after the changes, I get the same error. I tried compiling using the alexnet model and I get the same error in the same place.

---

<div class="post-metadata">

**Author:** ![PariksheetPinjari909](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/pariksheetpinjari909/32/23_2.png) [@PariksheetPinjari909](https://discuss.tvm.apache.org/u/PariksheetPinjari909)\
**Post date:** [April 18, 2018, 8:56am UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/4 "2018-04-18T08:56:49Z")

</div>

@Bryanscott13 we checked the issue, found that this issue will happen when you download from darknet master branch and compiled the library.  
It wont happen if you download from [https://github.com/siju-samuel/darknet](https://github.com/siju-samuel/darknet) and compile the library and use it while running.

---

<div class="post-metadata">

**Author:** ![prnvjb](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/ed655f/32.png) [@prnvjb](https://discuss.tvm.apache.org/u/prnvjb)\
**Post date:** [August 17, 2018, 7:17am UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/5 "2018-08-17T07:17:50Z")

</div>

@PariksheetPinjari909 @Bryanscott13  
What’s the difference from compiling with master branch?  
Would you please share the changes made in siju-samuel darknet repo ?  
Thanks!!

---

<div class="post-metadata">

**Author:** ![WenHao](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/w/dec6dc/32.png) [@WenHao](https://discuss.tvm.apache.org/u/WenHao)\
**Post date:** [June 27, 2019, 3:01am UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/6 "2019-06-27T03:01:40Z")

</div>

@PariksheetPinjari909 I have tried running from\_darknet.py with yolov3 and meet the same problem:

RuntimeError: cannot dereference null pointer from cdata ‘float \*’

I download libdarknet.so from darknet master branch, because the .so in [https://github.com/siju-samuel/darknet](https://github.com/siju-samuel/darknet) does not work for the latest version of tvm. How can I fix the problem?

---

<div class="post-metadata">

**Author:** ![Bienqq](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@Bienqq](https://discuss.tvm.apache.org/u/Bienqq)\
**Post date:** [October 6, 2019, 2:11pm UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/7 "2019-10-06T14:11:24Z")

</div>

Hello, any progress with this issue ? I have also the same problem. …

@PariksheetPinjari909  
Your solution does not work for me, it seems that this version of darknet is pretty old and even cannot parse my .cfg file correctly:

16 Type not recognized: [yolo]  
Unused field: ‘mask = 6,7,8’  
Unused field: ‘anchors = 10,13,16,30,33,23,30,61,62,45,59,119,116,90,156,198,373  
,326’  
Unused field: ‘classes = 80’  
Unused field: ‘num = 9’  
Unused field: ‘jitter = .3’  
Unused field: ‘ignore\_thresh = .5’  
Unused field: ‘truth\_thresh = 1’  
Unused field: ‘random = 1’

---

<div class="post-metadata">

**Author:** ![huangzhiyuan](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/huangzhiyuan/32/3633_2.png) [@huangzhiyuan](https://discuss.tvm.apache.org/u/huangzhiyuan)\
**Post date:** [February 23, 2022, 6:06am UTC](https://discuss.tvm.apache.org/t/runtimeerror-cannot-dereference-null-pointer-from-cdata-float/71/8 "2022-02-23T06:06:50Z")

</div>

Hello, I also met same issue when I start to run the test case in darknet tutorial with latest TVM code. And the libdarknet.so was generated in my MacBook from darknet master branch. Any update or suggestions? @PariksheetPinjari909
