# Ran into this issue while executing

**URL:** <https://discuss.pytorch.org/t/ran-into-this-issue-while-executing/101460>\
**Category:** Uncategorized\
**Created:** [November 3, 2020, 7:56am UTC](https://discuss.pytorch.org/t/ran-into-this-issue-while-executing/101460 "2020-11-03T07:56:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparshgarg23](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/sparshgarg23/32/41060_2.png) [@sparshgarg23](https://discuss.pytorch.org/u/sparshgarg23)\
**Post date:** [November 3, 2020, 7:56am UTC](https://discuss.pytorch.org/t/ran-into-this-issue-while-executing/101460/1 "2020-11-03T07:56:11Z")

</div>

Hi,  
I recently came across this post mentioned in the below link  
[https://towardsdatascience.com/the-one-pytorch-trick-which-you-should-know-2d5e9c1da2ca](https://towardsdatascience.com/the-one-pytorch-trick-which-you-should-know-2d5e9c1da2ca)

When I ran the code mentioned in the link,I ran into the following error  
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.  
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP\_DUPLICATE\_LIB\_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see [http://www.intel.com/software/products/support/](http://www.intel.com/software/products/support/).  
[SpyderKernelApp] WARNING | No such comm: 226297d71da911eb95ceaced5c5490c5  
Notice that when the following lines were added  
import os  
#os.environ[“KMP\_DUPLICATE\_LIB\_OK”]=“TRUE”  
the issue would disappear.Any ideas why this is happening and what can be done to get around this issue?  
Pytorch was installed using the command  
pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio===0.7.0 -f [https://download.pytorch.org/whl/torch\_stable.html](https://download.pytorch.org/whl/torch_stable.html)  
System config Windows 10 CPU intel i5  
Python 3.8.3

---

<div class="post-metadata">

**Author:** ![Arijit\_Ghosh](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/arijit_ghosh/32/41054_2.png) [@Arijit\_Ghosh](https://discuss.pytorch.org/u/Arijit_Ghosh)\
**Post date:** [August 7, 2021, 12:30pm UTC](https://discuss.pytorch.org/t/ran-into-this-issue-while-executing/101460/2 "2021-08-07T12:30:12Z")

</div>

Hye,  
I also ran in the same trouble.  
Found any strong solution?

---

<div class="post-metadata">

**Author:** ![sparshgarg23](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/sparshgarg23/32/41060_2.png) [@sparshgarg23](https://discuss.pytorch.org/u/sparshgarg23)\
**Post date:** [August 7, 2021, 4:18pm UTC](https://discuss.pytorch.org/t/ran-into-this-issue-while-executing/101460/3 "2021-08-07T16:18:11Z")

</div>

you can refer to this  
since i prefer quick fixes,i went with

```auto
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

```

but the correct solution is to create a seperate environment,and in that you must install all your packages

> <https://stackoverflow.com/questions/20554074/sklearn-omp-error-15-when-fitting-models>

---

<div class="post-metadata">

**Author:** ![Arijit\_Ghosh](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/arijit_ghosh/32/41054_2.png) [@Arijit\_Ghosh](https://discuss.pytorch.org/u/Arijit_Ghosh)\
**Post date:** [August 7, 2021, 5:06pm UTC](https://discuss.pytorch.org/t/ran-into-this-issue-while-executing/101460/4 "2021-08-07T17:06:39Z")

</div>

Hye!  
I did that, it was fixed for the time being.

But I didn’t like the aesthetic of it. So, after going through a bit, I just reinstalled pytorch but with a downgraded version (1.7.1). No issues after that. Some pointy bugs I guess with Python version 3.8 and above with Pytorch version 1.9.
