# 'pyfr run' KeyError for CUDA kernel

**URL:** <https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82>\
**Category:** General\
**Created:** [6 July 2015 18:33 UTC](https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82 "2015-07-06T18:33:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Fogal](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Tom\_Fogal](https://pyfr.discourse.group/u/Tom_Fogal)\
**Post date:** [6 July 2015 18:33 UTC](https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82/1 "2015-07-06T18:33:05Z")

</div>

This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

[pyfr.log](https://pyfr.discourse.group/uploads/short-url/qUwWXnpU0TftDaBs2uhEFxt7ffe.log) (15.3 KB)

[run.sh](https://pyfr.discourse.group/uploads/short-url/AlYEA0AMG3RzRkeIFqcXBVU9FCr.sh) (299 Bytes)

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [6 July 2015 19:18 UTC](https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82/2 "2015-07-06T19:18:30Z")

</div>

Hi Tom,

> I have tried with v1.0.0 and now  
> 4ce740ff4d7ff3bd93b6f3ad00ee46815b6b810c to no avail.
> 
> I am presently running with CUDA v6.5, PyCUDA 2014.1.
> 
> Any ideas as to what I might have messed up?

It takes a bit of work to unpick the various tracebacks (three in all!)  
but the issue stems from:

TypeError: Can't convert 'bytes' object to str implicitly

which is occurring in the pytools package. This was a bug in pytools  
that I believe I fix some months back and later made it into a  
subsequent release.

The solution, therefore, is to upgrade pytools to a more recent version  
that has more complete compatibility with Python 3. 9Most distributions  
still ship the broken version through their package managers and have  
not backported the fix.)

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Tom\_Fogal](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Tom\_Fogal](https://pyfr.discourse.group/u/Tom_Fogal)\
**Post date:** [6 July 2015 19:55 UTC](https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82/3 "2015-07-06T19:55:36Z")

</div>

Hi Freddie,

Sorry to make you wade through the errors!

I couldn't seem to get 'pip' to play nicely and install using python3 (vs. 2), but a couple manual installs of pytools and pycuda indeed fixed the issue.

Thanks much for the quick solution,

-tom

---

<div class="post-metadata">

**Author:** ![p.vincent](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/p.vincent/32/225_2.png) [@p.vincent](https://pyfr.discourse.group/u/p.vincent)\
**Post date:** [6 July 2015 22:59 UTC](https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82/4 "2015-07-06T22:59:30Z")

</div>

Hi Tom,

Glad you got the problem sorted.

Have you tried using [https://virtualenv.pypa.io/en/latest/](https://virtualenv.pypa.io/en/latest/) to manage Python packages? It works great managing conflicts between Python 2/3!

Cheers

Peter

Dr Peter Vincent MSci ARCS DIC PhD  
Senior Lecturer and EPSRC Early Career Fellow  
Department of Aeronautics  
Imperial College London  
South Kensington  
London  
SW7 2AZ  
UK

web: [www.imperial.ac.uk/aeronautics/research/vincentlab](http://www.imperial.ac.uk/aeronautics/research/vincentlab)  
twitter: @Vincent\_Lab

---

<div class="post-metadata">

**Author:** ![Tom\_Fogal](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Tom\_Fogal](https://pyfr.discourse.group/u/Tom_Fogal)\
**Post date:** [6 July 2015 23:04 UTC](https://pyfr.discourse.group/t/pyfr-run-keyerror-for-cuda-kernel/82/5 "2015-07-06T23:04:50Z")

</div>

Oh, I should take another look. I gave it a first spin last week, but  
dropped it when clean installs of pyFR inside it didn't fix my issue.

If only I'd thought to do a clean install + all modules!

Thanks,

-tom
